Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Contrasts in Mathematica

  1. Aug 5, 2006 #1
    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.

  2. jcsd
  3. Aug 7, 2006 #2
    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):
    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:

    Last edited: Aug 7, 2006
  4. Aug 7, 2006 #3
    The function is several pages long and repeatedly has parts like:

    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!!

  5. Aug 7, 2006 #4
    Have you thought about using the <<Algebra`ReIm` package? There are some things there that you might find useful (perhaps RealValued).
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook