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

What does the behaviour of water on the skin of an aircraft in flight tell us?

Is floating in space similar to falling under gravity?

Where is the logic in castrating fighters?

Why are C64 games inconsistent with which joystick port they use?

How to properly maintain eye contact with people that have distinct facial features?

If a person had control of every single cell of their body, would they be able to transform into another creature?

Do you play the upbeat when beginning to play a series of notes, and then after?

Expectation over a max operation

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

Can a Beholder use rays in melee range?

Is this resistor leaking? If so, is it a concern?

What F1 in name of seeds/varieties means?

Is there any use case for the bottom type as a function parameter type?

What is the 中 in ダウンロード中?

What is the most important source of natural gas? coal, oil or other?

Why doesn't the Earth's acceleration towards the Moon accumulate to push the Earth off its orbit?

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

What is a subpixel in Super Mario Bros, and how does it relate to wall clipping?

Is CD audio quality good enough for the final delivery of music?

Why does the 6502 have the BIT instruction?

Do firearms count as ranged weapons?

The Passive Wisdom (Perception) score of my character on D&D Beyond seems too high

Can a wire having a 610-670 THz (frequency of blue light) AC frequency supply, generate blue light?

Help to draw software architecture stack diagrams?



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?

            Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?