2

I'm new in mathematica.

I have a list of values and i don't know how to find some poitns, such as peaks, the max and min of an interpolation function.

RA = List[{0, 0.727578}, {0.4, 0.73179}, {0.8, 0.773248}, {1.2, 1.342248}, {1.6, 0.987746}, {2, 0.791317}, {2.4, 1.11788}, {2.8, 0.996614}, {3.2, 0.938749}];

f = Interpolation[RA]

InterpolatingFunction[{{0., 3.2}}, <>]

Thanks

Jagra
  • 14,343
  • 1
  • 39
  • 81
Zarabu
  • 71
  • 2
  • Welcome to Mathematica.SE, Jessica! I suggest the following:
    1. Take the tour and check the faqs.
    2. When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
    3. As you receive help, try to give it too, by answering questions in your area of expertise.
    – Chris K Nov 08 '19 at 15:23
  • 1
    Have you seen FindPeaks[]? – Michael E2 Nov 08 '19 at 17:27
  • 1
    This answer might be helpful. – anderstood Nov 09 '19 at 09:07

2 Answers2

7

This functionality is included in the FindMaxima, FindMinima & FindExtrema functions in my EcoEvo package (the continuous part is based on this answer by @DanielLichtblau).

Import["https://raw.githubusercontent.com/cklausme/EcoEvo/master/EcoEvo/EcoEvo.m"]
(* ... or install with: *)
(* PacletInstall["https://github.com/cklausme/EcoEvo/releases/download/v1.1.0/EcoEvo-1.1.0.paclet"] *)
(* then load the package: *) 
(* <<EcoEvo` *)
(* EcoEvo Package Version 1.1.0 (October 22, 2019) *)

FindMaxima[RA]
(* {{1.2, 1.34225}, {2.4, 1.11788}} *)

FindMaxima[f]
(* {{0.171237, 0.75627}, {1.2, 1.34225}, {2.41594, 1.11823}} *)
Chris K
  • 20,207
  • 3
  • 39
  • 74
6

Here is your list and its interpolation. I only made the interpolation smoother:

rA = List[{0, 0.727578}, {0.4, 0.73179}, {0.8, 0.773248}, {1.2, 
    1.342248}, {1.6, 0.987746}, {2, 0.791317}, {2.4, 1.11788}, {2.8, 
    0.996614}, {3.2, 0.938749}];

f = Interpolation[rA, InterpolationOrder -> 3, Method -> "Spline"];

Let us plot it:

Plot[f[x], {x, 0, 3.2}]

enter image description here

Now, try this:

Map[FindMaximum[f[x], {x, #}] &, {0.1, 1., 2.3}]

(*  {{0.801624, {x -> 0.169875}}, {1.35071, {x -> 
    1.24042}}, {1.13541, {x -> 2.48519}}}   *)

Map[FindMinimum[f[x], {x, #}] &, {0.6, 2.1, 2.9}]

(*  {{0.672974, {x -> 0.605239}}, {0.772641, {x -> 
    1.91542}}, {0.890775, {x -> 3.06279}}}   *)

Have fun!

Alexei Boulbitch
  • 39,397
  • 2
  • 47
  • 96