# # 5.1 Defining functions # # # # MAPLE SESSION 1 # > f:= x -> x^2 - 3*x + 5; # # # MAPLE SESSION 2 # > f(2); # # # MAPLE SESSION 3 # > g := (x,y) -> x*y/(1+x^2+y^2); # # # MAPLE SESSION 4 # > g(sin(t),cos(t)); > simplify(%); # # # MAPLE SESSION 5 # > q := Z^5+3*Z^4-12*Z^3-35*Z^2 > +42*Z+119: > h := unapply(q,Z); # # # MAPLE SESSION 6 # > H := x -> evalf( h(x), 4): > X := [seq(evalf(-4+i/10,4),i=0..10)]; > Y := map(H,X); # # 5.2 Composition of functions # # # # MAPLE SESSION 7 # > (sin@cos)(x); > f := x -> x^2: > g := x -> sqrt(1-x): > (f@g)(x); > (g@f)(x); # # 5.3 Summation and product # # # # MAPLE SESSION 8 # > f := 'f': > Sum(f(i),i=1..n); > Sum(i^2,i=1..10); > sum(i^2,i=1..10); # # # MAPLE SESSION 9 # > Sum(i^2,i=1..10); > value(%); > sum(i^2,i=1..n); > factor(%); # # # MAPLE SESSION 10 # > f := 'f': q := 'q': > Product(f(i),i=1..n); > Product(1-q^i,i=1..5); > value(%); > expand(%); # # # MAPLE SESSION 11 # > i:=2; > sum(i^3,i=1..5); # # # MAPLE SESSION 12 # > sum('i'^3,'i'=1..5); # # 5.4 Limits # # # # MAPLE SESSION 13 # > Limit((x^2-4)/(x-2),x=2); value(%); # # # MAPLE SESSION 14 # > f:=(x^2-4)/(x^2-5*x+6); > Limit(f,x=3,right); value(%); > Limit(f,x=infinity); value(%); # # 5.5 Differentiation # # # # MAPLE SESSION 15 # > f := sqrt(1 - x^2); > diff(f,x); > g := z -> z^2*exp(z) + sin(log(z)): > diff(g(x),x); # # # MAPLE SESSION 16 # > z := exp(x*y)*(1+sqrt(x^2+3*y^2-x)); > diff(z,x); > normal(diff(z,x,y)-diff(z,y,x)); # # # MAPLE SESSION 17 # > g := z -> z^2*exp(z) + sin(z); > D(g); # # 5.6 Extrema # # # # MAPLE SESSION 18 # > maximize(sin(x)); > maximize(sin(x)+cos(x)); > maximize(x^2-5*x+1,x=0..3); > maximize(sin(x),x=0..1); > maximize(sin(x)+cos(x),x=0..1); > maximize(sin(x)+cos(x),x=0..1/2); # # # MAPLE SESSION 19 # > minimize(x^2+y^2); > minimize(x^2+y^2,x); # # # MAPLE SESSION 20 # > readlib(extrema): # # # MAPLE SESSION 21 # > f := 2*x^2 + y + y^2; > g := x^2 + y^2 - 1; > extrema(f,{g},{x,y},'s'); > s; > simplify(subs(s[1],f)); > simplify(subs(s[2],f)); > simplify(subs(s[3],f)); # # 5.7 Integration # # # # MAPLE SESSION 22 # > Int(x^2/sqrt(1-x^3),x); > value(%); > Int(1/x/sqrt(x^2 - 1),x=1..2/sqrt(3)); > value(%); # # # MAPLE SESSION 23 # > Int(sqrt(1+x^6),x=0..1); > value(%); > evalf(%); # # 5.7.1 Techniques of integration # 5.7.1.1 Substitution # # # # MAPLE SESSION 24 # > with(student): > G:=Int(x^4/sqrt(1-x^10),x); > changevar(u=x^5,G,u); > G2 := value(%); > subs(u=x^5,G2); > diff(%,x); # # # MAPLE SESSION 25 # > G:=Int((3*x^2+1)/sqrt((1-x-x^3)*(1+x+x^3)),x); > value(G); # # # MAPLE SESSION 26 # > radsimp(changevar(u=x+x^3,G,u)); # # 5.7.1.2 Integration by parts # # # # MAPLE SESSION 27 # > with(student): > Int(x*cos(3*x),x); > intparts(%,x); > value(%); # # 5.7.1.3 Partial fractions # # # # MAPLE SESSION 28 # > rat := (4*x^4+9*x^3+12*x^2+9*x+4) > /(x + 1)/(x^2 + x + 1)^2: > convert(rat,parfrac,x); > int(%,x); # # 5.8 Taylor and series expansions # # # # MAPLE SESSION 29 # > y := 1/sqrt(1-x); > taylor(y,x=0,5); # # # MAPLE SESSION 30 # > J := product(1-x^'i','i'=1..50): > taylor(J^3,x=0,20); > coeff(%,x,15); # # 5.9 The student package # # # # MAPLE SESSION 31 # > with(student): > p := x^2 + 6*x + 13; > completesquare(p); > q := x^2 + 10*x + 2*y^2 + 12*y + 12; > completesquare(q); > completesquare(q,x); > completesquare(%,y); # # # MAPLE SESSION 32 # > with(student): > distance(-3,5); > distance([1,2],[-3,4]); # # # MAPLE SESSION 33 # > with(student): > equate(x,y); > equate([x+y,x-y],[3,-1]); > solve(%); # # # MAPLE SESSION 34 # > with(student): > F := Int(sin(x^3*y),x=0..2*Pi); > integrand(F); # # # MAPLE SESSION 35 # > with(student): > intercept(y=5*x-3); > intercept(y=x^2+3*x-20,y=2*x^2+x-23); # # # MAPLE SESSION 36 # > with(student): > leftbox(sin(x^2), x=0..Pi, 6, shading=green); # # # MAPLE SESSION 37 # > with(student): > leftsum(sin(x^2), x=0..Pi, 6); > value(%); > evalf(%); > evalf(int(sin(x^2),x=0..Pi)); # # # MAPLE SESSION 38 # > with(student): > y := x^2 + x - 3; > f := makeproc(y,x); > f(x); # # # MAPLE SESSION 39 # > with(student): > f := makeproc([-1,1],[3,7]); > f(-1), f(3); # # # MAPLE SESSION 40 # > with(student): > f := makeproc([2,5],'slope'=3); > f(2); > diff(f(x),x); # # # MAPLE SESSION 41 # > with(student): > midpoint([2,3],[5,7]); # # # MAPLE SESSION 42 # > with(student): > showtangent(sin(x),x=Pi/4); # # # MAPLE SESSION 43 # > with(student): > simpson(1/sqrt(1+x^4),x=0..1,12): > value(%): > app := evalf(%); > xval := evalf(int(1/sqrt(1+x^4),x=0..1)); > abs(app-xval); # # # MAPLE SESSION 44 # > with(student): > slope(y=2*x-5); > slope(2*y+12=3*x); > slope(2*y+12=3*x,y(x)); > slope([12,5],[3,7]); # # # MAPLE SESSION 45 # > with(student): > z3 := Sum(1/n^3,n=1..infinity); > summand(z3); # # # MAPLE SESSION 46 # > with(student): > trapezoid(1/sqrt(1+x^4),x=0..1,12): > value(%): > app := evalf(%); > xval := evalf(int(1/sqrt(1+x^4),x=0..1)); > abs(app-xval);