第六节 - Shandong University

第六节 - Shandong University

2 MATLAB 2.1 2.2

2.3 2.4 2.5 2.6 2.7 2.8 2.9 Matlab matlab , . , . , 1993 Maple , , (Symbolic Math ToolbSymbolic Math Toolb ox)) matlab 2008b b MuPAD 2009b Maple Maple symen gine MuPAD Maple 2010a Maple

---- --- 2.1 matlab , . , , , , , , , . 2.1.1 --- , . --- (Symbolic Math Toolb , , ), , 2.1.1

1. sym syms 2 sc=sym(Symbolic Math Toolb'num') % sc num i) ii) num sc=sym(Symbolic Math Toolb'2/3') sb=sym(Symbolic Math Toolb'pi+sqrt(Symbolic Math Toolb5)') sc=2/3 sb =pi + 5^(Symbolic Math Toolb1/2)

2 2.1-1 a=pi+sqrt(5) sa=sym('pi+sqrt(5)') Ca=class(a) Csa=class(sa) vpa(sa-a) a = 5.3777 sa = pi + 5^(1/2) Ca = double Csa = sym ans =0.00000000000000001382237584108520004859354256418 2 3. sin(3)uz xz 3w a5 0 ,

x x i) syms para para=sym(Symbolic Math Toolb'para') syms a; a=sym(Symbolic Math Toolb'a') ii) syms para flag para=sym(Symbolic Math Toolb'para', 'flag') syms a positive; a=sym(Symbolic Math Toolb'a', 'positive') iii) syms a b c syms a b c flag flag positive---- real----- unreal----- 4. x ASII symvar(Symbolic Math Toolbex)pression)

symvar(Symbolic Math Toolbex)pression,n) n ex)pression x x, y, w, z, v 2.1-2 2 sin(3) uz vz 3w a5 0 syms u v w z a5 f=sym(Symbolic Math Toolb'3'); Eq=sin(Symbolic Math Toolbf)*u*z^2+v*z+f*w-a5; symvar(Symbolic Math ToolbEq) % , f ans =[ a5, u, v, w, z] symvar(Symbolic Math ToolbEq,100) % x) ans

=[ w, z, v, u,Ea5] result_1=solve(Symbolic Math Toolb q) result_1 =a5/3 - (Symbolic Math Toolbv*z)/3 - (Symbolic Math Toolbu*sin(Symbolic Math Toolb3)*z^2)/3 result_2=solve(Symbolic Math ToolbEq,z) result_2 = -(Symbolic Math Toolbv - (Symbolic Math Toolbv^2 + 4*a5*u*sin(Symbolic Math Toolb3) - 12*u*w*sin(Symbolic Math Toolb3))^(Symbolic Math Toolb1/2))/(Symbolic Math Toolb2*u*sin(Symbolic Math Toolb3)) -(Symbolic Math Toolbv + (Symbolic Math Toolbv^2 + 4*a5*u*sin(Symbolic Math Toolb3) - 12*u*w*sin(Symbolic Math Toolb3))^(Symbolic Math Toolb1/2))/(Symbolic Math Toolb2*u*sin(Symbolic Math Toolb3)) 2.1-3 syms a b x) X Y k=sym(Symbolic Math Toolb'3'); z=sym(Symbolic Math Toolb'c*sqrt(Symbolic Math Toolbd)+y*sin(Symbolic Math Toolbt)'); EXPR=a*z*X+(Symbolic Math Toolbb*x)^2+k)*Y; symvar(Symbolic Math ToolbEXPR) ans =[ X, Y, a, b, c, d, t, x), y] kz symvar(Symbolic Math ToolbEXPR,10) ans =[ x), y, t, d, c, b, a, X, Y ] E3=sym(Symbolic Math Toolb'a*sqrt(Symbolic Math Toolbtheta)') ??? Error using ==> sym.sym> convertEx)pression at 2515 E 4=sym(Symbolic Math Toolb'a*sqrt(Symbolic Math Toolbtheta1)') E5=sym(Symbolic Math Toolba*sqrt(Symbolic Math Toolbtheta*t)) % R2009b

??? Error using ==> sym.sym> convertEx)pression at 2515 4. 2.1-4 symvar syms a b t u v x) y A=[a+b*x), sin(Symbolic Math Toolbt)+u; x)*ex)p(Symbolic Math Toolb-t), log(Symbolic Math Toolby)+v] symvar(Symbolic Math ToolbA,1) A= [ a + b*x), u + sin(Symbolic Math Toolbt)] [ x)/ex)p(Symbolic Math Toolbt), v + log(Symbolic Math Toolby)] ans = x) 2.1.2 matlab (Symbolic Math ToolbOverload) , , , , , , . (Symbolic Math Toolb1) +, -, *, \, /,^ , , , , , . .*, ./, . \, .^ , ,

. ' , .' , 2.1.2 (Symbolic Math Toolb2) , , , , , == ~= , 1 0. 2.1.3 1. 2. 50 erf besselj ElliptiK mfun mfunlist 3. MuPAD evalin feval (Symbolic Math Toolb1) , atan2 , .

(Symbolic Math Toolb2) , sqrt, ex)p, ex)pm log log2, log 10 (Symbolic Math Toolb3) conj, imag, real, abs . angle. (Symbolic Math Toolb4) , matlab diag, tril, inv, det, rank, eig, svd Singular value decomposition (Symbolic Math Toolb5) solve (Symbolic Math Toolb6) diff int (Symbolic Math Toolb7) laplace ilaplace Fourier (Symbolic Math Toolb8b ) ezplot ezsurf 2.1.4 , , MATALB . , .MATLAB , class, isa, whos

2.1.3-1 (Symbolic Math Toolb1) clear, a=1;b=2;c=3;d=4 Mn=[a,b; c,d] % % Mc='[a,b; c,d]' % a,b,c,d Ms=sym(Symbolic Math ToolbMc) % Mn = 1 3 2 4 Mc =

