finding a solver in matlab to solve an equation
2 views (last 30 days)
Show older comments
I have an equation which is shown below:
2^((2*10^6)/x)-((1.5536*10^(-51)*x)/(2.6243*10^(-15)+((3.9810*10^(-21))*x)))=0
I could solve it with fzero with different numbers. But now when I run it with any types of numbers as a starting value for fzero solver it aborts search because faces with NaN.
Any one can help me to find a starting value to solve it with fzero or suggest me another solver to solve it.
thanks any one
0 Comments
Answers (3)
Star Strider
on 11 Jul 2021
I am not surprised that the numerical solvers are having problems with it!
syms x
Eqn = 2^((2*10^6)/x)-((1.5536*10^(-51)*x)/(2.6243*10^(-15)+((3.9810*10^(-21))*x)));
Eqn = simplify(Eqn, 500)
Sx = solve(Eqn)
Sxn = double(Sx)
.
0 Comments
Matt J
on 11 Jul 2021
Well, you could plot the function to get an idea where to make your initial guess. To me, though, it doesn't look like it has any roots. It looks like it just decays asymptotically to 1:
f=@(x)2.^((2*10^6)./x)-((1.5536*10^(-51)*x)./(2.6243*10^(-15)+((3.9810*10^(-21))*x)));
x=logspace(10,16); semilogx(x,f(x));
1 Comment
Walter Roberson
on 11 Jul 2021
syms x
Q = @(v) sym(v)
f = 2.^((Q(2)*10^6)./x)-((Q(1.5536)*10^(-51)*x)./(Q(2.6243)*10^(-15)+((Q(3.9810)*10^(-21))*x)))
fplot(f, [-659210,-659200])
Walter Roberson
on 11 Jul 2021
Edited: Walter Roberson
on 11 Jul 2021
syms A B C x
Eqn = 2^(2*10^6/x) - A*10^(-51)*x/(B*10^(-15) + C*10^(-21)*x)
sol = solve(Eqn,x)
However, Maple says that it does have a solution, namely
sol_maple = 2000000*log(2)*B/(B*lambertw(1/500000000000000000000000000000*A*log(2)/B*4^(C/B)) - 2*C*log(2))
soln = subs(sol_maple, [A,B,C], [1.5536, 2.6243, 3.9810])
solv = vpa(soln)
simplify(subs(Eqn, [A,B,C,x], [1.5536, 2.6243, 3.9810, soln]))
double(ans)
I do not know why it does not cross-check... it cross-checks in Maple.
0 Comments
See Also
Categories
Find more on Problem-Based Optimization Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





