Finding Max/Min Y-Axis Values in Mathematica Plots

  • Context: Mathematica 
  • Thread starter Thread starter natski
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion centers on the challenges of obtaining maximum and minimum y-axis values from 2D plots in Mathematica. Participants explore various functions and methods to accurately extract these values, addressing issues related to imaginary components in functions and the limitations of certain Mathematica commands.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant inquires about the possibility of obtaining exact maximum and minimum y-axis values from a 2D plot in Mathematica, expressing frustration with the Maximize function due to perceived imaginary parts in their function.
  • Another participant suggests using the Re function to eliminate imaginary parts and recommends FindMaximum and FindMinimum functions, noting potential issues with the Plot function and the need to specify x_min and x_max options.
  • A participant clarifies that their function already contains no imaginary parts, yet the Maximize function still indicates the presence of imaginary components when attempting to use the real part of the function.
  • One participant proposes the use of the Algebra`ReIm` package, suggesting it may contain useful functions like RealValued to assist in the problem.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to extract maximum and minimum values, with multiple competing methods and suggestions presented. The discussion remains unresolved regarding the effectiveness of the proposed solutions.

Contextual Notes

Participants express uncertainty about the behavior of certain Mathematica functions and their applicability to the specific problem at hand. There are mentions of version differences in Mathematica that may affect the availability of certain functions.

natski
Messages
262
Reaction score
2
I wanted to know whether it was possible for Mathematica to give you an exact read out of the maximum and minimum y-axis values on a 2D plot?

I have tried Maximize function but it seems to think there are imaginery parts in my function (which there are not or how would it plot the function in the first place) and so refuses to work out the maximum. Even if I try and Maximise the real part of my function it doesn't work.

What I'm looking for is a way to plot the graph and then simply read off the max and min values with speed and accuracy and perhaps even form another plot of contrast (max-min) vs another variable in the formula.

Thanks
Natski
 
Physics news on Phys.org
It might help us you tell us what your function is, if for whatever reason you can't than I can only give you some general advice.

First you could try something like:
Code:
Re[your_function]

This should get read of the imaginery parts.

Secondly it might be a good idea to use the FindMaximum and FindMinimum functions (the FindMaximum is new in version 5.0 so if you have an older version perhaps FindMinimum[-your_function] would be a good alternative) with the x_min,x_max options of your Plot (something like this:
Code:
FindMinimum[f, {x,x_0 ,x_min , x_max}]
). I however don't remember if this function returns one or more minimums (maximums) so you might think about using other mathods such as deriveing the function if you only get one minimum when there are obvieusly more. As for finding the max and min from a graph I think it's hard to do an acctually not a good idea in the first place becouse the Plot function isn't meant to be used in such a way and could in some cases also produce errors (becouse of the PlotPoints option ).

If nothing helps try posting agein and explain the problem in more detail or try finding help at:

http://www.wolfram.com/
 
Last edited:
The function is several pages long and repeatedly has parts like:
(1.3+0.0i)sin(...)

So there are already no imaginery parts. However, if I take the real part of my function, the same expression is produced, as in 0.0i. So when I try and use maximize function, it tells me there are imaginery parts, even though I am using the specific Real part!

Natski
 
Have you thought about using the <<Algebra`ReIm` package? There are some things there that you might find useful (perhaps RealValued).
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 2 ·
Replies
2
Views
25K
  • · Replies 1 ·
Replies
1
Views
2K