Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi,
I am trying to optimize the solution of minimization function depending on the intial guess values. Surprisingly, my solutions are independent of initial guess values even though the function has several local minima. I am attaching the Mathcad 15 worksheet for the refrence. Any help will be highly appreciated!
Many thanks
S
Solved! Go to Solution.
The guess value can influence the outcome of "minimize", but its not always obvious which guess results in which minimum.
Furthermore I have no clue why the vertical displacement (a very tiny one is all thats needed) shown in function g(x) makes that big a difference for the outcome of minimize.
Apparently Minimize doesn't require a guess value...
You may need an extra constraint to force Minimize to find another than the first minimum:
Success!
Luc
Alright! However, what is the way to dynamically optimize the constraint. This is beacuse I would like to find the local minima as a function of theta (region of interest). For example if theta is less than 90 deg the solution should be 0 deg, for theta between 90 deg and 270 deg, solution should be 90 deg and so on. Please not that in this case the constrains are very well discretized but in general it may not be.
Thanks
S
for theta between 90 deg and 270 deg, solution should be 90 deg
You asked for minima! At 90° there is no minimum but a maximum!
BETWEEN 90° and 180° there is no extrema at all, but in the range FROM 90° TO 180° there is a max at 90° and a min at 180°.
How about using the zeros of the first derivative to get the extrema? You may use the "root" function where you can provide a range to search for the zero within. The function values at the endpoints of that range must be of opposite sign, though.
My bad...a typo. I meant minima at 180 deg when input theta is between 90deg and 270 deg.
Indeed, derivative might work in this case. However, I was interested in a more general case with a multivariable function where analytical derivative is cumbersome. A numerical derivate may be an alternative. Then I wondered it should be possible directly with Minimize function (Conjugate gradient or Quasi Newton algorithm).
Thanks
S
The guess value can influence the outcome of "minimize", but its not always obvious which guess results in which minimum.
Furthermore I have no clue why the vertical displacement (a very tiny one is all thats needed) shown in function g(x) makes that big a difference for the outcome of minimize.
Thanks a lot! It is indeed bit strange that a small offset makes a huge difference. However, it solved my problem, so I couldn't bother more now.