{VERSION 5 0 "IBM INTEL LINUX" "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 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 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 }{PSTYLE "Headi ng 1" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 2" -1 4 1 {CSTYLE "" -1 -1 "Times" 1 14 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 2 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "Project Two MCS 320 due Mo nday 31 March 2003 at 2PM." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 " Below is a possible solution:" }{MPLTEXT 1 0 0 "" }}}{SECT 0 {PARA 3 " " 0 "" {TEXT -1 28 "0. A model for an arms race." }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 265 "In this project we study the behaviour of coupled n onlinear difference equations with Maple. The equations model the dev otion of two nations (we call them X and Y) to arms spending in their \+ annual budget cycle. The variables x[n] and y[n] are defined as follo ws: " }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 77 " x[n] = `arms expenditure of nation X`/`gross national product of X`@`y ear n`;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 77 "y[n] = `arms exp enditure of nation Y`/`gross national product of Y`@`year n`;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "Obviously: 0 < x[n] < 1 and 0 < y[ n] < 1." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 136 "To stay competitive, \+ the spending of X in year n+1 is proportional to what Y spent in year \+ n. Likewise, y[n+1] is proportional to x[n]." }{MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 65 "The equation proposed in the liter ature depends on a parameter p:" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "`F[p](x,y)` := x[n+1] = 4*p*y[n]*(1-y[n]); \+ " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 149 "and is symmetric in x and y. Assuming the spending of X is regulated by the parameter a and the s pending of Y by b, we have the following equations:" }{MPLTEXT 1 0 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "F[a] := subs(p=a,`F[p]( x,y)`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "F[b] := subs(\{p =b,x=y,y=x\},`F[p](x,y)`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "wit h corresponding functions:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "Fa := unapply(rhs(F[a]),y[n]); Fb := unapply(rhs(F[b]),x[n]);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "For example:" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "fa := subs(a=0.8,eval(Fa) ); fb := subs(b=0.4,eval(Fb));" }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 31 "1. An indexed procedure F[p](z)" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 103 "We write a function F which takes the parameter p as an index \+ and the variable z as a regular argument." }{MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "F := proc(z)" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 10 " local p:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 29 " if type(procname,`indexed`)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 " then p := op(procname);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 44 " \+ else error(`provide parameter as index`);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 " end if;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 " retu rn 4*p*z*(1-z);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "end proc;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "F[0.8](0.2) = fa(0.2); F[0.4 ](0.2) = fb(0.2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 74 "If the index is omitted, then the procedure call returns an error message:" } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "F(0.2); " }}}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 36 "2. Sampling and Plotting al l at once" }}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 24 "2.1 The sample proce dure" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "To make a plot, we first n eeded to sample" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 79 "sample := proc(F::procedure,N::nonnegint,a::float,b:: float,x0::float,y0::float)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 70 " des cription `makes a plot of two competing nations in an arms race`:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 " local x,y,points,n;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 " x[0] := x0: y[0] := y0:" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 15 " points := []:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 " for n from 0 to N-1 do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 " \+ x[n+1] := F[a](y[n]):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 " y[n +1] := F[b](x[n]):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 48 " points : = [op(points),[n+1,x[n+1],y[n+1]]]:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 " end do:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "end proc;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "s := sample(F,20,0.8,0.4,0.0 1,0.05);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "plp := axes=box ed,style=line,color=red,tickmarks=[3,4,4],labels=[\"t\",\"x\",\"y\"]: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "plots[pointplot3d](s,pl p);" }}}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 38 "2.2 One nation increases its parameter" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 94 "Suppose nation \+ Y increases from 0.4 to 0.95 in increments of 0.01. We build a list o f plots:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "pp1 := []:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "for i from 1 to 55 do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 50 " ls := sample(F,40,0.8,0.4+(i-1)*0.01,0.01,0 .05):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 46 " pp1 := [op(pp1),plots[po intplot3d](ls,plp)]:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "end do:" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 37 "This list of plots defines a surfa ce:" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "p lots[display](pp1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "and an ani mation:" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "plots[display](pp1,insequence=true);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 120 "The three respective plots which show projections of the surface on the coordinate planes yt, xt, and xy are as follows:" } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "plots[d isplay](pp1,orientation=[-90,90]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "plots[display](pp1,plp,orientation=[-90,180]);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "plots[display](pp1,orientati on=[0,90]);" }}}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 40 "2.3 Both nations increase their spending" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 135 "Suppo se nation Y increases from 0.4 to 0.95 in increments of 0.01 AND natio n X increases its parameter from 0.8 in increments of 0.002." }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 33 " Again, we build a list of plots: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "pp2 := []:" }}{PARA 0 " > " 0 "" {MPLTEXT 1 0 21 "for i from 1 to 55 do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 62 " ls := sample(F,40,0.8+(i-1)*0.002,0.4+(i-1)*0.01,0. 01,0.05):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 46 " pp2 := [op(pp2),plot s[pointplot3d](ls,plp)]:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "end do: " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 18 "We have a surface:" } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "plots[d isplay](pp2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "and an animation :" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "plo ts[display](pp2,insequence=true);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 120 "The three respective plots which show projections of the surface \+ on the coordinate planes yt, xt, and xy are as follows:" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "plots[display](pp2 ,orientation=[-90,90]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 " plots[display](pp2,plp,orientation=[-90,180]);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 39 "plots[display](pp2,orientation=[0,90]);" }}}}} {SECT 0 {PARA 3 "" 0 "" {TEXT -1 42 "3. Characterization of the critic al values" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 110 "Here we examine the \+ first situation (when nation Y increases its parameter), using the sur face defined by pp1." }{MPLTEXT 1 0 0 "" }}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 46 "3.1 From one equilibrium to several equilibria" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "plots[display](pp1[39]);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 75 "From the graph we can see that the threshold occurs between plot 39 and 40." }{MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "C1a := 0.4 + 38*0.01;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "equ := y = F[0.8](F[C1a](y)) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "fsolve(equ,y);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "C1b := 0.4 + 39*0.01;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "equ := y = F[0.8](F[C1b](y)) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "fsolve(equ,y);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "plots[display](pp1[40],orien tation=[-90,90]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "On the plot \+ above we see clearly two equilibria, but there is a third one, close t o 0.65." }{MPLTEXT 1 0 0 "" }}}}{SECT 0 {PARA 4 "" 0 "" {TEXT -1 38 "3 .2 From several equilibria into chaos" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "Again we first use the plots to get to the threshold value:" } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "plots[d isplay](pp1[45]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 80 "At plot 45, \+ we still get a regular plot, but after that, things start to change." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "C2a := 0.4 + 44*0.01;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "equ := y = F[0.8](F[C2a](y));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "fs olve(equ,y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "C2b := 0.4 \+ + 45*0.01;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "equ := y = F[ 0.8](F[C2b](y));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "fsolve( equ,y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "C2c := 0.04 + 46 *0.01;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "equ := y = F[0.8] (F[C2c](y));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "fsolve(equ, y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 90 "We see that not only the n umber of equilibria changes, but also the values change rapidly." } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 80 "The situation is best described with a plot of the last ten trajectories of pp2:" } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "plots[d isplay](pp2[46..55],orientation=[-90,90]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "Before that, we have the situation of multiple equilibria :" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "plo ts[display](pp1[40..45],orientation=[-90,90]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "and before that, we have only one equilibrium:" } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "plots[d isplay](pp1[1..39],orientation=[-90,90]);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} }}{MARK "6 2 3 0 0" 7 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }