Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Dear All
For the given attachment file how I can restrict the output results of minerr function to get positive only, as in my problem I need all the parameter that is calculated with minerr to be positive
Regards
Abdelazeem
Solved! Go to Solution.
Sorry, I didn't save the file.
But you just need to change your guess of C:=0.2 to, lets say, C:=2 and you will get the positive results.
You may experiment with different values.
The reason I turned the solve block into a function of the guess for C was because I wanted to be able to show the effects of different guess values side by side without the need to make multiple screen shots.
If you want to do this, you just have to modify the last line in the solve block to read f(C):=minerr(...) and delete the = after the minerr command - you can see it in the screenshot I posted.
Of course you also have to delete the guess C:=0.2 on top of the solve block.
As far as I see the results already ARE all positive!
But you always can add constraints like A>0, etc. in your solve block. A negative A is taken as an error and Prime will try to minimize the overall errors. Constraints are soft constraints and you can weight them by multiplication. A negative A=-1 ist maybe considered a small error but if your constraint reads 10^5*A>0 its taken as a far larger error and Prime will try to make it smaller.
Firstly thank you indeed for your reply, secendly, I used another example and I attached another one
this is the new issue
I attached the file
I attached the file
But its the same file as in your first post. Still only positive results.
Have you already tried adding constraints like A>0, etc. ?
I am sorry about that , I added all parameters >0 but still problem exist
as in the attachment file
Your system seems to be quite unstable and is VERY sensitive wrt the guess values.
I played around with the guesses and found that especially changing the guess for C has a great impact an the result. Some values for C like 1.41, 2, 5 gives you positive results but those results are quite different from each other. You'll have to decide if they are meaningful and trustworthy at all.
To make it easier to compare results for different guess values for C I turned the solve block into a function f(C) depending on the guess value. Thats what you see in the pic below.
really thank you for your help, please could you send the mathcade file in the attachment with me
Sorry, I didn't save the file.
But you just need to change your guess of C:=0.2 to, lets say, C:=2 and you will get the positive results.
You may experiment with different values.
The reason I turned the solve block into a function of the guess for C was because I wanted to be able to show the effects of different guess values side by side without the need to make multiple screen shots.
If you want to do this, you just have to modify the last line in the solve block to read f(C):=minerr(...) and delete the = after the minerr command - you can see it in the screenshot I posted.
Of course you also have to delete the guess C:=0.2 on top of the solve block.
Thank you for you fast help and your easy discussion
According to your advice ,the issue is solved now
I played around with your sheet again and found, that if we weight the constraints A>0 very high by multiplying A with a high number, the solve block delivers a solution with all positive values even with the guess value C:=0.2.
The price is that the other constraints, your four equation, are now weighted much lower and if you check I guess the result is not satisfying:
Ideally all four results should be close to zero!
You may experiment with different guesses and maybe different values for "factor".
Prime6 worksheet attached 😉
The prove
really I appreciate your help, you are very helpful
One last idea: I noticed that you had uses a lot of unnecessary parenthesis in your expression. I deleted most of them, but maybe you'd like to check you equations if all the signs are really correct.