Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily.
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Jul 14, 2020
07:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
07:20 AM

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

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Jul 14, 2020
03:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
03:45 PM

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.

11 REPLIES 11

Jul 14, 2020
10:25 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
10:25 AM

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.

Jul 14, 2020
10:37 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
10:37 AM

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

Jul 14, 2020
10:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
10:50 AM

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

Jul 14, 2020
11:34 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
11:34 AM

I am sorry about that , I added all parameters >0 but still problem exist

as in the attachment file

Jul 14, 2020
01:32 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
01:32 PM

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.

Jul 14, 2020
03:20 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
03:20 PM

really thank you for your help, please could you send the mathcade file in the attachment with me

Jul 14, 2020
03:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
03:45 PM

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.

Jul 14, 2020
03:56 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
03:56 PM

Thank you for you fast help and your easy discussion

According to your advice ,the issue is solved now

Jul 14, 2020
04:07 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
04:07 PM

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

Jul 14, 2020
04:19 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
04:19 PM

really I appreciate your help, you are very helpful

Jul 14, 2020
04:24 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 14, 2020
04:24 PM

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.