[a,b;c, Ms = [ a, Mn = 1 3 2 4 Mc = [a,b;c,d] Ms = [ a, b] [ c, d] (Symbolic Math Toolb2) SizeMn=size(Symbolic Math ToolbMn), SizeMc=size(Symbolic Math ToolbMc), SizeMs=size(Symbolic Math ToolbMs) SizeMn = SizeMs = SizeMc =

2 2 2 2 1 9 (Symbolic Math Toolb3) class CMn=class(Symbolic Math ToolbMn), CMc=class(Symbolic Math ToolbMc), CMs=class(Symbolic Math ToolbMs) CMn = double CMc = char CMs = sym (Symbolic Math Toolb4) isa isa(Symbolic Math ToolbMn,double), ans = 1

isa(Symbolic Math ToolbMc,'char'), isa(Symbolic Math ToolbMs,'sym') ans = 1 ans = 1 (Symbolic Math Toolb5) whos whos Name Size Name Size Mc 1x)9 ans 1x)1 Mn 2x)2 t 1x)201 Ms

2x)2 y 1x)201 Bytes Class P26 Bytes Class 18b char array 8b double 32 double array 1608b double 312 sym object 1608b double a=0:1:6; theta=sym(Symbolic Math Toolb'30*pi/18b 0*a') alfa=sym(Symbolic Math Toolb'30*pi/18b 0')*a alfa = [ 0, 1/6*pi, 1/3*pi, 1/2*pi, theta = 30*pi/18b 0*a a a

2/3*pi, 5/6*pi, pi] 2.1.5 1. Matlab sym syms M uPAD MuPAD matlab assumption MuPAD MuPAD 2.1.5 2. i) syms x) para=sym(Symbolic Math Toolb'x)') ii) syms x) flag para=sym(Symbolic Math Toolb'x)', 'flag') syms a positive; a=sym(Symbolic Math Toolb'a', 'positive') iii) syms a b c syms a b c flag flag positive---- real-----

unreal----- 2.1.5 3. clear all clear x) matlab x) syms x) clear MuPAD x) clear all matlab MuPAD evalin(Symbolic Math Toolb symengine,'getprop(Symbolic Math Toolbx)) ') x) evalin(Symbolic Math Toolbsymengine,'anames (Symbolic Math ToolbProperties)') MuPAD reset(Symbolic Math Toolbsymengine) MuPAD MuPAD 2.1-6 syms

clear x) syms x) clear syms x) f=x)^3+4.75*x)+2.5; g=x)^2+x)+5; rf=solve(Symbolic Math Toolbf,x)) rg=solve(Symbolic Math Toolbg,x)) rf = -1/2 Warning: Ex)plicit solution could 1/4 - (Symbolic Math Toolb79^(Symbolic Math Toolb1/2)*i)/4 not be found. > In solve at 98b (Symbolic Math Toolb79^(Symbolic Math Toolb1/2)*i)/4 + 1/4 rg =[ empty sym ] evalin(Symbolic Math Toolbsymengine,'getprop(Symbolic Math Toolbx))') ans =C_ evalin(Symbolic Math Toolbsymengine,'anames(Symbolic Math ToolbProperties)') ans =x) syms x) real syms x) clear rfr=solve(Symbolic Math Toolbf,x)) rg=solve(Symbolic Math Toolbg,x)) rfr =-1/2 rg = - (Symbolic Math Toolb19^(Symbolic Math Toolb1/2)*i)/2 - 1/2 evalin(Symbolic Math Toolbsymengine,'getprop(Symbolic Math Toolbx))') (Symbolic Math Toolb19^(Symbolic Math Toolb1/2)*i)/2 - 1/2

ans =R_ reset(Symbolic Math Toolbsymengine) clear all 2.1.6 Matlab 2008b MuPAD maple help SymName helpwin SymName doc SymName doc mfunlist doc(Symbolic Math Toolbsymengine) 2.1.6 Matlab 2008b MuPAD maple help SymName helpwin SymName docsearch laplace doc mfunlist doc(Symbolic Math Toolbsymengine) 2.1.6 Matlab 2008b

MuPAD maple help SymName helpwin SymName docsearch laplace doc mfunlist doc(Symbolic Math Toolbsymengine) MuPAD 2.2 2.2.1 1. sym(Symbolic Math Toolbnum, r) % : p/q, n^(Symbolic Math Toolbp/ q) sym(Symbolic Math Toolbn num, um) f) sym(Symbolic Math Toolb % sym(Symbolic Math Toolbnum, r)

e % N * 2 N, e [2e N 2( 52e ) ] sym(Symbolic Math Toolb1/10,'f') is 36028b 797018b 96397/36028b 797018b 963968b sym(Symbolic Math Toolbnum, e) % + e sym(Symbolic Math Toolb3*pi/4,'e') is 3*pi/4 - 103*eps/249 sym(Symbolic Math Toolbnum, d) % 2.2.1 1. sym(Symbolic Math Toolbnum) sym(Symbolic Math Toolbnum) % sym(Symbolic Math Toolbnum, r) % num sym(Symbolic Math Toolbnum) num sym(Symbolic Math Toolbnum) num

2.2.1 2. double(Symbolic Math Toolbnum_sym) % double(Symbolic Math Toolbnum) ASCII double(Symbolic Math Toolb0.1) ans = 48b 46 f=sym(Symbolic Math Toolb'10/3') Df=double(Symbolic Math Toolbf) class(Symbolic Math ToolbDf) 49 Df = 3.3333 ans = double 2.2.2

digits digits(n) xs=vpa(x) x digits xs xs=vpa(x,n) x n xs 2.2-1 digits, vpa, symengine sa32=vpa(sa) reset(symengine) digits(48) sa=sym('1/3+sqrt(2)') sa5=vpa(sa,5) sa =2^(1/2) + 1/3 sa48=vpa(sa) digits sa32 =1.747546895706428382135022057543 Digits = 32 sa5 =1.7475

format long sa48 =1.747546895706428382135022057543 a=1/3+sqrt(2) 03141190300520871 sa_Plus_a=vpa(sa+a,20) sa_Minus_a=vpa(sa-a,20) a= 1.747546895706428 sa_Plus_a = 3.4950937914128567869 sa_Minus_a = -0.000000000000000022658064826339973669 2.2.3 collect numden expand

simplify factor simple horner pretty 2.2-2 syms x); f 3

