<HTML><BODY BGCOLOR="ffffff"><PRE><font size=4> An assorted selection of the tests found in the Wester benchmark 1. <font color=0000ff>Compute 50!</font> : In> 50! <font color=ff0000> Out> 30414093201713378043612608166064768844377641568960512000000000000 </font> 2. <font color=0000ff>Compute the prime decomposition of 6!.</font> : In> ans:=Factors(6!) <font color=ff0000> Out> {{2,4},{5,1},{3,2}} </font> This list contains lists of two elements. This list should be interpreted as In> PrettyForm(FW(ans)) <font color=ff0000> 4 2 2 * 5 * 3 Out> True </font> 3. <font color=0000ff>Compute 1/2 + ... + 1/10.</font> : In> Sum(i,2,10,1/i) <font color=ff0000> Out> 4861/2520 </font> 4. <font color=0000ff>Compute a numerical approximation of e^(Pi*sqrt(163)) to 50 digits.</font> : In> Precision(50) <font color=ff0000></font>In> N(Exp(Pi*Sqrt(163))) <font color=ff0000> Out> 262537412640768743.99999999999925007259719818568885219682604177332393 </font> 5. <font color=0000ff>Compute an infinite decimal representation of 1/7</font> : In> Decimal(1/7) <font color=ff0000> Out> {0,{1,4,2,8,5,7}} </font> 6. <font color=0000ff>Compute the first terms of the continued fraction of Pi.</font> : In> PrettyForm(ContFrac(Pi())) <font color=ff0000> 1 3 + --------------------------- 1 7 + ----------------------- 1 15 + ------------------ 1 1 + -------------- 1 292 + -------- 1 + rest Out> True </font> 7. <font color=0000ff>Simplify sqrt(2*sqrt(3)+4).</font> : In> RadSimp(Sqrt(2*Sqrt(3)+4)) <font color=ff0000> Out> 1+Sqrt(3) </font> 8. <font color=0000ff>Simplify sqrt(14+3*sqrt(3+2*sqrt(5-12*sqrt(3-2*sqrt(2))))).</font> : In> RadSimp(Sqrt(14+3*Sqrt(3+2*Sqrt(5-12*Sqrt(3-2*Sqrt(2)))))) <font color=ff0000> Out> 3+Sqrt(2) </font> 9. <font color=0000ff>Simplify 2*infinity-3.</font> : In> 2*Infinity-3 <font color=ff0000> Out> Infinity </font> Infinity is also defined for comparisons like a < Infinity 10. <font color=0000ff>Compute the normal form of (x^2-4)/(x^2+4x+4).</font> : In> PrettyForm(GcdReduce((x^2-4)/(x^2+4*x+4),x)) <font color=ff0000> -2 + x ------ 2 + x Out> True </font> 11. <font color=0000ff>Expand (x+1)^5, then differentiate and factorize.</font> : In> ans:=Factors(D(x)Expand((x+1)^5)) <font color=ff0000></font>In> PrettyForm(FW(ans)) <font color=ff0000> 4 ( 1 + x ) * 5 Out> True </font> 12. <font color=0000ff>Simplify sqrt(997) - (997^3)^(1/6).</font> : In> RadSimp(Sqrt(997)-997^3^(1/6)) <font color=ff0000> Out> 0 </font> 13. <font color=0000ff>Simplify sqrt(999983) - (999983^3)^(1/6).</font> : In> RadSimp(Sqrt(999983)-999983^3^(1/6)) <font color=ff0000> Out> 0 </font> 14. <font color=0000ff>Recognize that (2^(1/3)+4^(1/3))^3-6*(2^(1/3)+4^(1/3)) - 6 is 0.</font> : In> RadSimp((2^(1/3)+4^(1/3))^3-6*(2^(1/3)+4^(1/3))-6) <font color=ff0000> Out> 0 </font> 15. <font color=0000ff>Simplify log e^z into z only for -Pi < Im(z) <= Pi.</font> : In> Simplify(Ln(Exp(z))) <font color=ff0000> Out> z </font> 16. <font color=0000ff>Invert the 2x2 matrix [[a,b],[1,ab]]. </font> : In> A:={{a,b},{1,a*b}} <font color=ff0000></font>In> ans:=Inverse(A) <font color=ff0000> Out> {{(a*b)/(b*a^2-b),(-b)/(b*a^2-b)},{-1/(b*a^2-b),a/(b*a^2-b)}} </font> In> TableForm(Simplify(ans)) <font color=ff0000> {1/(a+ -1/a),1/(1-a^2)} {1/(b-b*a^2),1/(b*a-b/a)} Out> True </font> 17. <font color=0000ff>Find the eigenvalues of the matrix [[5, -3, -7],[-2, 1, 2],[ 2, -3, -4]].</font> : In> A:={{5,-3,-7},{-2,1,2},{2,-3,-4}} <font color=ff0000></font>In> EigenValues(A) <font color=ff0000> Out> {1,3,-2} </font> 18. <font color=0000ff>Compute the limit of (1-cos x)/x^2 when x goes to zero. </font> : In> Limit(x,0)(1-Cos(x))/x^2 <font color=ff0000> Out> 1/2 </font> 19. <font color=0000ff>Compute the derivative of |x|.</font> : In> D(x)Abs(x) <font color=ff0000> Out> Sign(x) </font> 20. <font color=0000ff>Compute an antiderivative of |x|.</font> : In> AntiDeriv(Abs(x),x) <font color=ff0000> Out> (Abs(x)*x)/2 </font> 21. <font color=0000ff>Compute the derivative of |x| (piecewise defined).</font> : In> D(x)if(x<0)(-x)else x <font color=ff0000> Out> if(x<0)-1else1 </font> 22. <font color=0000ff>Compute the antiderivative of |x| (piecewise defined).</font> : In> AntiDeriv(if(x<0)(-x)else x,x) <font color=ff0000> Out> if(x<0)(-x^2/2)else x^2/2 </font> 23. <font color=0000ff>Compute the first terms of the Taylor expansion of 1/sqrt(1-v^2/c^2) at v=0. </font> : In> ans:=Taylor(v,0,4)Sqrt(1/(1-v^2/c^2)) <font color=ff0000></font>In> ans:=Simplify(ans) <font color=ff0000></font>In> PrettyForm(ans) <font color=ff0000> 2 4 v 3 * v 1 + ------ + ------ 2 4 2 * c 8 * c Out> True </font> 24. <font color=0000ff>Compute the inverse of the square of the above expansion. </font> : In> ans:=Taylor(v,0,4)(1/ans)^2 <font color=ff0000></font>In> PrettyForm(Simplify(ans)) <font color=ff0000> 2 v 1 - -- 2 c Out> True </font> 25. <font color=0000ff>Compute the Taylor expansion of tan(x) at x=0 by dividing the expansion of sin(x) by that of cos(x). </font> : In> ans1:=Taylor(x,0,5)Sin(x)/Cos(x) <font color=ff0000></font>In> PrettyForm(ans1) <font color=ff0000> 3 5 x 2 * x x + -- + ------ 3 15 </font>In> ans2:=Taylor(x,0,5)Tan(x) <font color=ff0000></font>In> PrettyForm(ans2) <font color=ff0000> 3 5 x 2 * x x + -- + ------ 3 15 </font>In> ans1-ans2 <font color=ff0000> Out> 0 </font> 26. <font color=0000ff>Compute the Legendre polynomials directly.</font> : In> 10#Legendre(0,_x)<--1 <font color=ff0000></font>In> 20#Legendre(n_IsInteger,_x)<--[Local(result);result:=[Local(x);Expand(1/(2^n*n!)*Deriv(x,n)Expand((x^2-1)^n,x));];Eval(result);] <font color=ff0000></font>In> ForEach(item,Table(Legendre(i,x),i,0,4,1))PrettyForm(item) <font color=ff0000> 1 x 2 -1 + 3 * x ----------- 2 3 -3 * x + 5 * x --------------- 2 2 4 3 -15 * x 35 * x - + -------- + ------- 8 4 8 </font> 27. <font color=0000ff>Compute the Legendre polynomials recursively, using their recurrence of order 2. </font> : In> 10#LegendreRecursive(0,_x)<--1 <font color=ff0000></font>In> 20#LegendreRecursive(1,_x)<--x <font color=ff0000></font>In> 30#LegendreRecursive(n_IsPositiveInteger,_x)<--Expand(((2*n-1)*x*LegendreRecursive(n-1,x)-(n-1)*LegendreRecursive(n-2,x))/n) <font color=ff0000></font>In> ForEach(item,Table(LegendreRecursive(i,x),i,0,4,1))PrettyForm(item) <font color=ff0000> 1 x 2 -1 + 3 * x ----------- 2 3 -3 * x + 5 * x --------------- 2 2 4 3 -15 * x 35 * x - + -------- + ------- 8 4 8 </font> 28. <font color=0000ff>Evaluate the fourth Legendre polynomial at 1. </font> : In> Legendre(4,1) <font color=ff0000> Out> 1 </font> 29. <font color=0000ff>Define the polynomial p = sum( i=1..5, ai*x^i ). </font> : In> ans:=Sum(MakeVector(a,5)*FillList(x,5)^(1..5)) <font color=ff0000></font>In> PrettyForm(ans) <font color=ff0000> 2 3 4 5 a1 * x + a2 * x + a3 * x + a4 * x + a5 * x </font> 30. <font color=0000ff>Apply Horner's rule to the above polynomial.</font> : In> ans:=Sum(MakeVector(a,5)*FillList(x,5)^(1..5)) <font color=ff0000></font>In> PrettyForm(Horner(ans,x)) <font color=ff0000> ( ( ( ( a5 * x + a4 ) * x + a3 ) * x + a2 ) * x + a1 ) * x </font> 31. <font color=0000ff>Compute the first terms of the continued fraction of Pi. </font> : In> pi:=N(Pi,20) <font color=ff0000></font>In> a:=ContFrac(pi,6) <font color=ff0000></font>In> PrettyForm(a) <font color=ff0000> 1 3 + --------------------------- 1 7 + ----------------------- 1 15 + ------------------ 1 1 + -------------- 1 292 + -------- 1 + rest </font> 32. <font color=0000ff>Compute an infinite decimal representation of 1/7. </font> : In> Decimal(1/7) <font color=ff0000> Out> {0,{1,4,2,8,5,7}} </font> This result means that the decimal expansion of 1/7 is 0.142857142857142.... 33. <font color=0000ff>Evaluate TRUE and FALSE. </font> : In> True And False <font color=ff0000> Out> False </font> 34. <font color=0000ff>Solve the equation tan(x) = 1. </font> : In> Solve(Tan(x)==1,x) <font color=ff0000> Out> Pi/4 </font> 35. <font color=0000ff>Revert the Taylor expansion of sin(y) + cos(y) at y=0. </font> : In> t:=InverseTaylor(y,0,6)Sin(y)+Cos(y) <font color=ff0000></font>In> PrettyForm(t) <font color=ff0000> 2 3 ( y - 1 ) 2 * ( y - 1 ) 4 y - 1 + ---------- + -------------- + ( y - 1 ) + 2 3 5 17 * ( y - 1 ) --------------- 10 </font>And check that it is in fact the inverse up to degree 5: In> s:=Taylor(y,0,6)Sin(y)+Cos(y) <font color=ff0000></font>In> BigOh(Subst(y,s)t,y,6) <font color=ff0000> Out> y </font> 36. <font color=0000ff>Solve the linear (dependent) system x+y+z=6,2x+y+2z=10,x+3y+z=10.</font> : In> Solve({x+y+z==6,2*x+y+2*z==10,x+3*y+z==10},{x,y,z}) <font color=ff0000> Out> {{4-z,2,z}} </font> 37. <font color=0000ff>Evaluate True And False</font> : In> True And False <font color=ff0000> Out> False </font> In> CanProve(True And False) <font color=ff0000> Out> False </font> 38. <font color=0000ff>Simplify x or (not x)</font> : In> CanProve(x Or Not x) <font color=ff0000> Out> True </font> 39. <font color=0000ff>Simplify x or y or (x and y)</font> : In> CanProve(x Or y Or x And y) <font color=ff0000> Out> x Or y </font> 39 examples done </FONT></PRE></BODY></HTML>