Skip to main content
1-Visitor
October 2, 2018
Solved

min and max of a function

  • October 2, 2018
  • 5 replies
  • 32676 views

Good afternoon.

I'd like to find the MIN and MAX of a function. Doing MINIMIZE or MINIMIZE I have the error that "the variable is undefined".

Doing the derivate it does not work.

How can I do?

If you want I can attach the code.

 

This topic has been closed for replies.
Best answer by LucMeekes

Yes, great! But there's more than one function in there.

Assuming you want the extremes of gamma.G1, here goes:

LM_20181003_Extremes.png

 

LM_20181003_Extremes1.png

Note that I'm just inserting pictures, because I don't have a full Prime. (I'm limited to Express, which means no programs, no symbolics, no means and other silly limitations.)

So you will have to recreate this yourself in Prime 5 (which is a good exercise by the way!).

 

Success!
Luc

 

P.S. I noticed that you have a VERY poor display of numeric values set in your sheet. All numbers are displayed with no fractional parts. This can be very confusing. Take care!

 

5 replies

23-Emerald IV
October 2, 2018

To find the min and max of a function you can use several methods. However the functions Minimize() and Maximize() have a different purpose (I suggest, you look them up in the help).

 

Assuming you have a mathematical description of the function, the best way is to differentiate that function, find the zero's of the derivative andf check for each of those if it's a minimum or a maximum etc.. You've probably learnt that in school. Note that Mathcad will allow you to differentiate symbolically or numerically.

 

Another way is to step your running value from start to end of its domain and calculate each corresponding function value and determine whether it's the lowest or highest value you've encountered. By the end you should have the two extremes. This method is less accurate, of course: you might miss a narrow peak or valley.

 

Since you did not provide a worksheet, no help with your specific function is possible.

 

Success!
Luc

 

 

18-Opal
October 2, 2018

Attach your file. Can't do mathcad with pictures.

ttokoro
21-Topaz I
21-Topaz I
October 3, 2018

From Mathcad help page

T.Tokoro

t.t.
25-Diamond I
October 3, 2018

Its hard to work with pictures so you sure should attach your worksheet if possible.

 

One suggestion:

1) below the plot write δv:=δ= (the last evaluation = is important as is turns the range into a vector).

2) Change the "maximize" in the expression below to "max" and the "δ" to "δv"

 

Did this do the trick?

If not, you may have to vectorize the function call  "P.c_all_max(δv)".
Thats the operation which is shown as an arrow over the expression.

1-Visitor
October 3, 2018

Hi guys.

I'm attaching the Mathcad file.

I'd like to find the MAX and MIN of the function 

Let me know if you can.

Andrea

23-Emerald IV
October 3, 2018

Please indicate of which function you would like to find the extremes.

(Note: you cannot past a picture, you have to use the 'Photos' icon above the edit window to insert a picture in your post.)

 

Success!
Luc

1-Visitor
October 3, 2018

Luc. 

I have attached the mathcad file.

Andrea