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

Unable to find the correct minima

Sunny
5-Regular Member

Unable to find the correct minima

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!

Sunny_0-1626954748719.png

 

 

Many thanks

S

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby IV
(To:Sunny)

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.

Werner_E_0-1626989872766.png

 

View solution in original post

6 REPLIES 6
LucMeekes
23-Emerald I
(To:Sunny)

Apparently Minimize doesn't require a guess value...

You may need an extra constraint to force Minimize to find another than the first minimum:

LucMeekes_0-1626955730658.png

 

Success!
Luc

 

Sunny
5-Regular Member
(To:LucMeekes)

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

Werner_E
24-Ruby IV
(To:Sunny)


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.

Sunny
5-Regular Member
(To:Werner_E)

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

Werner_E
24-Ruby IV
(To:Sunny)

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.

Werner_E_0-1626989872766.png

 

View solution in original post

Sunny
5-Regular Member
(To:Werner_E)

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.

 

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."