>> ch5_symbolic s1 = sym('x^3-1') s1 = x^3-1 factor(s1) % factor the polynomial ans = (x-1)*(x^2+x+1) pause % hit the carriage return when ready to continue s2 = sym('(x-3)^2 + (y-4)^2') s2 = (x-3)^2 + (y-4)^2 expand(s2) % multiply all the terms out ans = x^2-6*x+25+y^2-8*y pause % hit the carriage return when ready to continue collect(s2) % collect is "kinda" the opposite of "expand" ans = x^2-6*x+9+(y-4)^2 pause % hit the carriage return when ready to continue collect(s2,'y') % the default is to focus on "x", you can force "y" ans = y^2-8*y+(x-3)^2+16 pause % hit the carriage return when ready to continue s3 = sym('sqrt(a^4*b^7)') s3 = sqrt(a^4*b^7) simplify(s3) ans = (a^4*b^7)^(1/2) pause % hit the carriage return when ready to continue s4 = sym('14*x^2/(22*x*y)') s4 = 14*x^2/(22*x*y) simplify(s4) ans = 7/11*x/y pause % hit the carriage return when ready to continue diff(s1) ans = 3*x^2 pause % hit the carriage return when ready to continue diff(s2,'x') %differentiate w.r.t. x ans = 2*x-6 pause % hit the carriage return when ready to continue diff(s2,'y') %differentiate w.r.t. y ans = 2*y-8 pause % hit the carriage return when ready to continue diff(s1,2) % return 2nd derivative ans = 6*x pause % hit the carriage return when ready to continue int('sin(a)') ans = -cos(a) pause % hit the carriage return when ready to continue int(s1,0.0,2.0) % integrate from x=0 to x=2 ans = 2 pause % hit the carriage return when ready to continue taylor(s2) ans = 9+(y-4)^2-6*x+x^2 help taylor % series are powerful --- help for sym/taylor.m --- TAYLOR Taylor series expansion. TAYLOR(f) is the fifth order Maclaurin polynomial approximation to f. Three additional parameters can be specified, in almost any order. TAYLOR(f,n) is the (n-1)-st order Maclaurin polynomial. TAYLOR(f,a) is the Taylor polynomial approximation about point a. TAYLOR(f,x) uses the independent variable x instead of FINDSYM(f). Examples: taylor(exp(-x)) returns 1-x+1/2*x^2-1/6*x^3+1/24*x^4-1/120*x^5 taylor(log(x),6,1) returns x-1-1/2*(x-1)^2+1/3*(x-1)^3-1/4*(x-1)^4+1/5*(x-1)^5 taylor(sin(x),pi/2,6) returns 1-1/2*(x-1/2*pi)^2+1/24*(x-1/2*pi)^4 taylor(x^t,3,t) returns 1+log(x)*t+1/2*log(x)^2*t^2 See also FINDSYM, SYMSUM. >> quit 9426 flops.