1 x3 x62 12x 8 f=(Symbolic Math Toolb1/x)^3+6/x)^2+12/x)+8b )^(Symbolic Math Toolb1/3); g1=simple(Symbolic Math Toolbf) g1 =(Symbolic Math Toolb(Symbolic Math Toolb2*x) + 1)^3/x)^3)^(Symbolic Math Toolb1/3) : f2=g1^3 f2 =(Symbolic Math Toolb2*x) + 1)^3/x)^3 ex)pand(Symbolic Math Toolbf2) ans = 12/x) + 6/x)^2 + 1/x)^3 + 8b 2.2.4 1. RS=subexpr(S); RS=subexpr(S,w); [RS,w]=subexpr(S,w) w MATLAB 2.2-3

syms a b c d W; A a b c d [V,D]=eig([a,b;c,d]); [RVD,W]=subexpr([V;D],W) V RVD = = [ (a/2 + d/2 - w/2)/c - d/c, (a/2 + d/2 + w/2)/c - d/c] [(a/2+d/2-(a^2-2*a*d+d^2+4*b*c)^(1/2)/2)/c-d/c, (a/2+d/2+(a^2-2*a*d+ d^2+4*b*c)^(1/2)/2)/c-d/c] [ 1] 1] [ 1, 1, D= [ a/2 + d/2 - w/2, 0] [a/2 + d/2 - (a^2 - 2*a*d + d^2 + 4*b*c)^(1/2)/2, 0] [ 0, a/2 + d/2 +

w/2] [ 0, a/2 + d/2 + (a^2 - 2*a*d + d^2 + 4*b*c)^(1/2)/2] w =(a^2 - 2*a*d + d^2 + 4*b*c)^(1/2) 2.2.4 2. RES subs(ES,old,new) RES subs(ES,new) 2.2-4 subs clear syms a b x); f=a*sin(Symbolic Math Toolbx))+b f1=subs(Symbolic Math Toolbf,sin(Symbolic Math Toolbx)),'log(Symbolic Math Toolby)') f2=subs(Symbolic Math Toolbf,a,3.11) f3=subs(Symbolic Math Toolbf,{a,b,x)},{2,5,sym(Symbolic Math Toolb'pi/3')}) class(Symbolic Math Toolbf3) f1=a* log(Symbolic Math Toolby) +b f2 =b + (Symbolic Math Toolb311*sin(Symbolic Math Toolbx)))/100 f3 =3^(Symbolic Math Toolb1/2) + 5 ans =sym

2.2-4 subs (Symbolic Math Toolb5) format % format compact f4=subs(Symbolic Math Toolbf,{a,b,x)},{2,5,pi/3}) class(Symbolic Math Toolbf4) f4 = 6.7321 ans =double f5=subs(Symbolic Math Toolbf,x),0:pi/2:pi) class(Symbolic Math Toolbf5) f5 =[ b, a + b, b] ans =sym t=0:pi/10:2*pi; f6=subs(Symbolic Math Toolbf,{a,b,x)},{2,3,t}) plot(Symbolic Math Toolbt,f6) 5 4.5 4 3.5 3 2.5

f=a*sin(Symbolic Math Toolbx))+b k=(Symbolic Math Toolb0.5:0.1:1)'; f6=subs(Symbolic Math Toolbsubs(Symbolic Math Toolbf,{a,b},{k,2}),x),t); size(Symbolic Math Toolbf6) plot(Symbolic Math Toolbt,f6) ans = 6 21 2 1.5 1 0 1 2 3 f6=2*sin(Symbolic Math Toolbt)+3 4

5 6 7 3 2.8 2.6 2.4 2.2 2 1.8 1.6 1.4 1.2 1 0 1 2

3 4 5 6 7 Matlab6.5 clear all; clear mex) syms x) unreal syms x) clear f=x)^3+4.75*x)+2.5; rf=solve(Symbolic Math Toolbf,x)) rf = -1/2 1/4 - (Symbolic Math Toolb79^(Symbolic Math Toolb1/2)*i)/4 (Symbolic Math Toolb79^(Symbolic Math Toolb1/2)*i)/4 + 1/4 syms x) real rfr=solve(Symbolic Math Toolbf,x)) rfr =-1/2 evalin(Symbolic Math Toolbsymengine,'getprop(Symbolic Math Toolbx))')

ans =R_ evalin(Symbolic Math Toolbsymengine,'anames(Symbolic Math ToolbProperties)') findsym(Symbolic Math Toolbex)pression,n) n n x) symvar(Symbolic Math Toolbex)pression,n) n Matlab6.5 word M 2 (Page114) 3 1~12 , 2 3~25 4 2010 , 7 ,9 6.5 , review syms x) flag para=sym(Symbolic Math Toolb'x)', 'flag') syms a positive; a=sym(Symbolic Math Toolb'a', 'positive') sym(Symbolic Math Toolbnum) % sym(Symbolic Math Toolbnum, r) sym(Symbolic Math Toolbnum) % num double(Symbolic Math Toolbnum_sym) %

digits(n) xs=vpa(x,n) x n xs RES subs(ES,old,new) RES subs(ES,new) 2.3 2.3.1 limit(f,v,a) lim f (v) limit(f,v,a,right) lim f (v) limit(f,v,a,left)

v a v a lim f (v) v a n dfdvn=diff(f,v,n) d f (v ) n dv fjac=jacobian(f,v) f(v) jacobian r=taylor(f,n,v,a) f(v) v=a

n 1 k 0 f (k ) (a) k ( x a) k! 1 1 2.3-1 lim x x syms x k kx

f=(1-1/x)^(k*x); Lf=limit(f,x,inf) Lf =1/exp(k) Lf1=vpa(subs(Lf,k,sym('-1')),48) Lf1=2.71828182845904523536028747135266249 77572470937 3 a t 2.3-2 f t cos x ln x df d 2 f dx dt 2 d2 f dtdx syms a t x f=[a, t^3; t*cos(x), log(x)];

