BillyJean
BillyJean

Reputation: 1587

Faster alternative to NSolve

I have an equation, which I am trying to solve using NSolve in Mathematica. Here is how I do it:

T == (0.000242895 E^(-(2.09472*10^11/(5.70068*10^8 + 
            7.76206*10^12 T))))/(1 + 
    0.969073 E^(-(4.18945*10^11/(5.70068*10^8 + 7.76206*10^12 T))) - 
    1.96883 Cos[8.77331*10^6/(2.28027*10^9 + 7.76206*10^12 T)])

NSolve[T == (0.000242895 E^(-(2.09472*10^11/(5.70068*10^8 + 
             7.76206*10^12 T))))/(1 + 
     0.969073 E^(-(4.18945*10^11/(5.70068*10^8 + 7.76206*10^12 T))) - 
     1.96883 Cos[8.77331*10^6/(2.28027*10^9 + 7.76206*10^12 T)])
 , {T}, Reals]

The problem is that it takes a long time (~1min) to find a solution. Is there a faster way to obtain a solution other than using NSolve?

Upvotes: 1

Views: 1037

Answers (1)

KennyColnago
KennyColnago

Reputation: 299

The denominator of your expression goes through zero at approximately T=215. The other solution is T=0. If you want the non-zero solution simply use

FindRoot[denom,{T,T0}]

where T0 is most any positive number. This takes about a millisecond.

Upvotes: 2

Related Questions