finding a solver in matlab to solve an equation

2 views (last 30 days)
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

Answers (3)

Star Strider
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)
Eqn = 
Sx = solve(Eqn)
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
Sx = 
Sxn = double(Sx)
Sxn = -2.5669e-50
.

Matt J
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
Walter Roberson on 11 Jul 2021
syms x
Q = @(v) sym(v)
Q = function_handle with value:
@(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)))
f = 
fplot(f, [-659210,-659200])

Sign in to comment.


Walter Roberson
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)
Eqn = 
sol = solve(Eqn,x)
Warning: Unable to find explicit solution. For options, see help.
sol = Empty sym: 0-by-1
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))
sol_maple = 
soln = subs(sol_maple, [A,B,C], [1.5536, 2.6243, 3.9810])
soln = 
solv = vpa(soln)
solv = 
simplify(subs(Eqn, [A,B,C,x], [1.5536, 2.6243, 3.9810, soln]))
ans = 
double(ans)
ans = 0.1221
I do not know why it does not cross-check... it cross-checks in Maple.

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!