Partitioning values in a sequenceOrdering the elements in a list and separate them into sublists for...
How could Tony Stark make this in Endgame?
Error message with tabularx
How to reduce LED flash rate (frequency)
Pulling the rope with one hand is as heavy as with two hands?
Seemingly unused edef prior to an ifx mysteriously affects the outcome of the ifx. Why?
Was there a shared-world project before "Thieves World"?
Is the 5 MB static resource size limit 5,242,880 bytes or 5,000,000 bytes?
What do the phrase "Reeyan's seacrest" and the word "fraggle" mean in a sketch?
Meaning of Bloch representation
How to verbalise code in Mathematica?
Please, smoke with good manners
Document starts having heaps of errors in the middle, but the code doesn't have any problems in it
How much cash can I safely carry into the USA and avoid civil forfeiture?
How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?
What's the polite way to say "I need to urinate"?
Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?
How can I place the product on a social media post better?
To say I met a person for the first time
Combinable filters
Apply MapThread to all but one variable
Is there an official tutorial for installing Ubuntu 18.04+ on a device with an SSD and an additional internal hard drive?
Rivers without rain
Can someone publish a story that happened to you?
How would one muzzle a full grown polar bear in the 13th century?
Partitioning values in a sequence
Ordering the elements in a list and separate them into sublists for plottingFinding all partitions of a setPartitioning an image based on featuresPartition list into a given number of sub-listsPartitioning List Into Sublists of Length 2 With The Pairing Being RandomCluster numbers into n partitions so that each partitions sum is closest to total/nEfficient lazy weak compositionsTiming and memory use is critical:fast partitioning of binary sparse arrayVariable iterator in Do Loop (splitting a list)Non-Constant Partitioning of a List with Order AnalysisTotally orderless partition
$begingroup$
I have a sequence that forms visible lines when plotted as a graph, what would be a good way to automatically partition the sequence to create a list of sequences, one for each line that is visible when the sequence is plotted?
Here is the start of the sequence:
list = {2,3,5,11,7,23,13,29,41,17,53,37,83,43,89,19,113,131,67,47,73,31,79,173,179,61,191,97,233,239,251,127,139,281,71,293,101,103,107,163,59,359,193,199,137,419,431,443,151,491,509,181,109,277,593,149,307,641,653,659,683,719,241,743,373,761,257,157,263,809,271,409,283,433,911,311,313,953,487,331,499,1013,1019,1031,347,1049,211,269,367,1103,577,167,397,1223,1229,619,1289,223,673,229,461,467,1409,709,1439,1451,727,739,1481,1499,503,1511,1559,1583,1601,401,557,337,853,1733,349,883,197};
Thanks.
cheers,
Jamie
partitions
$endgroup$
add a comment |
$begingroup$
I have a sequence that forms visible lines when plotted as a graph, what would be a good way to automatically partition the sequence to create a list of sequences, one for each line that is visible when the sequence is plotted?
Here is the start of the sequence:
list = {2,3,5,11,7,23,13,29,41,17,53,37,83,43,89,19,113,131,67,47,73,31,79,173,179,61,191,97,233,239,251,127,139,281,71,293,101,103,107,163,59,359,193,199,137,419,431,443,151,491,509,181,109,277,593,149,307,641,653,659,683,719,241,743,373,761,257,157,263,809,271,409,283,433,911,311,313,953,487,331,499,1013,1019,1031,347,1049,211,269,367,1103,577,167,397,1223,1229,619,1289,223,673,229,461,467,1409,709,1439,1451,727,739,1481,1499,503,1511,1559,1583,1601,401,557,337,853,1733,349,883,197};
Thanks.
cheers,
Jamie
partitions
$endgroup$
$begingroup$
Possible duplicate of ordering-the-elements-in-a-list-and-separate-them-into-sublists-for-plotting
$endgroup$
– MelaGo
yesterday
add a comment |
$begingroup$
I have a sequence that forms visible lines when plotted as a graph, what would be a good way to automatically partition the sequence to create a list of sequences, one for each line that is visible when the sequence is plotted?
Here is the start of the sequence:
list = {2,3,5,11,7,23,13,29,41,17,53,37,83,43,89,19,113,131,67,47,73,31,79,173,179,61,191,97,233,239,251,127,139,281,71,293,101,103,107,163,59,359,193,199,137,419,431,443,151,491,509,181,109,277,593,149,307,641,653,659,683,719,241,743,373,761,257,157,263,809,271,409,283,433,911,311,313,953,487,331,499,1013,1019,1031,347,1049,211,269,367,1103,577,167,397,1223,1229,619,1289,223,673,229,461,467,1409,709,1439,1451,727,739,1481,1499,503,1511,1559,1583,1601,401,557,337,853,1733,349,883,197};
Thanks.
cheers,
Jamie
partitions
$endgroup$
I have a sequence that forms visible lines when plotted as a graph, what would be a good way to automatically partition the sequence to create a list of sequences, one for each line that is visible when the sequence is plotted?
Here is the start of the sequence:
list = {2,3,5,11,7,23,13,29,41,17,53,37,83,43,89,19,113,131,67,47,73,31,79,173,179,61,191,97,233,239,251,127,139,281,71,293,101,103,107,163,59,359,193,199,137,419,431,443,151,491,509,181,109,277,593,149,307,641,653,659,683,719,241,743,373,761,257,157,263,809,271,409,283,433,911,311,313,953,487,331,499,1013,1019,1031,347,1049,211,269,367,1103,577,167,397,1223,1229,619,1289,223,673,229,461,467,1409,709,1439,1451,727,739,1481,1499,503,1511,1559,1583,1601,401,557,337,853,1733,349,883,197};
Thanks.
cheers,
Jamie
partitions
partitions
edited yesterday
user64494
3,65311122
3,65311122
asked yesterday
Jamie MJamie M
525
525
$begingroup$
Possible duplicate of ordering-the-elements-in-a-list-and-separate-them-into-sublists-for-plotting
$endgroup$
– MelaGo
yesterday
add a comment |
$begingroup$
Possible duplicate of ordering-the-elements-in-a-list-and-separate-them-into-sublists-for-plotting
$endgroup$
– MelaGo
yesterday
$begingroup$
Possible duplicate of ordering-the-elements-in-a-list-and-separate-them-into-sublists-for-plotting
$endgroup$
– MelaGo
yesterday
$begingroup$
Possible duplicate of ordering-the-elements-in-a-list-and-separate-them-into-sublists-for-plotting
$endgroup$
– MelaGo
yesterday
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
You could for instance fit a mean polynomial function through the data:
fun = NonlinearModelFit[list, a x^2 + b x + c , {a, b, c}, x] //Normal
-48.3941 + 6.86017 x + 0.0161064 x^2
This will separarate the upper line from the lower line that you can see in the plot:
Show[
ListLinePlot[list, PlotRange -> All],
Plot[fun, {x, 0, 125}, PlotRange -> All, PlotStyle -> Red],
PlotRange -> All]
Then you can simply run through the list and separate it into two lists based on whether the value is above or below the mean fit:
upperLine = {};
lowerLine = {};
shift=1;
Do[
If[list[[x]] > fun+shift,
AppendTo[upperLine, {x, list[[x]]}],
AppendTo[lowerLine, {x, list[[x]]}]];
, {x, 1, Length[list]}]
The upperLine
and lowerLine
data sets then look like:
{ListLinePlot[upperLine], ListLinePlot[lowerLine]}
Repeat the process on the lowerLine
data to separate the sequences further. For instance for the next line:
newlist = lowerLine;
fun = NonlinearModelFit[newlist, a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine2 = {};
lowerLine = {};
shift = 10;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine2, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
And the next line:
newlist = lowerLine;
fun = NonlinearModelFit[ newlist[[FindPeaks[newlist[[;; , 2]]][[;; , 1]]]], a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine3 = {};
lowerLine = {};
shift = -8;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine3, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
So far this looks like:
Show[ListPlot[upperLine, PlotStyle -> Red],
ListPlot[upperLine2, PlotStyle -> Green],
ListPlot[upperLine3, PlotStyle -> Black],
ListPlot[lowerLine, PlotStyle -> Blue]]
You'll have to play with the shift
parameter a bit for optimal results. Just execute the fit first and plot it against newlist
, adjust shift
and proceed.
PS:
If you have a mathematical model for a function that describes these curves, you could use it with intermediate parameter values instead of the polynomial fit to separate the points much better.
$endgroup$
$begingroup$
How could I have the polynomial adjusted upwards, ie offset a certain distance from the max value? the max value will always be in the uppermost line being partitioned out.
$endgroup$
– Jamie M
yesterday
$begingroup$
@JamieM After making the fit, try plottingfun+c
instead offun
, where you put a real number for the shiftc
. This will shift the curve up and down allowing you to separate points a bit more precisely. Is that what you had in mind?
$endgroup$
– Kagaratsch
yesterday
add a comment |
$begingroup$
list = {2, 3, 5, 11, 7, 23, 13, 29, 41, 17, 53, 37, 83, 43, 89, 19,
113, 131, 67, 47, 73, 31, 79, 173, 179, 61, 191, 97, 233, 239, 251,
127, 139, 281, 71, 293, 101, 103, 107, 163, 59, 359, 193, 199,
137, 419, 431, 443, 151, 491, 509, 181, 109, 277, 593, 149, 307,
641, 653, 659, 683, 719, 241, 743, 373, 761, 257, 157, 263, 809,
271, 409, 283, 433, 911, 311, 313, 953, 487, 331, 499, 1013, 1019,
1031, 347, 1049, 211, 269, 367, 1103, 577, 167, 397, 1223, 1229,
619, 1289, 223, 673, 229, 461, 467, 1409, 709, 1439, 1451, 727,
739, 1481, 1499, 503, 1511, 1559, 1583, 1601, 401, 557, 337, 853,
1733, 349, 883, 197};
upper = FindPeaks[list];
lower = {1, -1} # & /@ FindPeaks[-list];
ListLinePlot[{list, lower, upper},
PlotStyle -> {LightGray, Blue, Red}]
$endgroup$
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%2f197055%2fpartitioning-values-in-a-sequence%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$
You could for instance fit a mean polynomial function through the data:
fun = NonlinearModelFit[list, a x^2 + b x + c , {a, b, c}, x] //Normal
-48.3941 + 6.86017 x + 0.0161064 x^2
This will separarate the upper line from the lower line that you can see in the plot:
Show[
ListLinePlot[list, PlotRange -> All],
Plot[fun, {x, 0, 125}, PlotRange -> All, PlotStyle -> Red],
PlotRange -> All]
Then you can simply run through the list and separate it into two lists based on whether the value is above or below the mean fit:
upperLine = {};
lowerLine = {};
shift=1;
Do[
If[list[[x]] > fun+shift,
AppendTo[upperLine, {x, list[[x]]}],
AppendTo[lowerLine, {x, list[[x]]}]];
, {x, 1, Length[list]}]
The upperLine
and lowerLine
data sets then look like:
{ListLinePlot[upperLine], ListLinePlot[lowerLine]}
Repeat the process on the lowerLine
data to separate the sequences further. For instance for the next line:
newlist = lowerLine;
fun = NonlinearModelFit[newlist, a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine2 = {};
lowerLine = {};
shift = 10;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine2, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
And the next line:
newlist = lowerLine;
fun = NonlinearModelFit[ newlist[[FindPeaks[newlist[[;; , 2]]][[;; , 1]]]], a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine3 = {};
lowerLine = {};
shift = -8;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine3, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
So far this looks like:
Show[ListPlot[upperLine, PlotStyle -> Red],
ListPlot[upperLine2, PlotStyle -> Green],
ListPlot[upperLine3, PlotStyle -> Black],
ListPlot[lowerLine, PlotStyle -> Blue]]
You'll have to play with the shift
parameter a bit for optimal results. Just execute the fit first and plot it against newlist
, adjust shift
and proceed.
PS:
If you have a mathematical model for a function that describes these curves, you could use it with intermediate parameter values instead of the polynomial fit to separate the points much better.
$endgroup$
$begingroup$
How could I have the polynomial adjusted upwards, ie offset a certain distance from the max value? the max value will always be in the uppermost line being partitioned out.
$endgroup$
– Jamie M
yesterday
$begingroup$
@JamieM After making the fit, try plottingfun+c
instead offun
, where you put a real number for the shiftc
. This will shift the curve up and down allowing you to separate points a bit more precisely. Is that what you had in mind?
$endgroup$
– Kagaratsch
yesterday
add a comment |
$begingroup$
You could for instance fit a mean polynomial function through the data:
fun = NonlinearModelFit[list, a x^2 + b x + c , {a, b, c}, x] //Normal
-48.3941 + 6.86017 x + 0.0161064 x^2
This will separarate the upper line from the lower line that you can see in the plot:
Show[
ListLinePlot[list, PlotRange -> All],
Plot[fun, {x, 0, 125}, PlotRange -> All, PlotStyle -> Red],
PlotRange -> All]
Then you can simply run through the list and separate it into two lists based on whether the value is above or below the mean fit:
upperLine = {};
lowerLine = {};
shift=1;
Do[
If[list[[x]] > fun+shift,
AppendTo[upperLine, {x, list[[x]]}],
AppendTo[lowerLine, {x, list[[x]]}]];
, {x, 1, Length[list]}]
The upperLine
and lowerLine
data sets then look like:
{ListLinePlot[upperLine], ListLinePlot[lowerLine]}
Repeat the process on the lowerLine
data to separate the sequences further. For instance for the next line:
newlist = lowerLine;
fun = NonlinearModelFit[newlist, a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine2 = {};
lowerLine = {};
shift = 10;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine2, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
And the next line:
newlist = lowerLine;
fun = NonlinearModelFit[ newlist[[FindPeaks[newlist[[;; , 2]]][[;; , 1]]]], a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine3 = {};
lowerLine = {};
shift = -8;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine3, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
So far this looks like:
Show[ListPlot[upperLine, PlotStyle -> Red],
ListPlot[upperLine2, PlotStyle -> Green],
ListPlot[upperLine3, PlotStyle -> Black],
ListPlot[lowerLine, PlotStyle -> Blue]]
You'll have to play with the shift
parameter a bit for optimal results. Just execute the fit first and plot it against newlist
, adjust shift
and proceed.
PS:
If you have a mathematical model for a function that describes these curves, you could use it with intermediate parameter values instead of the polynomial fit to separate the points much better.
$endgroup$
$begingroup$
How could I have the polynomial adjusted upwards, ie offset a certain distance from the max value? the max value will always be in the uppermost line being partitioned out.
$endgroup$
– Jamie M
yesterday
$begingroup$
@JamieM After making the fit, try plottingfun+c
instead offun
, where you put a real number for the shiftc
. This will shift the curve up and down allowing you to separate points a bit more precisely. Is that what you had in mind?
$endgroup$
– Kagaratsch
yesterday
add a comment |
$begingroup$
You could for instance fit a mean polynomial function through the data:
fun = NonlinearModelFit[list, a x^2 + b x + c , {a, b, c}, x] //Normal
-48.3941 + 6.86017 x + 0.0161064 x^2
This will separarate the upper line from the lower line that you can see in the plot:
Show[
ListLinePlot[list, PlotRange -> All],
Plot[fun, {x, 0, 125}, PlotRange -> All, PlotStyle -> Red],
PlotRange -> All]
Then you can simply run through the list and separate it into two lists based on whether the value is above or below the mean fit:
upperLine = {};
lowerLine = {};
shift=1;
Do[
If[list[[x]] > fun+shift,
AppendTo[upperLine, {x, list[[x]]}],
AppendTo[lowerLine, {x, list[[x]]}]];
, {x, 1, Length[list]}]
The upperLine
and lowerLine
data sets then look like:
{ListLinePlot[upperLine], ListLinePlot[lowerLine]}
Repeat the process on the lowerLine
data to separate the sequences further. For instance for the next line:
newlist = lowerLine;
fun = NonlinearModelFit[newlist, a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine2 = {};
lowerLine = {};
shift = 10;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine2, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
And the next line:
newlist = lowerLine;
fun = NonlinearModelFit[ newlist[[FindPeaks[newlist[[;; , 2]]][[;; , 1]]]], a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine3 = {};
lowerLine = {};
shift = -8;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine3, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
So far this looks like:
Show[ListPlot[upperLine, PlotStyle -> Red],
ListPlot[upperLine2, PlotStyle -> Green],
ListPlot[upperLine3, PlotStyle -> Black],
ListPlot[lowerLine, PlotStyle -> Blue]]
You'll have to play with the shift
parameter a bit for optimal results. Just execute the fit first and plot it against newlist
, adjust shift
and proceed.
PS:
If you have a mathematical model for a function that describes these curves, you could use it with intermediate parameter values instead of the polynomial fit to separate the points much better.
$endgroup$
You could for instance fit a mean polynomial function through the data:
fun = NonlinearModelFit[list, a x^2 + b x + c , {a, b, c}, x] //Normal
-48.3941 + 6.86017 x + 0.0161064 x^2
This will separarate the upper line from the lower line that you can see in the plot:
Show[
ListLinePlot[list, PlotRange -> All],
Plot[fun, {x, 0, 125}, PlotRange -> All, PlotStyle -> Red],
PlotRange -> All]
Then you can simply run through the list and separate it into two lists based on whether the value is above or below the mean fit:
upperLine = {};
lowerLine = {};
shift=1;
Do[
If[list[[x]] > fun+shift,
AppendTo[upperLine, {x, list[[x]]}],
AppendTo[lowerLine, {x, list[[x]]}]];
, {x, 1, Length[list]}]
The upperLine
and lowerLine
data sets then look like:
{ListLinePlot[upperLine], ListLinePlot[lowerLine]}
Repeat the process on the lowerLine
data to separate the sequences further. For instance for the next line:
newlist = lowerLine;
fun = NonlinearModelFit[newlist, a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine2 = {};
lowerLine = {};
shift = 10;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine2, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
And the next line:
newlist = lowerLine;
fun = NonlinearModelFit[ newlist[[FindPeaks[newlist[[;; , 2]]][[;; , 1]]]], a x^2 + b x + c, {a, b, c}, x] // Normal;
upperLine3 = {};
lowerLine = {};
shift = -8;
Do[If[newlist[[i, 2]] > (fun + shift /. x -> newlist[[i, 1]]),
AppendTo[upperLine3, newlist[[i]]],
AppendTo[lowerLine, newlist[[i]]]];
, {i, 1, Length[newlist]}]
So far this looks like:
Show[ListPlot[upperLine, PlotStyle -> Red],
ListPlot[upperLine2, PlotStyle -> Green],
ListPlot[upperLine3, PlotStyle -> Black],
ListPlot[lowerLine, PlotStyle -> Blue]]
You'll have to play with the shift
parameter a bit for optimal results. Just execute the fit first and plot it against newlist
, adjust shift
and proceed.
PS:
If you have a mathematical model for a function that describes these curves, you could use it with intermediate parameter values instead of the polynomial fit to separate the points much better.
edited yesterday
answered yesterday
KagaratschKagaratsch
4,92231350
4,92231350
$begingroup$
How could I have the polynomial adjusted upwards, ie offset a certain distance from the max value? the max value will always be in the uppermost line being partitioned out.
$endgroup$
– Jamie M
yesterday
$begingroup$
@JamieM After making the fit, try plottingfun+c
instead offun
, where you put a real number for the shiftc
. This will shift the curve up and down allowing you to separate points a bit more precisely. Is that what you had in mind?
$endgroup$
– Kagaratsch
yesterday
add a comment |
$begingroup$
How could I have the polynomial adjusted upwards, ie offset a certain distance from the max value? the max value will always be in the uppermost line being partitioned out.
$endgroup$
– Jamie M
yesterday
$begingroup$
@JamieM After making the fit, try plottingfun+c
instead offun
, where you put a real number for the shiftc
. This will shift the curve up and down allowing you to separate points a bit more precisely. Is that what you had in mind?
$endgroup$
– Kagaratsch
yesterday
$begingroup$
How could I have the polynomial adjusted upwards, ie offset a certain distance from the max value? the max value will always be in the uppermost line being partitioned out.
$endgroup$
– Jamie M
yesterday
$begingroup$
How could I have the polynomial adjusted upwards, ie offset a certain distance from the max value? the max value will always be in the uppermost line being partitioned out.
$endgroup$
– Jamie M
yesterday
$begingroup$
@JamieM After making the fit, try plotting
fun+c
instead of fun
, where you put a real number for the shift c
. This will shift the curve up and down allowing you to separate points a bit more precisely. Is that what you had in mind?$endgroup$
– Kagaratsch
yesterday
$begingroup$
@JamieM After making the fit, try plotting
fun+c
instead of fun
, where you put a real number for the shift c
. This will shift the curve up and down allowing you to separate points a bit more precisely. Is that what you had in mind?$endgroup$
– Kagaratsch
yesterday
add a comment |
$begingroup$
list = {2, 3, 5, 11, 7, 23, 13, 29, 41, 17, 53, 37, 83, 43, 89, 19,
113, 131, 67, 47, 73, 31, 79, 173, 179, 61, 191, 97, 233, 239, 251,
127, 139, 281, 71, 293, 101, 103, 107, 163, 59, 359, 193, 199,
137, 419, 431, 443, 151, 491, 509, 181, 109, 277, 593, 149, 307,
641, 653, 659, 683, 719, 241, 743, 373, 761, 257, 157, 263, 809,
271, 409, 283, 433, 911, 311, 313, 953, 487, 331, 499, 1013, 1019,
1031, 347, 1049, 211, 269, 367, 1103, 577, 167, 397, 1223, 1229,
619, 1289, 223, 673, 229, 461, 467, 1409, 709, 1439, 1451, 727,
739, 1481, 1499, 503, 1511, 1559, 1583, 1601, 401, 557, 337, 853,
1733, 349, 883, 197};
upper = FindPeaks[list];
lower = {1, -1} # & /@ FindPeaks[-list];
ListLinePlot[{list, lower, upper},
PlotStyle -> {LightGray, Blue, Red}]
$endgroup$
add a comment |
$begingroup$
list = {2, 3, 5, 11, 7, 23, 13, 29, 41, 17, 53, 37, 83, 43, 89, 19,
113, 131, 67, 47, 73, 31, 79, 173, 179, 61, 191, 97, 233, 239, 251,
127, 139, 281, 71, 293, 101, 103, 107, 163, 59, 359, 193, 199,
137, 419, 431, 443, 151, 491, 509, 181, 109, 277, 593, 149, 307,
641, 653, 659, 683, 719, 241, 743, 373, 761, 257, 157, 263, 809,
271, 409, 283, 433, 911, 311, 313, 953, 487, 331, 499, 1013, 1019,
1031, 347, 1049, 211, 269, 367, 1103, 577, 167, 397, 1223, 1229,
619, 1289, 223, 673, 229, 461, 467, 1409, 709, 1439, 1451, 727,
739, 1481, 1499, 503, 1511, 1559, 1583, 1601, 401, 557, 337, 853,
1733, 349, 883, 197};
upper = FindPeaks[list];
lower = {1, -1} # & /@ FindPeaks[-list];
ListLinePlot[{list, lower, upper},
PlotStyle -> {LightGray, Blue, Red}]
$endgroup$
add a comment |
$begingroup$
list = {2, 3, 5, 11, 7, 23, 13, 29, 41, 17, 53, 37, 83, 43, 89, 19,
113, 131, 67, 47, 73, 31, 79, 173, 179, 61, 191, 97, 233, 239, 251,
127, 139, 281, 71, 293, 101, 103, 107, 163, 59, 359, 193, 199,
137, 419, 431, 443, 151, 491, 509, 181, 109, 277, 593, 149, 307,
641, 653, 659, 683, 719, 241, 743, 373, 761, 257, 157, 263, 809,
271, 409, 283, 433, 911, 311, 313, 953, 487, 331, 499, 1013, 1019,
1031, 347, 1049, 211, 269, 367, 1103, 577, 167, 397, 1223, 1229,
619, 1289, 223, 673, 229, 461, 467, 1409, 709, 1439, 1451, 727,
739, 1481, 1499, 503, 1511, 1559, 1583, 1601, 401, 557, 337, 853,
1733, 349, 883, 197};
upper = FindPeaks[list];
lower = {1, -1} # & /@ FindPeaks[-list];
ListLinePlot[{list, lower, upper},
PlotStyle -> {LightGray, Blue, Red}]
$endgroup$
list = {2, 3, 5, 11, 7, 23, 13, 29, 41, 17, 53, 37, 83, 43, 89, 19,
113, 131, 67, 47, 73, 31, 79, 173, 179, 61, 191, 97, 233, 239, 251,
127, 139, 281, 71, 293, 101, 103, 107, 163, 59, 359, 193, 199,
137, 419, 431, 443, 151, 491, 509, 181, 109, 277, 593, 149, 307,
641, 653, 659, 683, 719, 241, 743, 373, 761, 257, 157, 263, 809,
271, 409, 283, 433, 911, 311, 313, 953, 487, 331, 499, 1013, 1019,
1031, 347, 1049, 211, 269, 367, 1103, 577, 167, 397, 1223, 1229,
619, 1289, 223, 673, 229, 461, 467, 1409, 709, 1439, 1451, 727,
739, 1481, 1499, 503, 1511, 1559, 1583, 1601, 401, 557, 337, 853,
1733, 349, 883, 197};
upper = FindPeaks[list];
lower = {1, -1} # & /@ FindPeaks[-list];
ListLinePlot[{list, lower, upper},
PlotStyle -> {LightGray, Blue, Red}]
answered yesterday
Bob HanlonBob Hanlon
62k33598
62k33598
add a comment |
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%2f197055%2fpartitioning-values-in-a-sequence%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
$begingroup$
Possible duplicate of ordering-the-elements-in-a-list-and-separate-them-into-sublists-for-plotting
$endgroup$
– MelaGo
yesterday