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

SOLVED
Highlighted

Find result sometimes has wrong sign

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. Tags (4)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Find result sometimes has wrong sign

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

Re: Find result sometimes has wrong sign

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

Mike

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.

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.

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.

Contact de Hertz — Wikipédia

Re: Find result sometimes has wrong sign

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 ?

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?

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

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.

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.