{VERSION 5 0 "IBM INTEL NT" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "" -1 256 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Tim es" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 34 "Exam 2 MCS 320 Friday 2 Ap ril 2004" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "1. Give the Maple \+ commands for the following tasks:" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 201 "(a) Use stats[random,uniform[0,2*Pi]] to gener ate 10 random angles. Use these angles to generate 10 random points o n the unit circle x^2 + y^2 - 1 = 0, using x = cos(a), y = sin(a), for every angle a." }{MPLTEXT 1 0 0 "" }}{PARA 0 "" 0 "" {TEXT -1 98 "Sto re the points as a list of lists of coordinates [x,y], i.e., as [[x1,y 1],[x2,y2],[x3,y3],...]. " }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 84 "(b) Make a lists of plots of disks of radius 0.01 cente red at the ten random points." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 " ANSWER to (a):" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "a := stats[random,uniform[0,2*Pi]](10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "xp := map(cos,[a]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "yp := map(sin,[a]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "ANSWER to (b):" }{MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "l := zip((x,y)->[x,y],xp,yp) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "lp := map(x-> plottool s[disk](x,0.01),l):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "plot s[display](lp); # this is extra" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "2. What is the assume facility in Maple. Why is it needed?" }{MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 56 " Give an example of a good use \+ of the assume command." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 7 "ANSWER:" }{MPLTEXT 1 0 0 "" }}}{EXCHG }{EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "The assume facility allows the user to impose assump tions on variables." }}{PARA 0 "" 0 "" {TEXT -1 72 "This is needed to \+ simplify expression or to evaluate improper integrals." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "For example:" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "assume(x > 0); sqr t(x^2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "assume(a < 0); i nt(exp(a*t),t=0..infinity);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 227 "3. The Cantor set for any interval [a,b] is constructed by removing the middle third fr om the interval [a,b], leaving the two intervals [a,a+(b-a)/3] and [b- (b-a)/3,b], and repeating this removal on the intervals that are left. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 198 "Write a procedure cantor wit h as index a natural number n, which takes on input the endpoints a an d b of the interval [a,b] (thus, a < b). Calling cantor[n](a,b) return s a sequence of 2^n intervals." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 129 "For example: cantor[0](0,1) = [0,1], cantor[1](0,1) = [0,1/3],[2/ 3,1], cantor[2](0,1) = [0,1/9],[2/9,1/3],[2/3,7/9],[8/9,1], etc." } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "cantor \+ := proc(a,b)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 " local n:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 " n := op(procname);" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 15 " if n = 0 then" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 " return [a,b]:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 " else " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 62 " return cantor[n-1](a,a+(b -a)/3),cantor[n-1](b-(b-a)/3,b):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 " end if;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "end proc;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "cantor[0](0,1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "cantor[1](0,1);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 15 "cantor[2](0,1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "cantor[3](0,1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 79 "4. Co nsider the integral of e^(sin(x)) for x in [0,t]. Give the Maple comm ands" }}{PARA 0 "" 0 "" {TEXT -1 89 " (a) to define this integral as \+ a formula (call it f), without asking Maple to evaluate;" }}{PARA 0 " " 0 "" {TEXT -1 82 " (b) to compute a 10-th order Taylor approximatio n (call it T) for it around t=0;" }}{PARA 0 "" 0 "" {TEXT -1 115 " (c ) to use the Taylor approximation to create a function F which returns a number, e.g.: F(2) returns 12496/2835." }{MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "f := Int(exp(sin(x)),x=0..t) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "T := taylor(f,t,10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "F := unapply(convert(T,po lynom),t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "F(2);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 84 "5. Consider the system 1 + y - x y + y^2 = 0, x + \+ y^2 - 2 z^2 = 0, 1 - z + y z = 0. " }}{PARA 0 "" 0 "" {TEXT -1 66 " Gi ve all Maple commands needed to answer the following questions." }} {PARA 0 "" 0 "" {TEXT -1 28 " Also, justify your answers." }}{PARA 0 " " 0 "" {TEXT -1 13 "(a) How many " }{TEXT 258 7 "complex" }{TEXT -1 33 " solutions does this system have?" }}{PARA 0 "" 0 "" {TEXT -1 13 " (b) How many " }{TEXT 259 4 "real" }{TEXT -1 33 " solutions does this \+ system have?" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "ANSWER to (a):" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "p1 := 1 + y - x*y + y^2;" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 22 "p2 := x + y^2 - 2*z^2;" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 18 "p3 := 1 - z + y*z;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "gb := grobner[gbasis]([p1,p2,p3],[x,y,z],plex);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 114 "From the triangular structure, we can simply make the product of the degrees to count the number of com plex roots:" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "degree(gb[1],x)*degree(gb[2],y)*degree(gb[3],z);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 57 "To find the solutions, we solve the last \+ equation for z :" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "fsolve(gb[nops(gb)],z,complex);" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 161 "We see there are five solutions. Since the first two polynomials in gb are linear in x and y, for every value of z, we find one corresponding value for x and y." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "ANSWER to (b):" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 23 "fsolve(gb[nops(gb)],z);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 121 "We see three real solutions. Substitution in the f irst two polynomials will yield real corresponding values for x and y. " }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "resta rt;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 258 "6. The lemniscate of Bern oulli is defined by (x^2+y^2)^2 = x^2 - y^2. Give all Maple commands \+ to convert this expression into polar coordinates. Give also the defi nition for the lemniscate you obtain in polar coordinates and the comm and to plot this curve." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 8 "ANSWER \+ :" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "lem niscate := (x^2 + y^2)^2 = x^2 - y^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "polar_lmn := subs(\{x = r*cos(t),y=r*sin(t)\},lemnisc ate);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "nf := normal(polar _lmn/r^2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "snf := simpli fy(nf);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "s := solve(snf,r );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "plots[polarplot](s[1] ,numpoints=600);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 68 "7. Consider the initial value problem dy/dx = sin(2x-y), y(0) = 0.5." }}{PARA 0 "" 0 "" {TEXT -1 11 " (a) Give " }{TEXT 256 3 "all" }{TEXT -1 87 " Maple commands (not the output) to define this initial value problem and to obtain an " } {TEXT 257 5 "exact" }{TEXT -1 10 " solution." }}{PARA 0 "" 0 "" {TEXT -1 54 " (b) Give the first three significant digits of y(1):" }} {PARA 0 "" 0 "" {TEXT -1 152 " (c) Use the exact solution to create a function which gives a hardware float numerical approximation for eve ry x. Give the Maple command(s) you used." }{MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "ANSWER to (a):" }{MPLTEXT 1 0 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "ivp := diff(y(x),x) = s in(2*x-y(x)),y(0)=0.5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "s ol := dsolve([ivp],y(x));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "ANSW ER to (c):" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "yx := subs(body = rhs(sol),x->evalhf(body));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "ANSWER to (b):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "yx(1);" }}}{EXCHG }}{MARK "71" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }