# 1. length(1000!); # 2. evalf(exp(1),50); # or: Digits:=50; evalf(exp(1)); # 3. expand(cos(Pi/6)); evalf(%); expand(ln(2*e)); expand(arctan(sqrt(3)+2)); # 4. use ifactor. # 5. h:=(x^5-3*x^4-4*x^3-11*x^2+6*x-11)/(x^5-5*x^4+4*x^3-x^2+5*x-4); f:=numer(h); g:=denom(h); d:=gcd(f,g); quo(f,d,x); quo(g,d,x); # or normal(f/d); normal(g/d); normal(h); convert(h,'parfrac',x); # 6. f:=exp(-x^2); diff(f,x); int(ln(x),x); diff(h,x); int(h,x); # 7. taylor(sin(x),x=0,10); taylor(exp(x),x=0,20); f:=1/(1-x-x^2); taylor(f,x=0,20); # coeffs = fibonacci numbers. # 8. solve(a*x^2+b*x+c, {x}); fsolve(x^8+x^3-x^2-1,x); fsolve(x^8+x^3-x^2-1,x,complex); # 9. A:=matrix(4,4,[1,0,1,0,1,1,1,1,0,1,1,1,0,0,0,1]); B:=matrix(4,4,[1,0,1,0,1,1,1,1,0,1,1,1,1,0,0,1]); with(linalg); det(A); det(B); evalm(A^(-1)); # or inverse(A); evalm(A &* B); # Note: in Maple the asterisk * is always # a commutative multiplication, so for # matrix multiplication we need &* # # Also note, in newer versions of Maple there is # also the LinearAlgebra package. # 10. A:=matrix(4,4,[x,seq(i,i=2..15),y]); solve( det(A) ); # 11. A:=matrix(4,4,[-12,12,4,0,4,4,4,4,-40,4,4,4,21,0,0,4]); evalm(A^4); charpoly(A,lambda); # If you didn't already, then do with(linalg); first. # 12. N := 4; A := matrix(N,N,[seq(seq( (x||i)^j ,j=0..N-1),i=0..N-1)]); # # REMARK: Maple turns something like x||3 into x3. So the || can be # used to have N variables with different names. # # A is a Vandermonde matrix. Note that if x.i = x.j # then A has two equal rows and hence then det(A)=0. So # (x.i-x.j) must be a factor of det(A) for all i <> j. # This explains why the following comes out the way it does: factor(det(A)); # 17. # # REMARK: In Maple, if you want to use an unusual variable name # such as the name: iszero? # (this name is unusual because it has a question mark in it). # then you have to put quotes ` ... ` around it, otherwise Maple # will complain (i.e. give an error message). # `iszero?`:=4*arctan(1/5)-arctan(1/239)-Pi/4; evalf(`iszero?`); # close to 0. expand(sin(`iszero?`)); # # result: 0. Hence `iszero?` is # a multiple of Pi, furthermore it is very close to zero # hence it can only be 0. # 19. p := 5; matrix(p-1,p-1,[seq(seq(i*j mod p,i=1..p-1),j=1..p-1)]); matrix(p-1,p-1,[seq(seq(i/j mod p,i=1..p-1),j=1..p-1)]); # 20. F:=proc(n::nonnegint) options remember; if n<2 then 1 else F(n-1)+F(n-2) fi end; FF:=proc(n::nonnegint) expand( ( ((1+sqrt(5))/2)^(n+1) - ((1-sqrt(5))/2)^(n+1) )/sqrt(5)) end: