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
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.
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 ?
Please provide a worksheet as the image does not show all the variables.
Mike
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.
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.
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?
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.
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 ?
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
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.
As Richard already explained, thats the behavior of the numeric algorithm used. Hard to guess which guess would yield which result. I am not sure why the constraint R.guess does not work, but it seems that when the algorithm was heading downhill, as Richard had put, and its trapped in a valley with all negative values, it wont climb up again to run down the neighbor valley. BTW, if you right click at the command "find" you get the option to change the algorithm used. The other two non-linear algorithms offered have options to play with, but they will not yield any solutions at all. LM usually is a good (automatic) choice for the algorithm.
I am not sure if your variable R.2 which is set to infinity has negative effects, too. But I would tend to avoid having a variable set to infinity. As stated above R.reduced will simply return the argument R1, but I guess you intend use your sheet to play around with different values for R.2, too.
But the equations in use in your solve block can easily solved symbolically, too, so you don't have to cope with the solve block problems at all:
If we rewrite the symbolic the function definition by hand to use the reciprocal value of R.2, even the value infiinity is accepted:
Great examples. Thanks.
Maybe you like that way to define your radius function even more
Excellent work by by you and Richard.
Attached find an excerpt from Roark that I have used with success. I can find common threads in your sheet.