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 tried to calculate minimal value of the complex argument of a Transfer function through minimize function inside a resolution bloc. Mathcad indicates that there are no solution found, try to modified initial values or TOL or CTOL, but it does not help.
I think that Mathcad does not find solution because the argument does not change, but manual calculation gives different values according constraints.
Could you please help me to understand why the Mathcad do not understand the constraints?
Thanks
Christophe
PS : Using Pime 4.0
Solved! Go to Solution.
Hi Christophe,
Calculations are 3.3x10^4 to 4.653x10^-9 this is a wide spread and lower than the TOL or tolerance setting..
TOL is set at 10^-3 in your sheet and this cannot handle the spread of data you need.
Set the value of TOL to 10^-7
Calculations will then be as expected
My files are Prime 9 so cannot be opened in Prime 7. Your last posted sheet works when you reset the TOL value.
Cheers
Terry
Hi Christophe
I am using Prime 9 so cannot save the file for you. Will use pictures. Enclosed Prime 9 file.
Prime works from left to right, top to bottom so definitions of variables need to be to left or above where they are used.
In the minimize function the first argument is a function name only. arg function needs to be in definition of that function not in minimize function.
To be used as a constraint f must occur in the function so it varies in the solve block.
Cheers
Terry
Hi Terry,
Thank you very much to your quick answer. It help me to understand severals points :
- how to fill the resolution block
- why using function instead of the arg function.
However, my need is the minimum argument value. In my case, the result is false because a constraint is not observed (Cd2).
From my file, could you explain me why this constraint is not respected ?
Thanks
PS : Do you know if I can install on my PC prime 7 (last revision available in my company that could help me to open your file), prime 4 (revision installed on all co-worker) and mathcad 15 (for all old project) ?
Christophe
Hi Christophe,
Calculations are 3.3x10^4 to 4.653x10^-9 this is a wide spread and lower than the TOL or tolerance setting..
TOL is set at 10^-3 in your sheet and this cannot handle the spread of data you need.
Set the value of TOL to 10^-7
Calculations will then be as expected
My files are Prime 9 so cannot be opened in Prime 7. Your last posted sheet works when you reset the TOL value.
Cheers
Terry
Hi Terry,
Thank you,
It's a good news before week end.
Too bad for format file which change on each revision.
Cheers
Christophe
Hi Terry,
I replied too fast on friday, I was too happy to have a solution or too hurried to start week end...
But this morning I changed TOL and CTOL without change.
Could you explain please ?
Hi,
Took your new file and it works for me. Try pressing the Calculate button on the menu Calculation | Controls | Calculate to refresh the worksheet
Cheers
Terry
I tried the sheet in Prime 4,5,6 and 9 and experienced different behaviour in 4 & 5 compared to 6 & 9.
Changing TOL and CTOL does not have any effect in either version:
Older versions seem to not fully respect the constraints (probably because of the low values) which obviously was fixed in version 6 and above.
EDIT: @Christophe.fr
You can "weight" the constraints by multiplying the values with a large factor
This seems to have the desired effect in Prime 4, too:
You can play around and do similar (maybe with different factors) with the other constraints as well.
BTW, your constraint
does not have any effect at all - DeltaT will be 45 throughout as you had defined it.
What did you think this constraint would be good for?
Hi Werner_E,
Thank you very much for your quick answer.
I will install version between 7 and 9.
Have you got an recommendation for steady version ?
Christophe
@Christophe.fr wrote:
Hi Werner_E,
Thank you very much for your quick answer.
I will install version between 7 and 9.
Have you got an recommendation for steady version ?
Christophe
My preference? Sure Mathcad 15 (because I have no access to Mathcad 11) 🙂
If thats not an option (MC15 is not sold or supported anymore by PTC) if you/your company has a current subscription, the lastest Prime seems to be as stable as the older versions and probably has the one or other bug fixed.
You can install various Prime versions side by side - you just may lose the ability to convert legacy sheets to older Prime versions.
Until then in Prime 4 the workaround with weighting the constraints by multiplying the values so they are in similar numeric ranges may do the job as well.
Hi Christophe, Werner
I am suspicious of the minimize algorithm is not resolving correctly.
Two corners of the solution that meets the constraints as shown in the worksheet are at a lower value than the found solution.
Cheers
Terry
Minimize is also dependent on the guess values - it won't be able to find the absolute minimum, just a local one.
So changing the guesses might give a better result. The solve block seems to be VERY sensible wrt the guess values and tends to fail if a guess is even changed only slightly.
Furthermore "minimize" minimizes the "errors" and here they seems to have changed the way the errors are seen with respect to the constraints when going from Prime 5 to version 6.