df=diff(f) dfdt2=diff(f,t,2) df =[ 0, 0] [-t*sin(Symbolic Math Toolbx)), 1/x)] dfdxdt=diff( diff(f,x) ,t) dfdt2 =[ 0, 6*t] [ 0, 0] dfdx)dt =[ 0, 0] [ -sin(Symbolic Math Toolbx)), 0] 2.3-5: cos(x+siny)=siny, dy/dx( ). x) syms g=sym(Symbolic Math Toolb'cos(Symbolic Math Toolbx)+sin(Symbolic Math Toolby(Symbolic Math Toolbx))))=sin(Symbolic Math Toolby(Symbolic Math Toolbx)))') dgdx)=diff(Symbolic Math Toolbg,x)) g =cos(Symbolic Math Toolbx) + sin(Symbolic Math Toolby(Symbolic Math Toolbx)))) = sin(Symbolic Math Toolby(Symbolic Math Toolbx))) dgdx) = -sin(Symbolic Math Toolbx) + sin(Symbolic Math Toolby(Symbolic Math Toolbx))))*(Symbolic Math Toolbcos(Symbolic Math Toolby(Symbolic Math Toolbx)))*diff(Symbolic Math Toolby(Symbolic Math Toolbx)), x)) + 1) = cos(Symbolic Math Toolby (Symbolic Math Toolbx)))*diff(Symbolic Math Toolby(Symbolic Math Toolbx)), x))

dgdx)1=subs(Symbolic Math Toolbdgdx),'diff(Symbolic Math Toolby(Symbolic Math Toolbx)),x))','dydx)') dgdx)1 =-sin(Symbolic Math Toolbx) + sin(Symbolic Math Toolby(Symbolic Math Toolbx))))*(Symbolic Math Toolbdydx)*cos(Symbolic Math Toolby(Symbolic Math Toolbx))) + 1) = dyd x)*cos(Symbolic Math Toolby(Symbolic Math Toolbx))) dydx)=solve(Symbolic Math Toolbdgdx)1, 'dydx)') dydx) =-sin(Symbolic Math Toolbx) + sin(Symbolic Math Toolby(Symbolic Math Toolbx))))/(Symbolic Math Toolbcos(Symbolic Math Toolby(Symbolic Math Toolbx))) + cos(Symbolic Math Toolby(Symbolic Math Toolbx)))*sin(Symbolic Math Toolbx) + sin(Symbolic Math Toolby(Symbolic Math Toolbx))))) % dy/dx x,y 2.3-6: f(x)=xex x=0 8 Maclau rin 9 sym x) r=taylor(Symbolic Math Toolbx)*ex)p(Symbolic Math Toolbx)),9,x),0) pretty(Symbolic Math Toolbr) r= x)^8b /5040 + x)^7/720 + x)^6/120 + x)^5/24 + x)^4/6 + x)^3/2 + x)^2 + x) 8b 7 6 5 4 3 x) x) x) x) x) x) 2 ----- + --- + --- + -- + -- + -- + x) + x)

5040 720 120 24 6 2 2.3.2 / b MATLAB f (v) v a s=symsum(f,v,a,b) f v [a,b] 1 f 2 v f findsym symvar b 3 a b [0,v-1] 2.3-8 n 1

k 1 k ( k 1) syms n k f1=1/(k*(k+1)); s1=symsum(f1,k,1,n) s1 =1 - 1/(n + 1) f2=[1/(2*k-1)^2, (-1)^k/k ] s2=symsum(f2,1,inf) s3 = [ pi^2/8, -log(2)] k 1 ( 1 ) ( 2k 1) 2 , k k 1

2.3.3 intf=int(f,v) f v intf=int(f,v,a,b) f v 2.3-9 syms x f= x*log(x) s=int(f,x) s=simple(s) x ln xdx f= x*log(x) s= (x^2*(log(x) - 1/2))/2 s=

x^2*(log(x)/2 - 1/4) 2.3.3 intf=int(f,v) f v intf=int(f,v,a,b) f v ax bx 2 dx 2.3-10 1 sin x x syms a b x); The integral of f is f2=[a*x), b*x)^2; 1/x), sin(Symbolic Math Toolbx))] +-+ disp(Symbolic Math Toolb'The integral of f is') | 2 3 | | a x) b x) |

pretty(Symbolic Math Toolbint(Symbolic Math Toolbf2)) f2 = [ a*x), b*x)^2] [ 1/x), sin(Symbolic Math Toolbx))] | ---- , ---| | 2 3 | | | | log(Symbolic Math Toolbx)), -cos(Symbolic Math Toolbx)) | +-+ 2.3-11 2 x2 x2 y x

xy 1 2 2 2 ( x y z )dzdydx syms x) y z; f=x)^2+y^2+z^2; F2=int(Symbolic Math Toolbint(Symbolic Math Toolbint(Symbolic Math Toolbf, z, sqrt(Symbolic Math Toolbx)*y), x)^2*y), y, sqrt(Symbolic Math Toolbx)), x)^2), x), 1, 2) Warning: Ex)plicit integral could not be found. F2 =(Symbolic Math Toolb14912*2^(Symbolic Math Toolb1/4))/4641 - (Symbolic Math Toolb6072064*2^(Symbolic Math Toolb1/2))/348b 075 + (Symbolic Math Toolb64*2^(Symbolic Math Toolb3/4))/225 + 1610027357/6563700 VF2=vpa(Symbolic Math ToolbF2) % 32

VF2 = 224.921535733311431597907100328b 05 48b 2.3-12 r=a*(a>0)a>0) =0 a=1, 2 2 2 L ( x ' ) ( y ' ) 0r cos , y r sin ,ddl ( x ' )2 ( y ' ) 2 d

