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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Find a minimum of the function

TT_11056782
6-Contributor

Find a minimum of the function

TT_11056782_0-1715554024434.png

 

Subject to:

TT_11056782_1-1715554024434.png

 

Minimum lies in a range [0;2*π]

 

Write it for MathCad15 please.

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Looks like homework, doesn't it?

Where are your attempts in MC15?

What have you already tried?

 

BTW, the condition f(x)>= sine is somewhat strange.
First task should be to make a plot (either by hand or via Mathcad) which shows that you are just looking for the minimum of the part of the curve plotted thick red. Fortunately this minimum (green dot) can be found easily using the zero of the first derivative ...

Werner_E_0-1715567331610.png

 

The name "arctg" is quite outdated and should no longer be used according to the current standard (ISO 80000-2)

 

Werner_E_1-1715566869933.png

In Mathcad this function is called "atan".

 

View solution in original post

11 REPLIES 11

Looks like homework, doesn't it?

Where are your attempts in MC15?

What have you already tried?

 

BTW, the condition f(x)>= sine is somewhat strange.
First task should be to make a plot (either by hand or via Mathcad) which shows that you are just looking for the minimum of the part of the curve plotted thick red. Fortunately this minimum (green dot) can be found easily using the zero of the first derivative ...

Werner_E_0-1715567331610.png

 

The name "arctg" is quite outdated and should no longer be used according to the current standard (ISO 80000-2)

 

Werner_E_1-1715566869933.png

In Mathcad this function is called "atan".

 

TT_11056782
6-Contributor
(To:Werner_E)

And how do you find the solution of it?


@TT_11056782 wrote:

And how do you find the solution of it?


As already written - define the first derivative of the function, set it to zero and solve for x. The plot suggests that you have to look in the range from pi to 2*pi.

Fortunately the position you arrive at is within the intervals of interest. Otherwise you would have to examine the endpoints of the curve fragments of interest.

 

Give it a try! Set up a worksheet, define the function f, define its derivative and use the "root" function or a solve block with "find" to find the solution in the range (pi; 2 pi). Don't use the symbolic "solve" as it would not be able to find a solution.

If you experience a problem while working with Mathcad, come back here, ask your question and don't forget to attach your worksheet.

TT_11056782
6-Contributor
(To:Werner_E)

Is it right? I'm sorry if everything is a mess here.

What I meant was that you may rather use the numeric solve methods provided by Mathcad out of the box. These are solve block with "find" and the "root" function.

The root function can be used in two flavors, by providing a guess value or by providing a range. Here an example for the latter (I use a range from pi to 2 pi because the plot showed that the solution is somewhere in this interval).

Werner_E_0-1716471294054.png

 

If you don't want to use Mathcads own numeric iteration methods but rather want to program it yourself, you sure have to look up and study the chapter on programming in the help.

You can't type the program statements in separate regions but rather you have to enter them in the so called "programming operator" as described in more detail in the help

Werner_E_1-1716471541706.png

Furthermore there is only a limited set of programming operators

Werner_E_2-1716471649346.png

Mathcads does not know an "else" (it uses "otherwise" instead) and there also is no "endwhile".

You can simply type in the programming operators but rather must pick them from the programming toolbar (Menu: View-Toolbars-Programming) or use the appropriate keyboard shortcut.

Werner_E_3-1716471862868.png

Its well worth studying this help section and also to follow the link to "Tutorial - Programming" at the end of that section.

 

Here is what your program could look like (I used a much smaller value for eps to enhance accuracy):

Werner_E_4-1716472302321.png

As you see its not necessary to zip or rar the Mathcad worksheet - you can attach them directly.

 

 

 

 

 

 

TT_11056782
6-Contributor
(To:Werner_E)

Thank you!

and how does the constraint affects the function here?


@TT_11056782 wrote:

Thank you!

and how does the constraint affects the function here?


Which constraint?

And what do you mean by "here"? My approach using "root" or the program I posted, base on your attempt?

 

Bit ignore the constraint that f(x) should be larger than the sine function given because in the plot it can be seen that this constraint is fulfilled anyway.

My root-approach looks for a solution in the range pi to 2 pi.

The program based on your attempt start with a guess value of pi and so also finds the desired solution.

TT_11056782
6-Contributor
(To:Werner_E)

I mean the whole question since it's subjected to this

TT_11056782_0-1716555769515.png

 

 


@TT_11056782 wrote:

I mean the whole question since it's subjected to this

TT_11056782_0-1716555769515.png

 


I already edited my answer above.

After making the plot and seeing that this constrained is fulfilled anyway by the minimum we get when we set the first derivative to zero, its not further considered.

To be on the safe side you can, after finding the x.min value, make a check to see if this constrained is fulfilled.

TT_11056782
6-Contributor
(To:Werner_E)

Okay. Thank you!

Hello @TT_11056782

 

It looks like you have a response from a community member. If it helped you solve your question please mark the reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Community Moderation Team.

Top Tags