Find a minimum of the function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Find a minimum of the function
Subject to:
Minimum lies in a range [0;2*π]
Write it for MathCad15 please.
Thank you
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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 ...
The name "arctg" is quite outdated and should no longer be used according to the current standard (ISO 80000-2)
In Mathcad this function is called "atan".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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 ...
The name "arctg" is quite outdated and should no longer be used according to the current standard (ISO 80000-2)
In Mathcad this function is called "atan".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
And how do you find the solution of it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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).
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
Furthermore there is only a limited set of programming operators
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.
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):
As you see its not necessary to zip or rar the Mathcad worksheet - you can attach them directly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you!
and how does the constraint affects the function here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I mean the whole question since it's subjected to this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@TT_11056782 wrote:
I mean the whole question since it's subjected to this
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Okay. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
