Exam (elaborations) TEST BANK FOR Mathematics for Physical Science and Engineering Symbolic Computing Applications in Maple and Mathematica By Frank Harris (Solution Manual)
1.1 COMPUTING: HISTORICAL NOTE 1.2 BASICS OF SYMBOLIC COMPUTING Exercises Carry out these exercises using the symbolic computation system of your choice. 1.2.1. Reduce the following polynomial in x and z to fully factored form. 3x2 + 3x4 − 4xz + 3x2z + 2x3z + 6x5z + z2 − 4xz2 − 7x2z2 + 6x3z2 − 8x4z2 + z3 + 2xz3 − 5x2z3 + 2x3z3 − 2xz4 + 6x3z4 + z5 − 8x2z5 + 2xz6 Solution: In maple, > ZZ := 3*x^2+3*x^4-4*x*z+3*x^2*z+2*x^3*z+6*x^5*z+z^2-4*x*z^2 > -7*x^2*z^2+6*x^3*z^2-8*x^4*z^2+z^3+2*x*z^3-5*x^2*z^3 > +2*x^3*z^3-2*x*z^4+6*x^3*z^4+z^5-8*x^2*z^5+2*x*z^6; > factor(ZZ): In mathematica, ZZ = 3*x^2+3*x^4-4*x*z+3*x^2*z+2*x^3*z+6*x^5*z+z^2-4*x*z^2 -7*x^2*z^2+6*x^3*z^2-8*x^4*z^2+z^3+2*x*z^3-5*x^2*z^3 +2*x^3*z^3-2*x*z^4+6*x^3*z^4+z^5-8*x^2*z^5+2*x*z^6: Factor[ZZ]; Both symbolic systems give an answer equivalent to (x − z)(3x − z)(2xz + 1)(x2 + z3 + z + 1) 1.2.2. Because the polynomial in Exercise 1.2.1 can be factored, symbolic computer systems can easily find the values of x that are its roots. Calling the polynomial in its original form poly, use one of the following: 3 4 CHAPTER 1. COMPUTERS, SCIENCE, AND ENGINEERING solve(poly=0,x) or Solve[poly==0,x] Note. Less convenient forms than that found here are usually obtained as the solutions to more general root-finding problems. Solution: Letting ZZ be as defined in the solution to Exercise 1.2.1, execute one of > solve(ZZ = 0, x); 1 3 z, − 1 2z , z , √ −z3 − z − 1 , − √ −z3 − z − 1 Solve[ZZ == 0, x] { { x → − 1 2z } , { x → z 3 } , {x → z}, { x → − √ −1 − z − z3 } , { x → √ −1 − z − z3 }} 1.2.3. (a) Starting with f(x) = 1+2x+5x2 −3x3, obtain an expansion of f(x) in powers of x+1 by carrying out the following steps: (1) Define a variable s and assign to it the value of the polynomial representing f(x); (2) Define x to have the value z − 1 and recompute s; (3) Expand s in powers of z; (4) Define z to have the value x + 1 and recompute s. You will need to be careful to have x and/or z undefined at various points in this process. (b) Expand your final expression for s and verify that it is correct. Note. Your algebra system may combine the linear and constant terms in a way that causes (x + 1) not to be explicitly visible. Solution: In maple, these steps correspond to this coding: > s := 1+2*x+5*x^2-3*x^3: > x:=z-1: s: > ss:=expand(s): > x:='x': z:=x+1: ss: In mathematica, s = 1 + 2*x + 5*x^2 - 3*x^3; x = z - 1; s; ss = Expand[s]; Clear[x]; z = x + 1; ss; Both symbolic systems give a result equivalent to 7 − 17(x + 1) + 14(x + 1)2 − 3(x + 1)3 1.2.4. Verify the trigonometric identity sin(x + y) = sin x cos y + cos x sin y by simplifying sin(x + y) − sin x cos y − cos x sin y to the final result zero. Use the commands for simplifying and expanding (try both even if the first works). These two commands do not always give the same results. Solution: Both work in maple, Expand does not simplify in mathematica. 1.2. BASICS OF SYMBOLIC COMPUTING 5 1.2.5. Obtain numerical values, precise to 30 decimal digits, for π2 and sin 0.1π. Note. Obtain these 30-digit results even if your computer does not normally compute at this precision. Solution: Execute one of the following (illustrated only for sin 0.1π): evalf(sin(0.1*Pi), 30); N[Sin[0.1*Pi], 30] Both give sin 0.1π = 0. . The result for π2 is 9. . 1.2.6. (a) Verify that your computer system knows the special function corresponding to the following integral: erf(x) = √2 π ∫ x 0 e −t2 dt . In maple, it is erf(x); in mathematica, Erf[x]. (b) Write symbolic code to evaluate the integral defining erf(x), and check your code by comparing its output with calls to the function in your symbolic algebra system. Check values for x = 0, x = 1, and x = ∞. Note. Infinity is infinity in maple, Infinity in mathematica. Solution: erf(0) = 0, erf(1) = 0., erf(∞) = 1. evalf(2/sqrt(Pi)*int(exp(-t^2),t=0 .. 1)); N[2/Sqrt[Pi]*Integrate[E^(-t^2), {t, 0, 1}]] 1.2.7. Plot the function defined in Exercise 1.2.6 for various ranges of x. Use enough ranges to get some experience in using your algebra system’s plotting utility. Solution: We illustrate for the range (0 · · · 2): plot(erf(x), x = 0 .. 2); Plot[Erf[x], {x, 0, 2}] 1.2.8. Obtain the value of erf(π) to 30 decimal places and print out the message "erf(pi)= · · · ". Note. The value of erf must be supplied directly by the computer; you should not obtain an answer by typing it in. Solution: In maple: VAL := evalf(erf(Pi),30): print("erf(pi) = ",VAL); “erf(pi) = ”, 0.781 or 6 CHAPTER 1. COMPUTERS, SCIENCE, AND ENGINEERING printf("erf(pi) = %33.30fn",VAL);
Written for
Document information
- Uploaded on
- November 15, 2021
- Number of pages
- 400
- Written in
- 2021/2022
- Type
- Exam (elaborations)
- Contains
- Unknown
Subjects
-
exam elaborations
-
test bank for mathematics for physical science and engineering symbolic computing applications in maple and mathematica by frank harris solution manual