x : syms a r theta phi r=a*theta; x)=r*cos(Symbolic Math Toolbtheta); y=r*sin(Symbolic Math Toolbtheta); dLdth=sqrt(Symbolic Math Toolbdiff(Symbolic Math Toolbx),theta)^2+diff(Symbolic Math Toolby,theta)^2); L=simple(Symbolic Math Toolbint(Symbolic Math ToolbdLdth,theta,0,phi)) L =(Symbolic Math Toolbphi*(Symbolic Math Toolba^2*phi^2 + a^2)^(Symbolic Math Toolb1/2) + log(Symbolic Math Toolbphi + (Symbolic Math Toolbphi^2 + 1)^(Symbolic Math Toolb1/2))*(Symbolic Math Toolba^2)^(Symbolic Math Toolb1/2))/2 L_2pi=subs(Symbolic Math ToolbL,[a,phi],sym(Symbolic Math Toolb'[1,2*pi]')) L_2pi_vpa=vpa(Symbolic Math ToolbL_2pi) L_2pi_vpa =21.256294148209098800702512272566 x = cos( ) (log( + ( 2 + 1)1/2)/2 + ( ( 2 + 1)1/2)/2), y = sin( ) (log( + ( 2 + 1)1/2)/2 + ( ( 2 + 1)1/2)/2 2.3-12 r = a* 4 2 0 x r cos , y r sin -2

y -4 -6 L =(Symbolic Math Toolbphi*(Symbolic Math Toolba^2*phi^2 + a^2)^(Symbolic Math Toolb1/2) + log(Symbolic Math Toolbphi + (Symbolic Math Toolbphi^2 + 1)^(Symbolic Math Toolb1/2))*(Symbolic Math Toolba^2)^(Symbolic Math Toolb1/2))/2 -8 -10 -12 -14 -16 L1=subs(Symbolic Math ToolbL,a,sym(Symbolic Math Toolb'1')); ezplot(Symbolic Math ToolbL1*cos(Symbolic Math Toolbphi),L1*sin(Symbolic Math Toolbphi),[0,2*pi]) grid on; hold on x)1=subs(Symbolic Math Toolbx),a,sym(Symbolic Math Toolb'1')); y1=subs(Symbolic Math Toolby,a,sym(Symbolic Math Toolb'1')); h1=ezplot(Symbolic Math Toolbx)1,y1,[0,2*pi]); set(Symbolic Math Toolbh1,'Color','r','LineWidth',5) title(Symbolic Math Toolb' '); legend(Symbolic Math Toolb' - ',' ') hold off -5

0 5 10 x P198b 15 20 2.4 2.4.1 2.4.2 S=dslove(eq1,eq2,,eqn, cond1,cond2,,condn,v)

t y Dny y n y(Symbolic Math Toolba)=b, Dy(Symbolic Math Toolbc)= Dy S.y d S=dslove(eq1,eq2,,eqn,cond1,cond2,,condn,v) 1 t 2 y Dny y n 3 y (a>0)a)=b, Dy(a>0)c)=d 4 y S.y 2.4.3

dx dy x 2.4-1 y , dt dt clear S=dsolve('Dx=y,Dy=-x') disp([' ', blanks(2),'x',blanks(22),'y']) disp([S.x,S.y]) S= x: [1x1 sym] y: [1x1 sym] x y [ C2*cos(t) + C1*sin(t), C1*cos(t) - C2*sin(t)] [x), y]= dsolve('Dx=y,Dy=-x')

% 2.4-2. y=xy'-(a>0)y')2 clear all y=dsolve('(Dy)^2-x*Dy+y=0','x') y = x^2/4 C3*x - C3^2 clf, hold on hy1=ezplot(y(1),[-6,6,-4,8],1); set(hy1,'Color','r','LineWidth',5) for k=-2:0.5:2 y2=subs(y(2),'C3',k); ezplot(y2,[-6,6,-4,8],1) end hold off;box on legend(' ',' ','Location','Best') ylabel('y') title(['\fontsize{14} ',' (y '')^2 xy '' + y = 0 ',' ']) P199 2.4-3. : xy-3y=x2,y(a>0)1)=0,y(a>0)5)=0 y=dsolve('x*D2y-3*Dy=x^2','y(1)=0,y(5)=0','x') y =(31*x^4)/468 - x^3/3 + 125/468

ezplot(y,[-1,6]) hold on plot([1,5],[0,0],'.r','MarkerSize',20) text(1,1,'y(1)=0') text(4,1,'y(5)=0') title(['x*D2y-3*Dy=x^2',', y(1)=0,y(5)=0']) hold off 2.5 2.5.1 Fourier Fw=fourier(ft,t,w) ft Fourier ft=ifourier(Fw,w,t) Fw Fourier 2.5.2 Laplace Fs=laplace(ft,t,s) ft Laplace ft=ilaplace(Fs,s,t) Fs Laplace 2.5.3 Z

FZ=ztrans(ft,n,z) ft Z fn=itrans(FZ,z,n) FZ Z 2.5.4 1 f (t ) 0 1 Fourier syms t w ut=heaviside(t); UT=fourier(ut) UT = pi*dirac(w)-i/w 2 Fourier Ut=ifourier(UT,w,t) Ut =heaviside(t) 3 t=-2:0.01:2;

ut=heaviside(t); kk=find(t==0); 1 Heaviside(t) t 0 Fourier t 0 plot(t(kk),ut(kk),'.r','MarkerSize',30) ut(kk)=NaN; hold on plot(t,ut,'-r','LineWidth',3) plot([t(kk),t(kk)],[ut(kk-1), ut(kk+1)],'o r','MarkerSize',10) hold off t grid on axis([-2,2,-0.2,1.2]) xlabel('\fontsize{14}t'),ylabel('\fontsize {14}ut') title('\fontsize{14}Heaviside(t)') 0.8

0.6 ut 2.5-1 0.4 0.2 0 -0.2 -2 -1.5 -1 -0.5 0 0.5

1 1.5 2 2.5-4 (t a) u (t b) e at sin bt t 2 e t Laplace >> syms t s; syms a b positive; % >> Dt=dirac(t-a); >> Ut=heaviside(t-b); >> Mt=[Dt,Ut;exp(-a*t)*sin(b*t),t^2*exp(-t)]; >> MS=laplace(Mt,t,s) MS = [ exp(-s*a),

[ 1/b/((s+a)^2/b^2+1), exp(-s*b)/s] 2/(s+1)^3] review 2.3.1 limit(f,v,a) lim f (v) limit(f,v,a,right) lim f (v) limit(f,v,a,left)

v a v a lim f (v) v a n dfdvn=diff(f,v,n) r=taylor(f,n,v,a) d f (v ) n dv f(v) v=a 2.3.2 / b f (v )

