Error with Finding Maximum in Mathematica

In summary, the conversation is about finding the maximum of a function that is the sum of a list of numbers, which in turn depend on a variable x. The function is obtained by taking the discrete Fourier transform of the list, and while it can be plotted and the maximum can be visually determined, Mathematica is unable to find it due to an error with the list not being a numerical quantity. The suggested solution is to convert the list to an interpolating function, but the problem still persists when attempting to use the FindMaximum function.
  • #1
madness
815
70
I want to find the maximum of the total of a list of numbers, of which each depends on some variable x. I'm taking the discrete Fourier transform of a set of points of a function, and trying to maximise the sum of the resulting list. Although I can plot the sum of the list as a function of x, when I try to maximise it Mathematica tells me Fourier::fftl:Argument{my list} is not a non-empty list or rectangular array of numeric quantities. The error seems to be associated with taking the discrete Fourier transform of a non-numerical quantity. It should be taking this Fourier transform with a range of possible numbers and finding the maximum, but seems to be getting it wrong. Can anyone help?
 
Physics news on Phys.org
  • #2
I'm not sure i understand the problem but you can perhaps convert the set to an interpolating funciton which is essentially a list of numbers to MM.
 
  • #3
That's not quite it. I have a list L={a(x), b(x),...,n(x)}, the discrete Fourier transform gives Fourier[L]={A(x), B(x),..., N(x)} and my function is f(x)=A(x)+B(x)+...+N(x). This function plots perfectly and I can clearly see the maximum, but I want Mathematica to find it for me. So I say FindMaximum[F[x],{x,0}] and get the error mentioned above. It can't evaluate Fourier of x, when x isn't a number.
 

1. What is the "FindMaximum" function in Mathematica?

The "FindMaximum" function in Mathematica is a built-in function used for finding the maximum value of a given function. It takes in a function and a range of values as input and returns the maximum value and the corresponding input value at which the maximum occurs.

2. How does Mathematica handle errors with the "FindMaximum" function?

Mathematica has a built-in error handling system for the "FindMaximum" function. If there is an error in the input function or range, Mathematica will return an error message specifying the issue. If the function fails to converge to a maximum, Mathematica will also return an error message.

3. How can I troubleshoot errors with the "FindMaximum" function in Mathematica?

If you encounter errors with the "FindMaximum" function in Mathematica, the first step is to carefully check your input function and range for any mistakes. You can also try adjusting the step size or using different optimization methods. If the issue persists, you can refer to the Mathematica documentation or seek help from online forums and communities.

4. Can I use the "FindMaximum" function for multi-dimensional functions?

Yes, the "FindMaximum" function in Mathematica can handle multi-dimensional functions. It takes in a list of variables and their corresponding ranges as input and returns the maximum value and the corresponding input values in a list format. However, the computation time may increase significantly for higher-dimensional functions.

5. Are there any alternatives to the "FindMaximum" function in Mathematica?

Yes, there are several alternative functions in Mathematica that can be used for finding maximum values, such as "Maximize", "NMaximize", and "FindArgMax". Each of these functions has its own unique features and may be more suitable for certain types of functions or situations. It is always recommended to consult the Mathematica documentation or seek advice from experts to determine the best function for your specific problem.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
246
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
834
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top