Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations pierreick on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum values of a function

Status
Not open for further replies.

Guest
How do I get mathcad 5.0 to return a maximum value for a function without having to print out a table of values, looking at them to find the maximum, and typing it into my next equations, the function is a quadratic equation and has a maximum value. Help!
Flowerhopper cjomlo@iland.net
 
Replies continue below

Recommended for you

one way to do it would be to use the max() function. I believe the syntax would be max(my_array)=
but I'm not sitting in front of mathcad right now. (if you'd like to wait until january, I'll get you the answer then)

another way would be to calculate the derivative of the eqn, find the zero points of the derivative, and then figure out (either by looking at the sign of the second derivative or by checking values) which ones are max values and which are mins

 
This is an example using a later version of MathCad I don't know if this works with MathCad 5

example

f(x):= 2+6x-x^2
x:=2
Given
x>0
P:= Maximize(f,x)

"answer" P=3
f(P)=11
 
Neither of those is easy in early versions of Mathcad

The obvious thing to do in this case is to differentiate the quadratic and then test the solutions (bearing in mind that quadratics often go to infinity) to that function.

The other more general alternative is to build a vector of values and then a vector of gradients and then search for points of inflexion.

Getting the index figure for each point of inflexion is /possible/, even in the very earliest version of Mathcad, you need to set up another vector that increments until a point of inflexion is found, I think using either "if" or the totally weird "until". I did this a long time ago and can't remember the details. If you can afford to wait three weeks then I'll look it up in my notes. Cheers

Greg Locock
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor