1. 級數(shù)符號求和。
(1) 計算 。
(2) 求級數(shù) 的和函數(shù),并求 之和。
解:
M文件:
clear all;clc;
n=sym('n');x=sym('x');
S1=symsum(1/(2*n-1),n,1,10)
S2=symsum(n^2*x^(n-1),n,1,inf)
S3=symsum(n^2/5^n,n,1,inf) %vpa(S3)可以轉(zhuǎn)化成小數(shù)
運(yùn)行結(jié)果:
S1 =
31037876/14549535
S2 =
piecewise([abs(x) < 1, -(x^2 + x)/(x*(x - 1)^3)])
S3 =
15/32
2. 將lnx在x=1處按5次多項式展開為泰勒級數(shù)。
解:
M文件:
clear all;clc;
x=sym('x');
f=log(x);
taylor(f,x,6,1)
運(yùn)行結(jié)果:
ans =
x - (x - 1)^2/2 + (x - 1)^3/3 - (x - 1)^4/4 + (x - 1)^5/5 - 1
3. 求下列方程的符號解。
解:
M文件:
clear all;clc;
x1=solve('log(x+1)-5/(1+sin(x))=2')
x2=solve('x^2+9*sqrt(x+1)-1')
x3=solve('3*x*exp(x)+5*sin(x)-78.5')
[x4 y4]=solve('sqrt(x^2+y^2)-100','3*x+5*y-8')
運(yùn)行結(jié)果:
x1 =
521.67926389905839979437366649258
x2 =
-1
(3^(1/2)*i*(4/(9*(6465^(1/2)/2 + 2171/54)^(1/3)) - (1/2*6465^(1/2) + 2171/54)^(1/3)))/2 - (6465^(1/2)/2 + 2171/54)^(1/3)/2 - 2/(9*(6465^(1/2)/2 + 2171/54)^(1/3)) + 1/3
1/3 - (6465^(1/2)/2 + 2171/54)^(1/3)/2 - (3^(1/2)*i*(4/(9*(6465^(1/2)/2 + 2171/54)^(1/3)) - (1/2*6465^(1/2) + 2171/54)^(1/3)))/2 - 2/(9*(6465^(1/2)/2 + 2171/54)^(1/3))
x3 =
2.3599419584772910151699327715486
x4 =
12/17 - (10*21246^(1/2))/17
(10*21246^(1/2))/17 + 12/17
y4 =
(6*21246^(1/2))/17 + 20/17
20/17 - (6*21246^(1/2))/17
4. 求微分方程初值問題的符號解,并與數(shù)值解進(jìn)行比較。
解:
M文件:
clear all;clc;
dsolve('D2y+4*Dy+29*y','y(0)=0','Dy(0)=15','x')
運(yùn)行結(jié)果:
ans =
(3*sin(5*x))/exp(2*x)
5. 求微分方程組的通解。
解:
M文件:
clear all;clc;
[x y z]=dsolve('Dx=2*x-3*y+3*z',...
'Dy=4*x-5*y+3*z','Dz=4*x-4*y+2*z','t')
運(yùn)行結(jié)果:
x =
C1/exp(t) + C2*exp(2*t)
y =
C1/exp(t) + C2*exp(2*t) + C3/exp(2*t)
z =
C2*exp(2*t) + C3/exp(2*t)