v a s=symsum(f,v,a,b) review 2.3.3 intf=int(f,v) f v intf=int(f,v,a,b) f v 2.4.2 S=dslove(eq1,eq2,,eqn, cond1,cond2,,condn,v) t

y Dny y n y(Symbolic Math Toolba)=b, Dy(Symbolic Math Toolbc)= Dy S.y d S=dslove(eq1,eq2,,eqn,cond1,cond2,,condn,v) 2.4-2. y=xy'-(a>0)y')2 clear all y=dsolve('(Dy)^2-x*Dy+y=0','x') clf, hold on hy1=ezplot(y(1),[-6,6,-4,8],1); set(hy1,'Color','r','LineWidth',5) for k=-2:0.5:2 y2=subs(y(2),'C3',k); ezplot(y2,[-6,6,-4,8],1) end hold off;box on legend( , ,Location,Best) % ylabel('y') title(['\fontsize{14} ',' (y '')^2 xy '' + y = 0 ',' ']) legend(' ',' ','Location','northwest') legend(' ',' ','Location', [0.4,0.6,0.3,0.1]') docsearch legend Location %

legend(...,'Location','location') location can be either a 1-by-4 position vector ([left bottom width height]) or one of the following strings. Specifier North South East West NorthEast NorthWest SouthEast SouthWest NorthOutside SouthOutside EastOutside WestOutside NorthEastOutside NorthWestOutside SouthEastOutside SouthWestOutside Best Location in Axes Inside plot box near top

Inside bottom Inside right Inside left Inside top right (default for 2-D plots) Inside top left Inside bottom right Inside bottom left Outside plot box near top Outside bottom Outside right Outside left Outside top right (default for 3-D plots) Outside top left Outside bottom right Outside bottom left Least conflict with data in plot P199 2.6 2.6.1 det(A) diag(A) [V,D]=eig(A)

expm(A) e^A inv(A) [V,J]=jordan(A) Jordan AV=VJ poly(A) rank(A) 2.6.1 a11 a12 A 2.6-1 a21 a22 syms a11 a12 a21 a22 A=[a11, a12; a21, a22] DA=det(A) IA=inv(A) A =[ a11, a12] [ a21, a22] DA =a11*a22 - a12*a21 IA =[ a22/(a11*a22 - a12*a21), -a12/(a11*a22 - a12*a21)] [ -a21/(a11*a22 - a12*a21), a11/(a11*a22 - a12*a21)]

EA=subexpr(eig(A),'D') D = (a11^2 - 2*a11*a22 + a22^2 + 4*a12*a21)^(1/2) EA = a11/2 + a22/2 - D/2 a11/2 + a22/2 + D/2 cos t sin t 2.6-2 Givens G sin t cos t 3/2 A 1/ 2 1/ 2 3 / 2( X x cos t y sin t ) . Y x sin t y cos t : syms t; A=sym([sqrt(3)/2,1/2;1/2,sqrt(3)/2]); % G=[cos(t),-sin(t);sin(t),cos(t)]; GA=G*A

An=subs(GA,t,110/180*pi); % Op=[0;0]; Ad=double(A); % v1=[Op,Ad(:,1)]', v2=[Op,Ad(:,2)]' % u1=[Op,An(:,1)]', u2=[Op,An(:,2)]' % plot(v1(:,1),v1(:,2),'--k',v2(:,1),v2(:,2),'b'), hold on hu=plot(u1(:,1),u1(:,2),'--k',u2(:,1),u2(:,2),'b') set(hu,'LineWidth',4) Lstr=[' v1';' v2';' u1';' u 2']; legend(Lstr,'Location','South') axis([-1,1,-1,1]), axis square, hold off, grid on 2.6.2 4.2 , matlab , , . d n p q 2 2 n d q p 10 2.6-3 n q d p 4 q p - n - 8d 1

A=sym(Symbolic Math Toolb[1,1/2,1/2 , -1; 1, 1, -1,1; 1, -1/4, -1,1; -8b , -1, 1, 1]); b=sym(Symbolic Math Toolb[0; 10; 0; 1]) X= 1 8 x)=A\b 8 9 A=[1,1/2,1/2 , -1; 1, 1, -1,1; 1, -1/4, -1,1; -8b , -1, 1, 1]; X=1.0000 b=[0; 10; 0; 1]; 8.0000 8.0000 x)=A\b 9.0000 2.6.3 ( Linear ) ( Nonlinear ) ( Transcendental equation ) S =solve('eq1','eq2',...,'eqN','v1','v2',...'vn') ( )

S =solve(exp1, exp2,..., expN, v1, v2,... vn) ( ) d n p q 2.6-3 syms d n p q eq1= d+n/2+p/2-q ; eq2= d+n-p+q-10 ; eq3= d-n/4-p+q ; eq4= -8b *d-n+p+q-1 ; S=solve(Symbolic Math Toolbeq1,eq2,eq3,eq4, d , n , p , q ); disp(Symbolic Math Toolb[' d',' n',' p',' q']) disp(Symbolic Math Toolb[S.d,S.n,S.p,S.q]) 2 2 n d q p 10 n q d p 4 q p - n -8d 1 d n pq [ 1, 8b , 8b , 9] 2.6.3 2.6-3

eq1=sym(Symbolic Math Toolb'd+n/2+p/2-q'); eq2=sym(Symbolic Math Toolb'd+n-p+q-10'); eq3=sym(Symbolic Math Toolb'd-n/4-p+q'); eq4=sym(Symbolic Math Toolb'-8b *d-n+p+q-1'); S=solve(Symbolic Math Toolbeq1,eq2,eq3,eq4,'d','n','p','q'); disp(Symbolic Math Toolb[' d',' n',' p',' q']) disp(Symbolic Math Toolb[S.d,S.n,S.p,S.q]) n p d 2 2 q n d q p 10 n q d p 4 q p - n -8d 1 d n pq [ 1, 8b , 8b , 9]

