Mathematica Question: Finding local maximums

In summary, Mathematica is a computer program used for mathematical and scientific calculations, data visualization, and programming. It is widely used by professionals in various fields. To find local maximums using Mathematica, you can use the <code>FindMaximum</code> function. This function takes in an expression and a range of values to search for the maximum and returns the maximum value and the corresponding variable values. Mathematica can find multiple local maximums in a given range by using the <code>FindMaximum</code> function with the option <code>MaxIterations</code> or the <code>FindMaxima</code> function. The accuracy of the results obtained from Mathematica for finding local maximums depends on the input function
  • #1
dreiter
33
0
Hi all! This is a generic Mathematica question, which hopefully someone can help me with! :)

I have a set of data points.
I have an interpolating function from those points.
I have a graph of that interpolation function.

The graph goes like Sin^2, and has about 10 peaks. I want to have Mathematica find those 10 peaks. FindMaximum only finds 1 peak. How can I get it to find all 10?
 
Last edited:
Physics news on Phys.org
  • #2
I would use:

Union[Table[FindMaximum[f[x], {x, xInit}], {xInit, xMin, xMax, xStep}]]
 
  • #3


One way to find all 10 peaks is to use the FindPeaks function in Mathematica. This function allows you to specify the number of peaks to find and returns a list of the peak positions and heights. You can also specify a threshold for the peak height to filter out smaller peaks. Another option is to use the PeakDetect function, which automatically detects peaks in a given dataset. Both of these functions can be applied to your interpolating function to find all 10 peaks. Additionally, you can try using different algorithms for finding local maxima, such as the FindMaximum function with a different starting point, or the NMaximize function which allows you to specify multiple starting points.
 

1. What is Mathematica?

Mathematica is a computer program used for mathematical and scientific calculations, data visualization, and programming. It is widely used by scientists, engineers, mathematicians, and other professionals in various fields.

2. How can I find local maximums using Mathematica?

To find local maximums using Mathematica, you can use the FindMaximum function. This function takes in an expression and a range of values to search for the maximum. It returns the maximum value and the corresponding variable values.

3. Can Mathematica find multiple local maximums in a given range?

Yes, Mathematica can find multiple local maximums in a given range. You can use the FindMaximum function with the option MaxIterations to specify the number of maximums to be found. You can also use the FindMaxima function, which returns a list of all the local maximums in a given range.

4. How accurate are the results obtained from Mathematica for finding local maximums?

The accuracy of the results depends on the input function and the range specified. Mathematica uses numerical methods and algorithms to find local maximums, which are generally very accurate. However, it is always recommended to verify the results and use appropriate settings for better accuracy.

5. Can Mathematica find local maximums for multivariable functions?

Yes, Mathematica can find local maximums for multivariable functions. You can use the FindMaximum function with multiple variables and specify the range for each variable. Alternatively, you can use the FindMaxima function, which can handle multivariable functions and returns a list of all the local maximums.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
255
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
893
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top