How to construct and plot the following accumulated list?How to construct pairs in a list?Select rows of matrix that are higher than a given rowHow do I select only those lists whose elements are all above a certain number?Selecting every n-th element from a listFinding pairs where the intersection of them is empty set from a nested listHow to compare and remove x-coordinates (and the associated y-coordinates) that are less than previous x-coordinates?ListPlot with colorsModifying a function so that it will take multiple conditionsHow to construct a list of lengths efficientlySelecting cases from a list based on two conditions

Is there an evolutionary advantage to having two heads?

Smart people send dumb people to a new planet on a space craft that crashes into a body of water

How to plot an unstable attractor?

French translation of “only ever”

Word Mastermind

Tic-Tac-Toe for the terminal

How does an ARM MCU run faster than the external crystal?

If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?

Is this story about US tax office reasonable?

How to prevent bad sectors?

Break equation in parts

What's the connection between "kicking a pigeon" and "how a bill becomes a law"?

Ticket sales for Queen at the Live Aid

Is there an explanation for Austria's Freedom Party virtually retaining its vote share despite recent scandal?

Reducing Spill Overs

Best strategy for UK visa for a school trip (travelling alone or accomanpied child)?

Crossword gone overboard

I think I may have violated academic integrity last year - what should I do?

How long does it take to crack RSA 1024 with a PC?

Question about exercise 11.5 in TeXbook

Circumcircle bisects the segment connecting the vertices of two regular even-sided polygons

Can I use the Shadow Step feature to effectively teleport into a Darkness spell I cast upon myself?

Can a non-EU citizen travel within schengen zone freely without passport?

Where is the logic in castrating fighters?



How to construct and plot the following accumulated list?


How to construct pairs in a list?Select rows of matrix that are higher than a given rowHow do I select only those lists whose elements are all above a certain number?Selecting every n-th element from a listFinding pairs where the intersection of them is empty set from a nested listHow to compare and remove x-coordinates (and the associated y-coordinates) that are less than previous x-coordinates?ListPlot with colorsModifying a function so that it will take multiple conditionsHow to construct a list of lengths efficientlySelecting cases from a list based on two conditions













2












$begingroup$


I have a list, say it is



a = 1,3,3.2,3.9,4,4.4,4.9,5,7,8


To get the accumulate:



acc = Accumlate[a]


I want to plot the number of elements less than or equal to a certain element against the accumulated value of the list elements.
The pairs should look like (acc[[i]], number of elements less than a[[i]]). For instance, (1, 1), (4, 2), (7.2,3), etc.



Then I want to take the derivative of the plot to plot it as well.










share|improve this question