uy ^ 2 vz w y,z0 2.6-4 y z w 0 S=solve(Symbolic Math Toolb'u*y^2+v*z+w=0','y+z+w=0','y','z') disp(Symbolic Math Toolb'S.y'), disp(Symbolic Math ToolbS.y), disp(Symbolic Math Toolb'S.z'), disp(Symbolic Math ToolbS.z) S= y: [2x)1 sym] z: [2x)1 sym] S.y (Symbolic Math Toolbv + 2*u*w + (Symbolic Math Toolbv^2 + 4*u*w*v - 4*u*w)^(Symbolic Math Toolb1/2))/(Symbolic Math Toolb2*u) - w (Symbolic Math Toolbv + 2*u*w - (Symbolic Math Toolbv^2 + 4*u*w*v - 4*u*w)^(Symbolic Math Toolb1/2))/(Symbolic Math Toolb2*u) - w S.z -(Symbolic Math Toolbv + 2*u*w + (Symbolic Math Toolbv^2 + 4*u*w*v - 4*u*w)^(Symbolic Math Toolb1/2))/(Symbolic Math Toolb2*u) -(Symbolic Math Toolbv + 2*u*w - (Symbolic Math Toolbv^2 + 4*u*w*v - 4*u*w)^(Symbolic Math Toolb1/2))/(Symbolic Math Toolb2*u) S=solve(Symbolic Math Toolb'u*y^2+v*z+w=0','y+z+w=0', 'z', 'y') S=solve(Symbolic Math Toolb'u*y^2+v*z+w','y+z+w', 'z,y') syms y z u v w; S=solve(Symbolic Math Toolbu*y^2+v*z+w,y+z+w, z,y) [y, z]=solve(Symbolic Math Toolbu*y^2+v*z+w,y+z+w, z,y) %

n p 2.6-5 d q 2 2 n d q p 10 syms d n p q n eq1=d+n/2+p/2-q; q d p 4 eq2=n+d+q-p-10; eq3=q+d-n/4-p; S=solve(eq1,eq2,eq3,d,n,p,q) disp([' S.d',' S.n',' S.p',' S.q']) disp([S.d,S.n,S.p,S.q]) S = d: [1x1 sym]

n: [1x1 sym] p: [1x1 sym] q: [1x1 sym] S.d S.n S.p S.q [z/3 - 2, 8b , (Symbolic Math Toolb4*z)/3 - 4, z ] n p n 2.6-5 d q, n d q p 10, q d p 2 2 4 : syms d n p q eq1=d+n/2+p/2-q; eq2=n+d+q-p-10; eq3=q+d-n/4-p; S=solve(eq1,eq2,eq3) disp([' S.n',' S.p',' disp([S.n,S.p,S.q]) S = n: [1x1 sym] p: [1x1 sym]

q: [1x1 sym] S.n S.p S.q [8, 4*d+4, 3*d+6] S.q']) : : . 2.6-6 (Symbolic Math Toolbx)+2)x)=2 syms x); s=solve(Symbolic Math Toolb'(Symbolic Math Toolbx)+2)^x)=2', 'x)') x)s=(Symbolic Math Toolbs(Symbolic Math Toolb1)+2)^s(Symbolic Math Toolb1) s= 0.69829942170241042826920133106081 xs = 2.0 s MuPAD Mu PAD x)s=(Symbolic Math Toolbs+2)^s matlab 2.7. 2.7.1

2.8 1. 2. 2.8.1 Maltlab , ez plot, "ez" (a>0)ez Easy to) 2.8-1 2.8 2.8.1 (a>0)ez Easy to) ezcontour ezcontour('cos(x+sin(y))-sin(y)')

ezcontourf ezcontourf('sin(x)*sin(y)') ezmesh ezmesh('exp(-s)*cos(t)','exp(-s)*sin(t)','t',[0,8,0,4*pi]) ezmeshc ezmeshc('y/(1+x^2+y^2)',[-5,5,-2*pi,2*pi]) ezplot ezplot('1/y-log(y)+log(-1+y)+x-1') ezplot3

ezplot3('sin(3*t)*cos(t)','sin(3*t)*sin(t)','t','animate') ezpolar ezpolar('sin(tan(t))') ezsurf ezsurf('(x+8)*((y)^2/((x+8)^2+(y)^4+eps))','circ') ezsurfc ezsurfc('sin(x)*sin(y)') 2.8.1 1. ezplot(Fx) x=[-2 2]*pi f(a>0)x) ezplot(Fx,[xmin,xmax,ymin,ymax])

y=f(a>0)x) ezplot(Fxy,[xmin,xmax,ymin,ymax],fig) f(a>0)x,y)=0 ezplot(xt,yt,[tmin,tmax]) x=x(a>0)t),y=y(a>0)t) ezplot(xt,yt, zt,[tmin,tmax]) x=x(a>0)t),y=y(a>0)t),z=x(a>0)t) Fx, Fxy,xt,yt,zt , , , , M . : plot(x, y) %x,y (2 cos((31/2 t)/2))/(3 exp(t/2)) 2.8-1 2 y e 3 t 2 cos 0.6

0.4 t 3 ts(0 t ) y (t )dt[0,4 ]. 2 0 -0.2 0.2 0 2 4 syms t tao; y=2/3*exp(-t/2)*cos(sqrt(3)/2*t); sint=int(y,t,0,tao); s=subs(sint,tao,t) subplot(2,1,1),ezplot(y,[0,4*pi]);grid on subplot(2,1, 2),ezplot(s,[0,4*pi]);grid on title('s= \int y(t)dt')

6 8 10 12 8 10 12 t s = y(t)dt 0.5 0.4 0.3 0.2 0 P199

2 4 6 t 2. ezsurf(Fxy) f(x,y) x y [-2,2] ezsurf(Fxy,domain) f(x,y) x y domain domain [xmin,xmax,ymin,ymax] [min,max] min

clf x='cos(s)*cos(t)'; y='cos(s)*sin(t)'; z='sin(s)'; ezsurf(x,y,z,[0,pi/2,0,3*pi/2]) view(17,40) shading interp colormap(spring) light('position',[0,0,-10],'style','local') light('position',[-1,-0.5,2],'style','local') material([0.5,0.5,0.5,10,0.3]) 2.8.2 2 2.8-3 y f ( x ) 1 x 1 e plot 0.9

