Find Max & Min Y-Axis Values on 2D Plots with Mathematica

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

Discussion Overview

The discussion revolves around using Mathematica to determine the maximum and minimum y-axis values on 2D plots. Participants explore various functions and methods for achieving this, as well as addressing related questions about output management in Mathematica.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • Natski inquires about 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 the function.
  • Warren suggests that the Maximize function should work and requests the specific function Natski is using.
  • Natski clarifies that they cannot provide the function but mentions that FindMaximum gives a good numerical estimate.
  • Natski raises a separate issue about hiding lengthy calculation outputs in Mathematica.
  • Another participant suggests using the Short function to limit output visibility and mentions the use of := instead of = to avoid displaying results.
  • Fred proposes using a semicolon at the end of a statement to hide output, which Natski acknowledges as helpful.
  • Natski seeks advice on creating plain text messages in Mathematica, initially struggling with Print and other functions.
  • Natski later suggests that Print["text here"] may be the solution for displaying text messages.
  • Another participant recommends the ToString function for converting expressions to strings.
  • Natski expresses a desire to print progress messages during a lengthy calculation and asks if it's possible to replace previous messages with new ones automatically.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the effectiveness of the Maximize function, as Natski believes it fails due to imaginary parts, while Warren asserts it should work. The discussion about hiding outputs and printing messages shows some agreement on methods, but no definitive solutions are established.

Contextual Notes

There are limitations regarding the specific function Natski is using, which affects the discussion on the Maximize function. Additionally, the methods for hiding outputs and printing messages may depend on the context of the calculations being performed.

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.

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.

Thanks
Natski
 
Physics news on Phys.org
Maximize should work. Perhaps you should provide us with the function you're trying to work with.

- Warren
 
Sorry I can't supply you with the function, but suffice to know that maximize does not work because it thinks the function has imaginery parts depsite the fact I implicity select Maximize[Re[f],x]. However, FindMaximum does seem to give a good numerical estimate.

As an aside on forming 'programs' in Mathematica, I want to hide a calculation output since it's several pages long and completely useless to see the result anyway. Is there a way of 'hiding' the result of a calculation from view?
 
I think there are 2 things here.

One if the output is too long you could use the Short function(something like:
Code:
Short[your_function,number_of_lines_you_want_to_see]
)

or maybe the Shallow function (don't really remember how that works).

If you don't whant to se the out put it might be good to use := instead of =
As for really hiding the output I never heard of a way aldo that doesn't mean there isn't one.
 
natski said:
As an aside on forming 'programs' in Mathematica, I want to hide a calculation output since it's several pages long and completely useless to see the result anyway. Is there a way of 'hiding' the result of a calculation from view?
IIRC, to hide the output, simply put a semi colon at the end of the statement.
 
Excellent, thank-you very much Fred. I don't suppose I could trouble you also on how you create a text message? I've tried Print, StylePrint, Message,etc but they all seem to want to print expressions rather than just plain text.

Natski
 
I actually think I may have stumbled across the solution myself, I think it's Print["text here"]
 
Maybe you could try the ToString function (checkout: http://documents.wolfram.com/v4/RefGuide/ToString.html" for more information).
 
Last edited by a moderator:
I think the Print function works fine for my purposes. I'm have 10 parts to a lengthy calculation and I simply want to print out '10% complete', etc at each part of the calculation. What would be really useful is if when '20% Complete' message appears it automatically replaces the '10% Complete' message. Is that possible?

Natski
 

Similar threads

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