# Contrasts in Mathematica

1. Aug 5, 2006

### natski

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

2. Aug 7, 2006

### LENIN

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 (Text):
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 (Text):
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: Aug 7, 2006
3. Aug 7, 2006

### natski

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

4. Aug 7, 2006

### LENIN

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