LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Solving equation with cosh and coth

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

0 Kudos
Message 1 of 7
(3,312 Views)

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:

 

ForumRootFunction.png

 

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.

 

RootUI.PNG

 

Bracket the root with the cursors and push Find Root.  I get 3.3, and not 2.3.

Download All
Message 2 of 7
(3,282 Views)

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.

0 Kudos
Message 3 of 7
(3,256 Views)

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

 

 

0 Kudos
Message 4 of 7
(3,232 Views)

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 😞

0 Kudos
Message 5 of 7
(3,214 Views)

 


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

 

RootFinderUI2.PNG

0 Kudos
Message 6 of 7
(3,188 Views)

I don't understand, I opened it on3 different computers and I here the program on't find a solution 😞

0 Kudos
Message 7 of 7
(3,169 Views)