|
问题重点不在上述两位所解答之处,而是用solve求解,只能找到一个根。
function SolveP
clc
syms x
A1=solve('exp(14.717-1886.79/(x+273.16))-1022.246591*x-3424.252273','x')
f1=inline('exp(14.717-1886.79./(x1+273.16))-1022.246591*x1-3424.252273','x1');
A2=solve('exp(38.98-8533.8/(x+273.16))-490.5*x-3424.252273','x')
A22=subs('exp(38.98-8533.8/(x+273.16))-490.5*x-3424.252273',x,-4.05900180421605)
ezplot('exp(38.98-8533.8/(x+273.16))-490.5*x-3424.252273',[1e14,2e14])
f2=inline('exp(38.98-8533.8./(x2+273.16))-490.5*x2-3424.252273','x2')
x11=fsolve(f1,5)
x12=fsolve(f2,17304533375847)
x13=fsolve(f2,-10)
=================================================
A1 =
-.99927327624766913280894926374491
A2 =
173045333758471.02892812172842794
A22 =
-9.0949e-013
f2 =
Inline function:
f2(x2) = exp(38.98-8533.8./(x2+273.16))-490.5*x2-3424.252273
Optimization terminated: first-order optimality is less than options.TolFun.
x11 =
-0.9993
Optimizer appears to be converging to a point which is not a root.
Norm of relative change in X is less than max(options.TolX^2,eps) but
sum-of-squares of function values is greater than or equal to sqrt(options.TolFun)
Try again with a new starting guess.
x12 =
1.7305e+013
Optimization terminated: first-order optimality is less than options.TolFun.
x13 =
-4.0590
程序明显可以看出在[1E14,2E14]之间同样存在一个根,因此不能说solve算错了,只能说没算全,至于为什么没算全,暂时没找到原因。而且从最后一个语句所得结果可以看出,fsolve在此处同样能得到这个结果。
附件图中可以看出问题是出自maple的计算引擎,在maple中不加任何干预得到的是同样 的结果。而更有意思的是,用maple中的浮点方式求解方程命令fsolve得到的是-4.0590 |
-
|