• 《高等应用数学问题的MATLAB求解》——第3章习题代码


    (1)求极限

    [ lim_{x ightarrow infty} (3^x+9^x)^{1/x}, lim_{x ightarrowinfty}frac{(x+2)^{x+2}(x+3)^{x+3}}{(x+5)^{2x+5}}, lim_{x ightarrow a}{left(frac{ an x}{ an a} ight)^{cot(x-a)}},\ lim_{x ightarrow 0}left[frac{1}{ln(x+sqrt{1+x^2})}-frac{1}{ln(1+x)} ight],\ lim_{x ightarrow infty}left[sqrt[3]{x^3+x^2+x+1}-sqrt{x^2+x+1}frac{ln(e^x+x}{x} ight]]

    >> syms x,a;
    >> f1=(3^x+9^x)^(1/x);
    >> f2=(x+2)^(x+2)*(x+3)^(x+3)/(x+5)^(2*x+5);
    >> f3=(tan(x)/tan(a))^cot(x-a);
    >> f4=1/log(x+sqrt(1+x^2))-1/log(1+x);
    >> f5=(x^3+x^2+x+1)^(1/3)-sqrt(x^2+x+1)*log(exp(x)+x)/x;
    >> limit(f1,x,inf)
    >> limit(f2,x,inf)
    >> limit(f3,x,a)
    >> limit(f4,x,0)
    >> limit(f5,x,inf)
    

    (2)

    (5)(y(t)=sqrt{frac{(x-1)(x-2)}{(x-3)(x-4)}})的4阶导数

    >> syms x;y=sqrt((x-1)*(x-2)/((x-3)*(x-4)));
    >> tic,diff(y,x,4),toc
    

    (6)

    (8)直接求极限与洛必达对比:

    [lim_{x ightarrow 0}frac{ln(1+x)ln(1-x)-ln(1-x^2)}{x^4} ]

    >> syms x;f=(log(1+x)*log(1-x)-log(1-x^2))/x^4;
    >> f1=log(1+x)*log(1-x)-log(1-x^2);f2=x^4;
    >> y1=limit(f,x,0)
    >> y2=diff(f1,x,4)/diff(f2,x,4);subs(y2,x,0)
    

    (9)参数方程(egin{cases}x=ln(cos t)\y=cos t-tsin tend{cases}),计算(frac{ ext{d}y}{ ext{d}x},frac{ ext{d}^2y}{ ext{d}x^2})(例题的paradiff)

    >> syms t;x=log(cos(t));y=cos(t)-t*sin(t);
    >> paradiff(y,x,t,1)
    >> paradiff(y,x,t,2)
    

    (11)(u=arccossqrt{frac{x}{y}})验证(frac{partial^2u}{partial xpartial y}=frac{partial^2u}{partial ypartial x})

    >> syms x y;
    >> u=acos(sqrt(x/y));
    >> diff(diff(u,y,1),x,1)-diff(diff(u,x,1),y,1)
    

    (14)计算(frac{x}{y}frac{partial^2 f}{partial x^2}-2frac{partial^2 f}{partial xpartial y}+frac{partial^2 f}{partial^2 y}) 其中$$f(x,y)=int_0^{xy} e{-t2} ext{d}t$$

    >> syms x y t;
    >> f(x,y)=int(exp(-t^2),0,x*y);
    >> %f(x,y)=int(exp(-t^2),t,0,x*y);
    >> g=diff(f,x,2)*x/y-2*diff(diff(f,x,1),y,1)+diff(f,y,2)
    

    (15)计算(frac{ ext{d}y}{ ext{d}x},frac{ ext{d}^2y}{ ext{d}x^2},frac{ ext{d}^3y}{ ext{d}x^3})

    [egin{cases}x=e^{2t}cos^2t\y=e^{2t}sin^2tend{cases};egin{cases}x=frac{arcsin t}{sqrt{1+t^2}}\ y=frac{arccos t}{sqrt{1+t^2}}end{cases} ]

    >> syms t x1 y1 x2 y2;
    >> x1=exp(2*t)*cos(t)^2;
    >> y1=exp(2*t)*sin(t)^2;
    >> x2=asin(t)/sqrt(1+t^2);
    >> y2=acos(t)/sqrt(1+t^2);
    >> paradiff(y1,x1,t,1)
    >> paradiff(y1,x1,t,2)
    >> paradiff(y1,x1,t,3)
    >> paradiff(y2,x2,t,1)
    >> paradiff(y2,x2,t,2)
    >> paradiff(y2,x2,t,3)
    

    (16)写题目浪费时间,专心代码

    >> syms x y;f=x^2-x*y+2*y^2+x-y-1;
    >> subs(impldiff(f,x,y,1),{x,y},{0,1})
    >> subs(impldiff(f,x,y,2),{x,y},{0,1})
    >> subs(impldiff(f,x,y,3),{x,y},{0,1})
    

    (17)

    >> syms x y z;
    >> f=[3*x+exp(y)*z, x^3+y^2*sin(z)];
    >> jacobian(f,[x y z])
    

    (18)

    >> syms x y;
    >> u=x-y+x^2+2*x*y+y^2+x^3-3*x^2*y-y^3+x^4-4*x^2*y^2+y^4;
    >> ux4=diff(u,x,4); ux3y1=diff(diff(u,x,3),y,1); ux2y2=diff(diff(u,x,2),y,2);
    

    (19)

    >> syms x y;
    >> u=x-y+x^2+2*x*y+y^2+x^3-3*x^2*y-y^3+x^4-4*x^2*y^2+y^4;
    >> laplacian(u,[x,y])
    

    (20)

    >> syms x y u xi eta;u=log(1/sqrt((x-xi)^2+(y-eta)^2));
    >> diff(diff(diff(diff(u,x),y),xi),eta)
    

    (21)

    >> syms x y z t psi(z);
    >> z=x^2+y^2;t=psi(z);
    >> y*diff(t,x)-x*diff(t,y)
    

    (22)

    >> syms x y z u psi(z) phi(z);
    >> z=x+y;u=x*phi(z)+y*psi(z);
    >> diff(u,x,2)-2*diff(diff(u,x),y)+diff(u,y,2)
    

    (23)

    %1
    >> syms x y v(x,y);
    >> v(x,y)=[5*x^2*y 3*x^2-2*y];
    >> divergence(v(x,y),[x,y]),curl(v(x,y),[x,y])
    %2
    >> syms x y z v;
    >> v=[x^2*y^2 1 z];
    >> divergence(v,[x,y,z]),curl(v,[x,y,z])
    %3
    >> syms x y z v;
    >> v=[2*x*y*z^2 x^2*z^2+z*cos(y*z) 2*x^2*y*z+y*cos(y*z)]
    >> divergence(v,[x,y,z]),curl(v,[x,y,z])
    

    (25)

    >> syms a b c x t;
    >> I1=-(3*x^2+a)/(x^2*(x^2+a)^2);
    >> I2=sqrt(x*(x+1))/(sqrt(x)+sqrt(1+x));
    >> I3=x*exp(a*x)*cos(b*x);
    >> I4=exp(a*x)*sin(b*x)*sin(c*x);
    >> I5=(7*t^2-2)*3^(5*t+1);
    >> int(I1,x),int(I2,x),int(I3,x),int(I4,x),int(I5,t)
    >> %I2积不出
    

    (26)

    >> syms x, n;
    >> f1=cos(x)/sqrt(x);
    >> f2=(1+x^2)/(1+x^4);
    >> f3=abs(cos(log(1/x)));
    >> int(f1,x,0,inf),int(f2,x,0,1),int(f3,x,exp(-2*pi*n),1)
    >> subs(int(3,x),x,1)-subs(int(3,x),x,exp(-2*pi*n))
    >> %f3定积分积不出,先不定积分处理再利用牛顿莱布尼茨公式
    >> %这里使用的是解析函数,使用subs赋值,如果直接函数格式,代入即可
    

    (27)

    >> syms x;f=1/((x+1)*sqrt(x^2+1));simplify(int(f,x,0,0.75))
    >> syms x;f=asin(sqrt(x))/sqrt(x*(1-x));simplify(int(f,x,0,1))
    >> syms x n; f=((sin(x)-cos(x))/(sin(x)+cos(x)))^(2*n+1); simplify(int(f,x,0,pi/4))
    

    (28)

    >> syms x;f=(sin(x)^2-4*sin(x)*cos(x)+3*cos(x)^2)/(sin(x)+cos(x));simplify(int(f,x))
    >> syms x;f=(sin(x)^2-sin(x)*cos(x)+2*cos(x)^2)/(sin(x)+2*cos(x));simplify(int(f,x))
    

    (29)

    >> syms x s;f=exp(x)*sqrt(exp(x)-1)/(exp(x)+3);simplify(int(f,x,0,s))
    

    (30)

    >> syms beta alpha m t;syms s positive;
    >> f1=1;f2=exp(beta*t);f3=sin(alpha*t);f4=t^m;
    >> F1=simplify(int(f1*exp(-s*t),t,0,inf));F2=simplify(int(f2*exp(-s*t),t,0,inf));F3=simplify(int(f3*exp(-s*t),t,0,inf));F4=simplify(int(f4*exp(-s*t),t,0,inf));
    

    (31)

    >> syms x t;f(x)=exp(-5*x)*sin(3*x+pi/3);
    >> R(t)=int(f(x)*f(t+x),x,0,t)
    

    (32)

    >> syms x y;f1=abs(cos(x+y));f2=asin(x+y);f3=abs(x)+abs(y);f4=sin(sqrt(x^2+y^2));
    >> F1=simplify(int(int(f1,x,0,pi),y,0,pi));
    >> F2=simplify(int(int(f2,y,-1,1-x),x,0,1));
    >> F3=simplify(int(int(f3,y,abs(x)-1,1-abs(x)),x,-1,1));
    >> F4=?
    

    (33)

    >> syms x y z;f=x^3*y^2*z; int(int(int(f,z,0,x*y),y,0,x),x,0,1)
    

    (34)

    >> syms a x positive;f=cos(a*x)/(1+x^2);int(f,x,0,inf)
    

    (35)

    >> syms a b t real;f=f(t);int(f,t,a,b)+int(f,t,b,a)
    

    (36)

    >> syms x y positive;f=sqrt(4-x^2-y^2); int(int(f,y,0,sqrt(4-x^2)),x,0,2)
    >> syms x y z real;f2=x*y*z;f3=z*(x^2+y^2);
    >> F2=int(int(int(f2,z,0,3-x-y),y,0,3-x),x,0,3);F3=int(int(int(f3,z,0,sqrt(4-x^2-y^2)),y,0,sqrt(4-x^2)),0,2);
    

    (37)

    >> syms x y z u w real;f1=x*y*z*u*exp(6-x^2-y^2-z^2-u^2);f2=sqrt(6-x^2-y^2-z^2-w^2-u^2);
    >> F1=int(int(int(int(f1,u,0,z),z,0,y),y,0,x),x,0,1);
    >> F2=int(int(int(int(int(f2,w,0,11/10),u,0,1),z,0,9/10),y,0,4/5),z,0,7/10);
    

    (38)

    >> syms x;f1(x)=(pi-abs(x))*sin(x);f2(x)=exp(abs(x));f3(x)=1-abs(2*x/pi-1);
    >> F1=fseries(f1,x,12,-pi,pi);F2=fseries(f2,x,12,-pi,pi);F3=fseries(f3,x,12,0,pi);
    

    (39)

    >> syms t x a;f1=int(sin(t)/t,0,x);f2=log((1+x)/(1-x));f3=log(x+sqrt(1+x^2));f4=(1+4.2*x^2)^0.2;f5=exp(-5*x)*sin(3*x+pi/3);
    >> y1=taylor(f1,x,'Order',9);y1_=taylor(f1,x,a,'Order',9);
    >> y2=taylor(f2,x,'Order',9);y2_=taylor(f2,x,a,'Order',9);
    >> y3=taylor(f3,x,'Order',9);y3_=taylor(f3,x,a,'Order',9);
    >> y4=taylor(f4,x,'Order',9);y4_=taylor(f4,x,a,'Order',9);
    >> y5=taylor(f5,x,'Order',9);y5_=taylor(f5,x,a,'Order',9);
    

    (40)

    >> syms t;f=exp(t);y=taylor(f,t,'Order',10);
    >> ezplot(f,[-5,6]);hold on;ezplot(y,[-5,6])
    

    (41)

    >> syms x y a b;f1=exp(x)*cos(y);f2=log(1+x)*log(1+y);
    >> y1=taylor(f1,[x,y],'Order',9);y1_=taylor(f1,[x,y],[a,b],'Order',9);
    

    (42)

    >> syms x y;f=(1-cos(x^2+y^2))/((x^2+y^2)*exp(x^2+y^2));
    >> y=taylor(f,[x,y],[1,0],'Order',9);
    

    (43)

    >> y2=taylor(f2,[x,y],'Order',9);y2_=taylor(f2,[x,y],[a,b],'Order',9);
    

    (45)

    1
    >> syms k n x positive;assume(n,'integer');sn=x(1/3)+symsum(x(1/(2k+1))-x(1/(2*k-1)),2,n);si=x(1/3)+symsum(x(1/(2*k+1))-x(1/(2k-1)),2,inf)
    2
    >> syms m n x k real;1+symsum(symprod(m-n+1,n,1,k)/symprod(n,n,1,k)*x^k,k,1,inf)

    (48)

    1
    >> syms n; f=1/((2n)^2-1); symsum(f,n,1,inf)
    2
    >> syms n k;limit(n
    symsum(1/(n^2+k*pi),k,1,n),n,inf)

    (49)

    >> syms n k theta; assume(n,'integer'); assume(~in(theta/(2*pi), 'integer'));simplify(symsum(cos(k*theta),k,1,n)-sin(n*theta/2)*cos((n+1)*theta/2)/sin(theta/2))
    

    (50)

    >> syms n;f1=(2*n+1)*(2*n+7)/((2*n+3)*(2*n+5));f2=9*n^2/((3*n-1)*(3*n+1));syms a positive;f3=a^((-1)^n/n);
    >> y1=symprod(f1,n,1,inf);y2=symprod(f2,n,1,inf);y3=symprod(f3,n,1,inf);
    

    (51)

    >> syms n x; an=int(tan(x)^n,x,0,pi/4);s=symsum((an+subs(an,n,n+2))/n,n,1,inf)
    

    (54)

    >> syms a b c positive; syms t m;
    >> x1=a*(cos(t)+t*sin(t)); y1=a*(sin(t)-t*cos(t));f1=x1^2+y1^2;
    >> x2=c*cos(t)/a; y2=c*sin(t)/b;f2=[y2*x2^3+exp(y2), x2*y2^3+x2*exp(y2)-2*y2];
    >> x3=exp(t);y3=exp(-t);z3=a*t;f3=[y3,-x3,x3^2+y3^2];
    >> path_integral(f1,[x1,y1],t,0,2*pi)
    >> path_integral(f2,[x2,y2],t,0,pi)
    >> path_integral(f3,[x3,y3,z3],t,0,1)
    >> syms a positive; syms x y t m;x4=t;y4=0;f4=[exp(x4)*sin(y4)-m*y4,exp(x4)*cos(y4)-m];
    >> I1=path_integral(f4,[x4,y4],t,a,0)
    >> x4=a*(1-cos(t))/2;y4=-a*sin(t)/2;I2=path_integral(f4,[x4,y4],t,0,pi); I=I1+I2
    

    (55)

    >> syms theta a;rho=a*sin(theta)^2/3;
    >> L=int(sqrt(rho^2+diff(rho,theta)^2),theta,0,3*pi)
    

    (56)

    >> f1=@(x,y)sqrt(4-x.^2-y.^2).*exp(-x.^2-y.^2);
    >> fh=@(x)exp(-x.^2/2);
    >> F1=integral2(f1,0,2,0,fh)
    
    >> f2=@(x,y,z)z.*(x.^2+y.^2).*exp(-x.^2-y.^2-z.^2-x.*z);
    >> F2=integral3(f2,0,2,0,2,0,2)
  • 相关阅读:
    20170226-云计算设计模式翻译-自动伸缩指南(逐字翻译)
    20170723-Ioc与AOP
    20170710-几维晨规
    诸城项目-开发日志
    GPS常识-B版(简)
    GPS常识-A版(详)
    20141209-基本概念-BlogEngine.NET(1)-笔记
    9.聚类分析
    7.分类:基本概念 忌讳
    6.挖掘关联规则
  • 原文地址:https://www.cnblogs.com/Math-Nav/p/13367308.html
Copyright © 2020-2023  润新知