0.8 0.7 clear; syms x y real fx=1-2/(1+exp(x)); fxint=int(fx,x,0,x) 0.6 0.5 fx)int = log(Symbolic Math Toolb(Symbolic Math Toolbex)p(Symbolic Math Toolbx)) + 1)^2/4) - x) 0.4 f(x) 0.3 x f(x) dx 0 0.2 xk=0:0.1:2; fxk=subs(fx,x,xk);

fxintk=subs(fxint,x,xk); plot(xk,fxk,'g',xk,fxintk,'r','LineWidth',2.5) title(' ' ) xlabel('x') legend('f(x)','\int^x_0 f(x) dx','Location','best') 0.1 0 0 0.2 0.4 0.6 0.8 1 x 1.2 1.4

1.6 1.8 2 P199 2 2.8-3 y f ( x ) 1 x 1 e clear; syms x y real;fx=1-2/(1+exp(x)); 0.7 0.6 0.5 gy=subs(Symbolic Math Toolbfinverse(Symbolic Math Toolbfx)),x),y) % 0.43 gyint=int(Symbolic Math Toolbgy,y,0,y) 0.3

gy =log(Symbolic Math Toolb-(Symbolic Math Toolby + 1)/(Symbolic Math Toolby - 1)) gyint =piecewise(Symbolic Math Toolb[y < 1, log(Symbolic Math Toolb1 - y^2) 0.2+ y*log(Symbolic Math Toolby + 1) - y*log(Symbolic Math Toolb1 - y)], [1 <= y, 0.1 log(Symbolic Math Toolby^2 - 1) + y*log(Symbolic Math Toolb -(Symbolic Math Toolby + 1)/(Symbolic Math Toolby - 1)) - pi*i]) gf=simplify(Symbolic Math Toolbsubs(Symbolic Math Toolbgy,y,fx))) % 0 4 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 gf =x) y yk=subs(Symbolic Math Toolbfx),x),x)k); % 5 gyintk=subs(Symbolic Math Toolbgyint,y,yk); GYintk=x)k.*fx)k-fx)intk; % fx)k, fx)intk x) 0:0.1:2 fx) plot(Symbolic Math Toolbyk,gyintk,r,LineWidth,5); hold on plot(Symbolic Math Toolbyk,GYintk,'+k'); hold off; x)label(Symbolic Math Toolb'y') legend(Symbolic Math Toolb' ', ' ','locatio n','best')

2 y f ( x ) 1 2.8-3 1 ex plot(Symbolic Math Toolbx)k,fx)k,'-og',x)k,fx)intk,'r','LineWidth',2.5) hold on plot(Symbolic Math Toolbx)k,gyintk,'b','LineWidth',5) hold on plot(Symbolic Math Toolbx)k,x)k.*fx)k,'k','LineWidth',5) hold on plot(Symbolic Math Toolbx)k,fx)intk+gyintk,'ok','LineWidth',5) legend(Symbolic Math Toolb'f(Symbolic Math Toolbx))','\int^x)_0 f(Symbolic Math Toolbx)) dx)',' ', ' +

',' ','location','best') % syms y x z=int(x*y,x,0,1); g = evalin(symengine,[' piecewise([y > 1/2,' char(z) '], [y <= 1/2, 1])']) G=int(g,y) g= piecewise([1/2 < y, y/2], [y <= 1/2, 1]) G= piecewise([1/2 < y, y^2/4], [y <= 1/2, y]) 2 (Page114) 3,4,5,6,7,8,11,12, 23,25

Recently Viewed Presentations

  • The English Sonnet

    The English Sonnet

    Listen to/Read Shakespeare's "Sonnet " Grab a partner and… Annotate the poem for rhyme scheme. What do you notice about the poem's rhythm? What do you notice about the syllables in each line? What do you notice about punctuation? How...
  • crystallography ll Lattice n-dimensional, infinite, periodic array of

    crystallography ll Lattice n-dimensional, infinite, periodic array of

    crystallography ll 晶体学 Choosing unit cells in a lattice Want very small unit cell - least complicated, fewer atoms Choosing unit cells in a lattice Sometimes, a good unit cell has more than one lattice point 2-D example: Choosing unit...
  • WebTrain - What is it really?

    WebTrain - What is it really?

    WebTrain - What is it really? WebTrain is a new programming language for the WWW that has been specifically designed for education and training applications. Why build a new language? Learning management systems have mainly been built using existing WWW...
  • Akamai Content Delivery Network Slides from Bruce Maggs

    Akamai Content Delivery Network Slides from Bruce Maggs

    Arial Arial Narrow Arial Black Symbol Blank Presentation 1_Blank Presentation Microsoft Photo Editor 3.0 Photo Akamai Content Delivery Network HTML Title Page for www.xyz.com with Embedded Objects Downloading www.xyz.com - before Akamai DNS Resolution Problems with the Centralized Approach The...
  • Instructions for Lab-14 - users.cs.jmu.edu

    Instructions for Lab-14 - users.cs.jmu.edu

    Instructions for Lab-14 CS-139, Sections 3 & 4 Fall 2001 Lab-14 Write a program that performs the following operations: Queries a traveler for ticket purchase Lake Woebegone, Minnesota to Oshkosh, Wisconsin: which class does traveler want to fly?
  • How to Understand and Apply the Old Testament

    How to Understand and Apply the Old Testament

    7. WORD AND CONCEPT STUDIES. The Need for Word and Concept Studies. An Overview of Word Study Tools. Principles for Doing Word and Concept Studies. How to Do a Word or Concept Study
  • Common Core State Standards - Moore Public Schools

    Common Core State Standards - Moore Public Schools

    While the Common Core State Standards are a critical first step, they alone will not bring about the instructional changes necessary to improve student achievement and attainment. Creating common assessments grounded in common standards is the logical next step
  • National Solar Energy & Your Dream Houses (Nang

    National Solar Energy & Your Dream Houses (Nang

    Energy from hydro-power was about 58.6 billion kWh (in 2013) & 62.5 billion kWh (in 2014) ... - Cost of rebuild and deaths of people from accidents of dam collapse and water release from dam with bad management. ... Diagram...