Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
I converted worksheet from 15 to prime having minimize keyword. Giving different result after conversion are there any changes that is required to do in worksheet.
Solved! Go to Solution.
@TR_9781963 wrote:
Yes it gets the result but later when evaluated for x it does not give answer as 15. How to make this work in prime as 15?
Not sure what you mean.
As written above, the minimize function seems to be broken in Prime for some cases where it worked OK in Mathcad.
I added some explanation to my answer above.
It looks that you can't do anything to make minimize work OK in Prime other than reporting the bug/inability to PTC support and hoping for a fix in a future version.
The three workarounds using the root function or the solve blocks work OK, but of course you would have to assign their result to a variable if you want to use it later in your calculations:
BTW, if you use root, find or minerr, you may, but you must not use the absolute value when defining the function f_min.
You may also notice the the result of the root function is even more accurate than the result of minimize in Mathcad 15, where the values at the end do not match up to the displayed accuracy but just to eight decimals:
Actually using minimize is not a good choice for this task anyway (nonetheless its a bug that Prime fails here).
Can you provide de MC15 sheet?
I am not sure why minimize fails in Prime (I am using the current version 9 and can confirm that it does) and returns the guess value unchanged.
Different guess values return different results but not near the one you expect. Also "weighting" the expression you's like to minimize gives a result nearer the expected one, but this sure should not be necessary
I also tried to decrease the system variables TOL and CTOL, but without success.
PTC sure has changed quite some algorithms and this may be a limitation or bug and you may consider reporting it to PTC support.
Solving with the root function
or with a solve block with "find"
return the expected result without problems as does a solve block with "minerr"
Addendum: When you search this forum you will find quite a lot of threads dealing with problems in Prime with minimize and maximize. Some problems are due to user errors, but some are due to the changed algorithm. Prime is using the KNITRO solver while Mathcad was using the good old Conjugate Gradient algorithm, similar to Levenberg-Marquardt which as I guess is still used in Prime for minerr(). You see the difference 😉 In Mathcad you could also switch algorithms using the right-click context menu, but usually the default algorithm was a good choice anyway.
Many problems with minimize in Prime also stem from the usage of units, because Prime internally uses the default units (Pa in your case) and so minimize runs into a scaling problem. In your case this seems only be part of the problem (I tried it unitless). In your case I guess that the absolute value used in the function is also part of the problem as this results in a non-continuous derivative at the position you are looking for.
Anyway - in case of your example the old algorithm used in Mathcad sure is much superior over the new algorithm in Prime and maybe PTC should know about. However, I cannot say whether they are actually interested in it.
Yes it gets the result but later when evaluated for x it does not give answer as 15. How to make this work in prime as 15?
@TR_9781963 wrote:
Yes it gets the result but later when evaluated for x it does not give answer as 15. How to make this work in prime as 15?
Not sure what you mean.
As written above, the minimize function seems to be broken in Prime for some cases where it worked OK in Mathcad.
I added some explanation to my answer above.
It looks that you can't do anything to make minimize work OK in Prime other than reporting the bug/inability to PTC support and hoping for a fix in a future version.
The three workarounds using the root function or the solve blocks work OK, but of course you would have to assign their result to a variable if you want to use it later in your calculations:
BTW, if you use root, find or minerr, you may, but you must not use the absolute value when defining the function f_min.
You may also notice the the result of the root function is even more accurate than the result of minimize in Mathcad 15, where the values at the end do not match up to the displayed accuracy but just to eight decimals:
Actually using minimize is not a good choice for this task anyway (nonetheless its a bug that Prime fails here).