Get Help

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

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Find result sometimes has wrong sign

Options

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

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

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
11:57 AM

09-11-2015
11:57 AM

I'm using a Given ... Find solve block in a function.

When I call the function with an argument, sometimes the result has a positive sign, sometimes negative. Mathematically it is correct, but I can't figure out why it's giving sign changes, and I only want positive results.

The seeded guess value is positive. If I seed the guess value to high to try to sneak in to the solution from the high side, the function fails frequently.

I tried adding an inequality inside the solve block (R_guess>0 in) to try to force a positive result. The function fails all the time.

Looking for suggestions to get only a positive result from the Given ... Find function.

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
02:13 PM

09-11-2015
02:13 PM

Change R.guess to 0.01 in

You may also take the absolute value of all results.

Are you aware that R.reduced(R1) simply returns R1 ?

13 REPLIES 13

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
12:08 PM

09-11-2015
12:08 PM

Re: Find result sometimes has wrong sign

Please provide a worksheet as the image does not show all the variables.

Mike

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
01:54 PM

09-11-2015
01:54 PM

Re: Find result sometimes has wrong sign

Andrew Kelly wrote:

I'm using a Given ... Find solve block in a function.

When I call the function with an argument, sometimes the result has a positive sign, sometimes negative. Mathematically it is correct, but I can't figure out why it's giving sign changes, and I only want positive results.

The seeded guess value is positive. If I seed the guess value to high to try to sneak in to the solution from the high side, the function fails frequently.

I tried adding an inequality inside the solve block (R_guess>0 in) to try to force a positive result. The function fails all the time.

Looking for suggestions to get only a positive result from the Given ... Find function.

Mike has asked for your sheet. Some of the questions that jump out:

In the first line, what is R2?

In the second line, what is Ereduced?

What value do you have for scriterion?

At first look, a(R,P) is a cube root, so can be negative or positive, your solve block uses a (R,P) squared, so Pmax is forced positive whether R is positive or negative.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
02:05 PM

09-11-2015
02:05 PM

Re: Find result sometimes has wrong sign

Here is the full worksheet. It's an attempt to find the recommended spherical radius for an arbitrary force, such that a specific contact pressure is obtained.

Note: V15 M040.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
02:11 PM

09-11-2015
02:11 PM

Re: Find result sometimes has wrong sign

Hello

These are the formulas for the Hertz contacts, it is the area between two spheres.

The E is young's modulus of each sphere.

See attached in French, but you'll probably find the same thing in English.

Kind regards.

Denis.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
02:13 PM

09-11-2015
02:13 PM

Change R.guess to 0.01 in

You may also take the absolute value of all results.

Are you aware that R.reduced(R1) simply returns R1 ?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
02:23 PM

09-11-2015
02:23 PM

Re: Find result sometimes has wrong sign

Fred Kohlhepp wrote:

At first look, a(R,P) is a cube root, so can be negative or positive, your solve block uses a (R,P) squared, so Pmax is forced positive whether R is positive or negative.

Exactly. That's why I said that the result is mathematically correct, but "wrong" for my needs.

There's a behavior inside the solve block that allows it to choose sometimes the positive result or sometimes the negative result.

Why?

How do I stop it?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
02:32 PM

09-11-2015
02:32 PM

Re: Find result sometimes has wrong sign

Werner Exinger wrote:

Change R.guess to 0.01 in

Can someone explain how/why the seed value affects the results?

I understand the layman's concept that when multiple answers are possible, the seed value should be close to the answer. But what I'm seeing is that it isn't always picking the solution that is closest to the seed value.

R.guess = 0.01 in --> all results are positive

R.guess = 10 in --> results are sometimes positive, sometimes negative

R.guess = 10000 in --> all results are negative

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
02:46 PM

09-11-2015
02:46 PM

Re: Find result sometimes has wrong sign

Attached find an excerpt from Roark that I have used with success. I can find common threads in your sheet.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-11-2015
03:30 PM

09-11-2015
03:30 PM

Re: Find result sometimes has wrong sign

Like most non-linear solvers, the non-linear solver used by Find heads downhill on the error surface until it reaches a minimum, and then stops. Note that downhill on the error surface (i.e. smaller error) does not necessarily mean that the value of the parameter you are solving for is smaller. It does also not necessarily find the closest minimum to the starting point, or the deepest minimum (i.e. it may find a local minimum rather than the global minimum). Once it has found a minimum Find checks the error, and if it is sufficiently close to zero gives the result. This is the only difference to minerr, which simply gives the value(s) of the parameter(s) at the minimum, regardless of how small the error is.

One thing you may do is also pass R.guess as a parameter to the function. That allows you to change the guess value each time you call it. Then you can find a guess value that works for the first force value, and subsequently use the last found radius as the guess for the next force value.

Top Tags