$endgroup$







  • 1




    $begingroup$
    The plotting is not a problem see ListPlot. Also, if you want a derivative you will have to define this as you don't have a continuous function. What have you tried so far?
    $endgroup$
    – Hugh
    Apr 13 at 11:26










  • $begingroup$
    The plot is an issue when I have very large number of pairs like 1000 pairs. I am trying to do it using ListPlot and a Do loop but it does not work. I am doing: ListLinePlot[Do[Print[acc[[i]], Count[a[[i]]], i, 10]] but it only prints the pairs for me with an empty plot.
    $endgroup$
    – Hamza
    Apr 13 at 12:04










  • $begingroup$
    Your combined use of Do and Print doesn't do what you expect. Print merely prints to the screen but does not build a list; use Table instead. Also, Count is something else.
    $endgroup$
    – Roman
    Apr 13 at 16:29















2












$begingroup$


I have a list, say it is



a = 1,3,3.2,3.9,4,4.4,4.9,5,7,8


To get the accumulate:



acc = Accumlate[a]


I want to plot the number of elements less than or equal to a certain element against the accumulated value of the list elements.
The pairs should look like (acc[[i]], number of elements less than a[[i]]). For instance, (1, 1), (4, 2), (7.2,3), etc.



Then I want to take the derivative of the plot to plot it as well.










share|improve this question











$endgroup$







  • 1




    $begingroup$
    The plotting is not a problem see ListPlot. Also, if you want a derivative you will have to define this as you don't have a continuous function. What have you tried so far?
    $endgroup$
    – Hugh
    Apr 13 at 11:26










  • $begingroup$
    The plot is an issue when I have very large number of pairs like 1000 pairs. I am trying to do it using ListPlot and a Do loop but it does not work. I am doing: ListLinePlot[Do[Print[acc[[i]], Count[a[[i]]], i, 10]] but it only prints the pairs for me with an empty plot.
    $endgroup$
    – Hamza
    Apr 13 at 12:04










  • $begingroup$
    Your combined use of Do and Print doesn't do what you expect. Print merely prints to the screen but does not build a list; use Table instead. Also, Count is something else.
    $endgroup$
    – Roman
    Apr 13 at 16:29













2












2








2





$begingroup$


I have a list, say it is



a = 1,3,3.2,3.9,4,4.4,4.9,5,7,8


To get the accumulate:



acc = Accumlate[a]


I want to plot the number of elements less than or equal to a certain element against the accumulated value of the list elements.
The pairs should look like (acc[[i]], number of elements less than a[[i]]). For instance, (1, 1), (4, 2), (7.2,3), etc.



Then I want to take the derivative of the plot to plot it as well.










share|improve this question











$endgroup$




I have a list, say it is



a = 1,3,3.2,3.9,4,4.4,4.9,5,7,8


To get the accumulate:



acc = Accumlate[a]


I want to plot the number of elements less than or equal to a certain element against the accumulated value of the list elements.
The pairs should look like (acc[[i]], number of elements less than a[[i]]). For instance, (1, 1), (4, 2), (7.2,3), etc.



Then I want to take the derivative of the plot to plot it as well.







plotting list-manipulation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 at 16:26









Roman

9,46511440




9,46511440










asked Apr 13 at 11:22









HamzaHamza

275




275







  • 1




    $begingroup$
    The plotting is not a problem see ListPlot. Also, if you want a derivative you will have to define this as you don't have a continuous function. What have you tried so far?
    $endgroup$
    – Hugh
    Apr 13 at 11:26










  • $begingroup$
    The plot is an issue when I have very large number of pairs like 1000 pairs. I am trying to do it using ListPlot and a Do loop but it does not work. I am doing: ListLinePlot[Do[Print[acc[[i]], Count[a[[i]]], i, 10]] but it only prints the pairs for me with an empty plot.
    $endgroup$
    – Hamza
    Apr 13 at 12:04










  • $begingroup$
    Your combined use of Do and Print doesn't do what you expect. Print merely prints to the screen but does not build a list; use Table instead. Also, Count is something else.
    $endgroup$
    – Roman
    Apr 13 at 16:29












  • 1




    $begingroup$
    The plotting is not a problem see ListPlot. Also, if you want a derivative you will have to define this as you don't have a continuous function. What have you tried so far?
    $endgroup$
    – Hugh
    Apr 13 at 11:26










  • $begingroup$
    The plot is an issue when I have very large number of pairs like 1000 pairs. I am trying to do it using ListPlot and a Do loop but it does not work. I am doing: ListLinePlot[Do[Print[acc[[i]], Count[a[[i]]], i, 10]] but it only prints the pairs for me with an empty plot.
    $endgroup$
    – Hamza
    Apr 13 at 12:04










  • $begingroup$
    Your combined use of Do and Print doesn't do what you expect. Print merely prints to the screen but does not build a list; use Table instead. Also, Count is something else.
    $endgroup$
    – Roman
    Apr 13 at 16:29







1




1




$begingroup$
The plotting is not a problem see ListPlot. Also, if you want a derivative you will have to define this as you don't have a continuous function. What have you tried so far?
$endgroup$
– Hugh
Apr 13 at 11:26




$begingroup$
The plotting is not a problem see ListPlot. Also, if you want a derivative you will have to define this as you don't have a continuous function. What have you tried so far?
$endgroup$
– Hugh
Apr 13 at 11:26












$begingroup$
The plot is an issue when I have very large number of pairs like 1000 pairs. I am trying to do it using ListPlot and a Do loop but it does not work. I am doing: ListLinePlot[Do[Print[acc[[i]], Count[a[[i]]], i, 10]] but it only prints the pairs for me with an empty plot.
$endgroup$
– Hamza
Apr 13 at 12:04




$begingroup$
The plot is an issue when I have very large number of pairs like 1000 pairs. I am trying to do it using ListPlot and a Do loop but it does not work. I am doing: ListLinePlot[Do[Print[acc[[i]], Count[a[[i]]], i, 10]] but it only prints the pairs for me with an empty plot.
$endgroup$
– Hamza
Apr 13 at 12:04












$begingroup$
Your combined use of Do and Print doesn't do what you expect. Print merely prints to the screen but does not build a list; use Table instead. Also, Count is something else.
$endgroup$
– Roman
Apr 13 at 16:29




$begingroup$
Your combined use of Do and Print doesn't do what you expect. Print merely prints to the screen but does not build a list; use Table instead. Also, Count is something else.
$endgroup$
– Roman
Apr 13 at 16:29










2 Answers
2






active

oldest

votes


















1












$begingroup$

Assuming that there are no duplicate elements in the list, and that the list is sorted in ascending order:



ListLinePlot[Transpose[Accumulate[a], Range[Length[a]]]]


If the list isn't sorted, you should replace Accumulate[a] with Accumulate[Sort[a]].



enter image description here



If you need the derivative, it may be easier to first construct an interpolating function. Here I make the interpolation linear (InterpolationOrder -> 1) but you can change this. You can get the above plot with Plot[b[x], x, 1, Total[a]] and the first-derivative plot with



b = Interpolation[Transpose[Accumulate[Sort[a]], Range[Length[a]]], 
InterpolationOrder -> 1];
Plot[b'[x], x, 1, Total[a]]


enter image description here






share|improve this answer











$endgroup$




















    3












    $begingroup$

    try this



    a = 1, 3, 3.2, 3.9, 4, 4.4, 4.9, 5, 7, 8;
    acc = Accumulate@a;
    aa[x_] := Length@Select[a, # <= a[[x]] &];
    list = Transpose[acc, aa /@ Range@Length@a]
    ListLinePlot@list



    1,1,4,2,7.2,3,11.1,4,15.1,5,19.5,6,24.4,7,29.4,8,36.4,9,44.4,10




    enter image description here






    share|improve this answer











    $endgroup$












    • $begingroup$
      The y-axis should represent the number of elements less than or equal a[[i]] not the element itself.
      $endgroup$
      – Hamza
      Apr 13 at 13:57










    • $begingroup$
      @Hamza fixed....
      $endgroup$
      – J42161217
      Apr 13 at 14:12











    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f195111%2fhow-to-construct-and-plot-the-following-accumulated-list%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1












    $begingroup$

    Assuming that there are no duplicate elements in the list, and that the list is sorted in ascending order:



    ListLinePlot[Transpose[Accumulate[a], Range[Length[a]]]]


    If the list isn't sorted, you should replace Accumulate[a] with Accumulate[Sort[a]].



    enter image description here



    If you need the derivative, it may be easier to first construct an interpolating function. Here I make the interpolation linear (InterpolationOrder -> 1) but you can change this. You can get the above plot with Plot[b[x], x, 1, Total[a]] and the first-derivative plot with



    b = Interpolation[Transpose[Accumulate[Sort[a]], Range[Length[a]]], 
    InterpolationOrder -> 1];
    Plot[b'[x], x, 1, Total[a]]


    enter image description here






    share|improve this answer











    $endgroup$

















      1












      $begingroup$

      Assuming that there are no duplicate elements in the list, and that the list is sorted in ascending order:



      ListLinePlot[Transpose[Accumulate[a], Range[Length[a]]]]


      If the list isn't sorted, you should replace Accumulate[a] with Accumulate[Sort[a]].



      enter image description here



      If you need the derivative, it may be easier to first construct an interpolating function. Here I make the interpolation linear (InterpolationOrder -> 1) but you can change this. You can get the above plot with Plot[b[x], x, 1, Total[a]] and the first-derivative plot with



      b = Interpolation[Transpose[Accumulate[Sort[a]], Range[Length[a]]], 
      InterpolationOrder -> 1];
      Plot[b'[x], x, 1, Total[a]]


      enter image description here






      share|improve this answer











      $endgroup$















        1












        1








        1





        $begingroup$

        Assuming that there are no duplicate elements in the list, and that the list is sorted in ascending order:



        ListLinePlot[Transpose[Accumulate[a], Range[Length[a]]]]


        If the list isn't sorted, you should replace Accumulate[a] with Accumulate[Sort[a]].



        enter image description here



        If you need the derivative, it may be easier to first construct an interpolating function. Here I make the interpolation linear (InterpolationOrder -> 1) but you can change this. You can get the above plot with Plot[b[x], x, 1, Total[a]] and the first-derivative plot with



        b = Interpolation[Transpose[Accumulate[Sort[a]], Range[Length[a]]], 
        InterpolationOrder -> 1];
        Plot[b'[x], x, 1, Total[a]]


        enter image description here






        share|improve this answer











        $endgroup$



        Assuming that there are no duplicate elements in the list, and that the list is sorted in ascending order:



        ListLinePlot[Transpose[Accumulate[a], Range[Length[a]]]]


        If the list isn't sorted, you should replace Accumulate[a] with Accumulate[Sort[a]].



        enter image description here



        If you need the derivative, it may be easier to first construct an interpolating function. Here I make the interpolation linear (InterpolationOrder -> 1) but you can change this. You can get the above plot with Plot[b[x], x, 1, Total[a]] and the first-derivative plot with



        b = Interpolation[Transpose[Accumulate[Sort[a]], Range[Length[a]]], 
        InterpolationOrder -> 1];
        Plot[b'[x], x, 1, Total[a]]


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 at 16:30

























        answered Apr 13 at 16:18









        RomanRoman

        9,46511440




        9,46511440





















            3












            $begingroup$

            try this



            a = 1, 3, 3.2, 3.9, 4, 4.4, 4.9, 5, 7, 8;
            acc = Accumulate@a;
            aa[x_] := Length@Select[a, # <= a[[x]] &];
            list = Transpose[acc, aa /@ Range@Length@a]
            ListLinePlot@list



            1,1,4,2,7.2,3,11.1,4,15.1,5,19.5,6,24.4,7,29.4,8,36.4,9,44.4,10




            enter image description here






            share|improve this answer











            $endgroup$












            • $begingroup$
              The y-axis should represent the number of elements less than or equal a[[i]] not the element itself.
              $endgroup$
              – Hamza
              Apr 13 at 13:57










            • $begingroup$
              @Hamza fixed....
              $endgroup$
              – J42161217
              Apr 13 at 14:12















            3












            $begingroup$

            try this



            a = 1, 3, 3.2, 3.9, 4, 4.4, 4.9, 5, 7, 8;
            acc = Accumulate@a;
            aa[x_] := Length@Select[a, # <= a[[x]] &];
            list = Transpose[acc, aa /@ Range@Length@a]
            ListLinePlot@list



            1,1,4,2,7.2,3,11.1,4,15.1,5,19.5,6,24.4,7,29.4,8,36.4,9,44.4,10




            enter image description here






            share|improve this answer











            $endgroup$












            • $begingroup$
              The y-axis should represent the number of elements less than or equal a[[i]] not the element itself.
              $endgroup$
              – Hamza
              Apr 13 at 13:57










            • $begingroup$
              @Hamza fixed....
              $endgroup$
              – J42161217
              Apr 13 at 14:12













            3












            3








            3





            $begingroup$

            try this



            a = 1, 3, 3.2, 3.9, 4, 4.4, 4.9, 5, 7, 8;
            acc = Accumulate@a;
            aa[x_] := Length@Select[a, # <= a[[x]] &];
            list = Transpose[acc, aa /@ Range@Length@a]
            ListLinePlot@list



            1,1,4,2,7.2,3,11.1,4,15.1,5,19.5,6,24.4,7,29.4,8,36.4,9,44.4,10




            enter image description here






            share|improve this answer











            $endgroup$



            try this



            a = 1, 3, 3.2, 3.9, 4, 4.4, 4.9, 5, 7, 8;
            acc = Accumulate@a;
            aa[x_] := Length@Select[a, # <= a[[x]] &];
            list = Transpose[acc, aa /@ Range@Length@a]
            ListLinePlot@list



            1,1,4,2,7.2,3,11.1,4,15.1,5,19.5,6,24.4,7,29.4,8,36.4,9,44.4,10




            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 13 at 14:12

























            answered Apr 13 at 12:45









            J42161217J42161217

            5,335525




            5,335525











            • $begingroup$
              The y-axis should represent the number of elements less than or equal a[[i]] not the element itself.
              $endgroup$
              – Hamza
              Apr 13 at 13:57










            • $begingroup$
              @Hamza fixed....
              $endgroup$
              – J42161217
              Apr 13 at 14:12
















            • $begingroup$
              The y-axis should represent the number of elements less than or equal a[[i]] not the element itself.
              $endgroup$
              – Hamza
              Apr 13 at 13:57










            • $begingroup$
              @Hamza fixed....
              $endgroup$
              – J42161217
              Apr 13 at 14:12















            $begingroup$
            The y-axis should represent the number of elements less than or equal a[[i]] not the element itself.
            $endgroup$
            – Hamza
            Apr 13 at 13:57




            $begingroup$
            The y-axis should represent the number of elements less than or equal a[[i]] not the element itself.
            $endgroup$
            – Hamza
            Apr 13 at 13:57












            $begingroup$
            @Hamza fixed....
            $endgroup$
            – J42161217
            Apr 13 at 14:12




            $begingroup$
            @Hamza fixed....
            $endgroup$
            – J42161217
            Apr 13 at 14:12

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Mathematica Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f195111%2fhow-to-construct-and-plot-the-following-accumulated-list%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?