04-05-2011 06:11 AM
Hello everybody!
I have been trying for days to find a way to solve this equation.
y = 2*(1-cot(X1))*(cosh(X1)-cosh(X1/(2*Bi)+Theta/2))+X1/((2*Bi)*exp(-X1/(2*Bi)+Theta/2))+(1-cot(X1)/(2*Bi))*X1*sinh(X1)
and in the Front panel I want to change the Bi and Theta: The equation should get the anwser 2,3 with the input Bi = 0.43 and is theta = -16.9
I'have tryed it with the Newton Raphson method but I always get the NaN error.
I would be very gradefull if somebody coul help me.
Thanks in advance
04-05-2011 02:01 PM - edited 04-05-2011 02:05 PM
First of all repeat after me: "Thou shalt not use Newton-Raphson for 1D root finding with numerical derivatives!"
Moving on, the next issue is that I assume that Theta=-16.9 is in degrees, the LV functions take radians.
With those assumptions I generated some G code for your function:
Seemed like a good excuse to use my MathToG software. Next I plugged this function into my interactive Root finder which uses Ridder's method.
Bracket the root with the cursors and push Find Root. I get 3.3, and not 2.3.
04-06-2011 10:17 AM
I shalt not use Newton-Raphson for 1D root finding with numerical derivatives 🙂 Thank you very very much Darin!! But is still got a problem, Now, we have to solve the same equation, but now the cot is replaced by coth, so its like y = 2*(1-coth(x))*(cosh(x)-cosh(x/(2*Bi)+ (Theta)/2))+x/((2*Bi)*exp(-(x/(2*Bi)+ (Theta)/2)))+(1-coth(x)/(2*Bi))*x*sinh(x). Also the Theta is a dimensionless factor. I adjusted your model and i got NaN as awnser :(. I solved the eqution with matlab and maple, and ik got a solution of x = 2.5451437638625637590284940922858.
04-06-2011 01:33 PM
Looks like I introduced a small error, should have copied and pasted. If the top Add is changed to subtract, all seems good, and no need to mess with theta. Try this, fixed bug and changed cot(x) to coth(x).
04-07-2011 07:18 AM
Indeed, the formula is now correct. When is give in 2,54 as x-value I get 0 as value of y. But is still can't find the roots using the itterativee root finder, it gives NaN 😞
04-07-2011 05:01 PM
@Mrcannibal wrote:
Indeed, the formula is now correct. When is give in 2,54 as x-value I get 0 as value of y. But is still can't find the roots using the itterativee root finder, it gives NaN 😞
I know it works because I wrote tested it.
04-12-2011 04:22 AM
I don't understand, I opened it on3 different computers and I here the program on't find a solution 😞