如何处理符号运算在不同版本的差别
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
>> syms x
>> int(1/(x-x^2))
在新版本里:
ans =
2*atanh(2*x - 1)
在旧版本里:
ans=
log(x)-log(x-1)
------------------------------------
又如:
>> dsolve('Dx=x-x^2')
在新版本里:
ans =
1
0
-1/(exp(C2 - t) - 1)
在旧版本里:
ans=
1/(1+exp((-t)*C1)
---------------------------------
再如:
>> int(x-x^2)
在新版本里:
ans =
-(x^2*(2*x - 3))/6
>> pretty(ans)
2
x (2 x - 3)
>> collect(ans)
ans =
- x^3/3 + x^2/2
- ------------
6
而在旧版本里:
ans=
1/2*x^2-1/3*x^3
还有一个更大的差别:
syms a b c d x;
solve('a*x^3+b*x^2+c*x+d=0')
用旧版Matlab(V6.5)解出的x是用a,b,c,d 表示的结果(虽然很长!)。
而在Matlab2018里则有这样的结果:
syms a b c d x
eqn=a*x^3+b*x^2+c*x+d==0
>> solve(eqn,x)
ans =
root(a*z^3 + b*z^2 + c*z + d, z, 1)
root(a*z^3 + b*z^2 + c*z + d, z, 2)
root(a*z^3 + b*z^2 + c*z + d, z, 3)
难道新版本反而不会计算了?所以有时觉得旧版本更好用啊。
不知道各位是怎样处理的?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!