cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Global Maximum/Minimum and tangent

SimonKohn
1-Visitor

Global Maximum/Minimum and tangent

Hello together,

hopefully the last question concerning my diplome thesis:

Does Mathcad 15 have a function to find the (Global) Maximum/Minimum of an analytic function, like f(x) = x^3 + x^2 - 4 . I need the x-Value and the y - Value of the Maximum/Minimum.

And additionally, I need to find the tangent from the point of origin to an analytic function, like g(x) = x^2 + 4x -10 . So I need to point at which the tangent touches the given function.

Thanks a lot,

Simon

ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:SimonKohn)

Swap the two sides of the definition.

View solution in original post

22 REPLIES 22

Is there any chance you could upload a worksheet?

You are likely to attract more interest if a worksheet of the problem is included.

Mike

StuartBruff
23-Emerald III
(To:SimonKohn)

Simon Kohn wrote:

Hello together,

hopefully the last question concerning my diplome thesis:

Does Mathcad 15 have a function to find the (Global) Maximum/Minimum of an analytic function, like f(x) = x^3 + x^2 - 4 . I need the x-Value and the y - Value of the Maximum/Minimum.

And additionally, I need to find the tangent from the point of origin to an analytic function, like g(x) = x^2 + 4x -10 . So I need to point at which the tangent touches the given function.

Thanks a lot,

Simon

It has symbolic differentiation.

Stuart

RichardJ
19-Tanzanite
(To:SimonKohn)

Does Mathcad 15 have a function to find the (Global) Maximum/Minimum of an analytic function, like f(x) = x^3 + x^2 - 4 . I need the x-Value and the y - Value of the Maximum/Minimum.

You need to be more specific about what you are trying to achieve, Mathcad has functions that will find maxima or minima of functions (including functions of more than one variable) within a given interval. It has a function that will give you all the roots of a polynomial. For many functions you could find the global maxima and minima by using symbolic differentiation. That is not going to work for every function though.

And additionally, I need to find the tangent from the point of origin to an analytic function, like g(x) = x^2 + 4x -10 . So I need to point at which the tangent touches the given function.

There is no built in function to do this, but one could be written. But there may be no such tangent (for example a circle that encloses the origin), there may be more than one such tangent (for example a circle that does not enclose the origin), or there may even be an infinite number of such tangents (e.g the sin function). So, again, you need to be more specific.

Simon Kohn wrote:

Does Mathcad 15 have a function to find the (Global) Maximum/Minimum of an analytic function

You can work with user function - with genetic algorithm for example:

http://twtmas.mpei.ac.ru/mas/Worksheets/Minimum.mcd

Here is a very simple example. I get the error message that P is not defined. Perhaps someone could post the corrected worksheet.

Thanks a lot

RichardJ
19-Tanzanite
(To:SimonKohn)

A numeric solution using a non-linear solver always requires a guess value.

Thanks. Is it possible to determine a maximum/minimum without guessing?

Is there an analytic method in Mathcad?

by the way, which quality does the guess value need?

RichardJ
19-Tanzanite
(To:SimonKohn)

Thanks. Is it possible to determine a maximum/minimum without guessing?

Is there an analytic method in Mathcad?

Numerically, in general no. You are asking to solve the equation d/dx(F(x))=0, and if that equaiton is non-linear then a numeric solver can only solve it iteratively. So it needs a starting guess. The attached worksheet will find the critical points of an abitrary function using the symbolic solver to solve the above equation, so it does not need guesses. Note however that "arbirtary" does not mean "any". There is no guarantee that the symbolic solver will find a solution.

RichardJ
19-Tanzanite
(To:RichardJ)

An update. That function was adapted (not by me) from one written long ago in MC11 (by me). Unfortunately, the rewrite introduced a bug. This one is correct.

Guys, still having huge problems with more than one variable.

Please see the file.

a) If I use a guess value for x which is not equal to zero, f (x,4) will be wrong.

b) Why the graph for f(x,4) cannot be displayed?

c) Q cannot be determined 😞

wayne
12-Amethyst
(To:SimonKohn)

a) Plotting f(x,4) - does not plot because you perviously assigned a value to x; So Mathcad cannot now use x as a range variable for plotting. Change the variable, I used xx in the attached. You could still plot against x, but you must make x vector of values.

b) Minimize(f,x,y) expects variables x and y, not constants. you can change to g(x)=f(x,4) and then Minimize(g,x).

(Richard, that is a nice function, thanks)

SimonKohn
1-Visitor
(To:wayne)

Thanks Wanye, is there any chance to minimize f(x,4) ? See the file in my posting above.

wayne
12-Amethyst
(To:SimonKohn)

Simon,

See attached

One way, let g(x)=f(x,4) , minimize(g,x)

More General Way, use a Solve Block: Given y=4, minimize(f,x,y)

SimonKohn
1-Visitor
(To:wayne)

Wayne,

another big thank you to you.

Please have a short look on my worksheet included.

Is it correct? Any logical faults?

Why R does not work?

wayne
12-Amethyst
(To:SimonKohn)

Simon

In the function for R, you inadvertenlty put hr instead of h.

But rest looks OK.

SimonKohn
1-Visitor
(To:wayne)

Wayne,

I couldn't find what you mean by "In the function for R, you inadvertenlty put hr instead of h."

Perhaps you could post a corrected version.

.... or it's just too late for me, should get some sleep

wayne
12-Amethyst
(To:SimonKohn)

Simon,
see attached, and get some sleep

SimonKohn
1-Visitor
(To:wayne)

Still not possible, perhaps it's my system....

Now one problem during work:

see the file. what is the problem?

StuartBruff
23-Emerald III
(To:SimonKohn)

Simon Kohn wrote:

Still not possible, perhaps it's my system....

Now one problem during work:

see the file. what is the problem?

You can't have constants in the argument list of a function definition (ie, f(x):=... is OK, but f(3):= ... is not OK)

Stuart

RichardJ
19-Tanzanite
(To:SimonKohn)

Swap the two sides of the definition.

Thanks Richard, your hint solved the problem.

Announcements

Top Tags