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
$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.
plotting list-manipulation
$endgroup$
add a comment |
$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.
plotting list-manipulation
$endgroup$
1
$begingroup$
The plotting is not a problem seeListPlot
. 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 ofDo
andPrint
doesn't do what you expect.Print
merely prints to the screen but does not build a list; useTable
instead. Also,Count
is something else.
$endgroup$
– Roman
Apr 13 at 16:29
add a comment |
$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.
plotting list-manipulation
$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
plotting list-manipulation
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 seeListPlot
. 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 ofDo
andPrint
doesn't do what you expect.Print
merely prints to the screen but does not build a list; useTable
instead. Also,Count
is something else.
$endgroup$
– Roman
Apr 13 at 16:29
add a comment |
1
$begingroup$
The plotting is not a problem seeListPlot
. 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 ofDo
andPrint
doesn't do what you expect.Print
merely prints to the screen but does not build a list; useTable
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
add a comment |
2 Answers
2
active
oldest
votes
$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]]
.
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]]
$endgroup$
add a comment |
$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
$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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
$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]]
.
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]]
$endgroup$
add a comment |
$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]]
.
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]]
$endgroup$
add a comment |
$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]]
.
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]]
$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]]
.
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]]
edited Apr 13 at 16:30
answered Apr 13 at 16:18
RomanRoman
9,46511440
9,46511440
add a comment |
add a comment |
$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
$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
add a comment |
$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
$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
add a comment |
$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
$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
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
add a comment |
$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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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
andPrint
doesn't do what you expect.Print
merely prints to the screen but does not build a list; useTable
instead. Also,Count
is something else.$endgroup$
– Roman
Apr 13 at 16:29