Message Boards Message Boards

GROUPS:

Putting all extrema of an NDSolve output into a single list?

Posted 4 months ago
620 Views
|
4 Replies
|
1 Total Likes
|

Hello everyone,

I am trying to put all of the extrema of an NDSolve output into a single list. Specifically, I am hoping to have the extrema listed in order. For instance, in the case of an oscillatory system, I would hope to have a list like the following: {Maximum 1, Minimum 1, Maximum 2, Minimum 2,...}. Is there an efficient way to accomplish this? Attached is a notebook showing the system of equations I am working with.

Attachments:
POSTED BY: Alex L
Answer
4 Replies
Posted 4 months ago

How is this question different from this one?

Posted 4 months ago

That question was asking how one can put the minima in a single list and the maxima in another separate list. This question is asking how one could put the maxima and minima in a common list and in the order that they appear. For instance, {maximum 1, minimum 1, maximum 2, minimum 2, etc}. Is this possible?

Alex

POSTED BY: Alex L
Answer
Posted 4 months ago

Something like this?

max = {1, 3, 5}; min = {2, 4, 6};

Riffle[max, min]
(* {1, 2, 3, 4, 5, 6} *)
Posted 4 months ago

Oh, I did not think it could be done that easily. Thank you! I am new to Mathematica, so I apologize for all of the really specific questions. Your help is much appreciated.

Alex

POSTED BY: Alex L
Answer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract