Extremum Seeking in Mathcad

Extremum of function in Mathcad

Extremum seeking in Mathcad is performed with two functions:

- Minimize (y,x) – to seek the value of х, identical to the local minimum of function у);

Maximize (y,x) - to seek the value of х, identical to the local maximum of function у);

As  у) can have a few local extremums, while functions  Minimize (y,x) and Maximize (y,x) allow us to find only one single value, it is complimentary in Mathcad to assign the initial approximation of variable х. As a result the programme seeks for the value of the extremum of function  y(x),  the proximal to the assigned initial approximation of variable  х.

While seeking for extremums by writing the inequality a certain range space can be assigned and seeking for extremum can be performed within its boundaries. The preceding procedure in this case is the input of the key word “given”. The programme listing shows the example of extremum of function seeking in Mathcad.

Unfortunately, the function does not always give the correct results. For instance, the listing example shows that when maximum seeking in the range of -2<x<0 is performed, the function shows the result of –0.452. At the same time, another example and it shows another result:

Экстремумы функций в Мathcad

It is shown both in the function graph and in the listing

That is why in it possible to come to the conclusion that the results of functions Minimize and Maximize in Mathcad can depend on the antecedent calculations. Therefore, one has to be cautious while implementing these functions, verifying the results with function graphs.

Extremum of function in Mathcad

If the value of the goniometric function argument (sin, cos, tg) is given in degree form, then it is compulsory in Mathcad to turn it into radian form. It can be done with function deg.

Examples:

Экстремумы функций в Мathcad

 

 

 

Экстремумы функций в Мathcad

While performing calculations in Mathcad it is important to keep in mind the following peculiarities. Calculations in Mathcad are performed from left to right and top-down. This succession should be taken into account while entering the problem algorithm, which should be carefully observed so as to avoid mistakes and incorrect results.