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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Restrict result to Positive Solutions?

Abdelazeem
6-Contributor

Restrict result to Positive Solutions?

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

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

 

View solution in original post

11 REPLIES 11

As far as I see the results already ARE all positive!

Werner_E_0-1594736404578.png

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.

 

Abdelazeem
6-Contributor
(To:Werner_E)

Firstly thank you indeed for your reply, secendly, I used another example and I attached another one 

this is the new issue

Abdelazeem_0-1594737428017.png

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. ?

Abdelazeem
6-Contributor
(To:Werner_E)

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.

Werner_E_1-1594747893753.png

 

 

Abdelazeem
6-Contributor
(To:Werner_E)

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.

 

Abdelazeem
6-Contributor
(To:Werner_E)

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.

Werner_E_0-1594756979021.png  Werner_E_1-1594757007537.png

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:

Werner_E_2-1594757121007.png

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

Abdelazeem
6-Contributor
(To:Werner_E)

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.

Top Tags