Skip to main content
7-Bedrock
July 14, 2020
Solved

Restrict result to Positive Solutions?

  • July 14, 2020
  • 1 reply
  • 4697 views

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

 

Best answer by Werner_E

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.

 

1 reply

25-Diamond I
July 14, 2020

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.

 

7-Bedrock
July 14, 2020

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 

25-Diamond I
July 14, 2020

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