{VERSION 4 0 "APPLE_PPC_MAC" "4.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 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 80 "This data is months, compu ter sales. it came from Landy but has no source yet.\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 74 "times:=[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 ,20,21,22,23,24,25,26];" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 124 "sales:=[265,416,556,699,837,1031,1231,1681,2056,2536,3086,3706,43 09,4991,5548,6196,6847,7270,7500,7880,8068,8334,8434,8519];" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "with(stats[statplots]):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "plots[display](\{scatterplot(times,sales,co lor=black)\},view=[0..26,200..8600]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 84 "Now we are calculating the dependent variable, (1/P)*dP/d t, for logistice growth DE." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 102 "for i from 1 to 22 do k[i]:= evalf(1/(sales[i+1])*(sales[i+2]-sales[i])/( times[i+2]-times[i])) end do:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "di ffquo:=[seq(k[i],i=1..22)]; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "for i from 1 to 22 do j[i]:= evalf((sales[i+2]+sales[i])/2) end do:" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "avesales:=[se q(j[i],i=1..22)]; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 217 "This is a \+ calculation for the difference quotients, dP/dt, using symmetric diffe rences, and the calculation of the independent values that match it. \+ avtimes were done this way to keep the numbering systems matching. " } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 92 "for i from 2 to 23 do k1[i]:= eval f((sales[i+1]-sales[i-1])/(times[i+1]-times[i-1])) end do:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "diffquo1:=[seq(k1[i],i=2..23)]; " } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "for i from 2 to 23 do j1[i]:= eval f((times[i+1]+times[i-1])/2) end do:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "avtimes:=[seq(j1[i],i=2..2 3)];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "diffquoplot1:=plot s[display](\{scatterplot(avtimes,diffquo1,symbol=box,color=black)\},vi ew=[0..28,0..800]):%;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 188 "this ca lculation converts the sales data into a sequence using the 2nd throug h 23rd data point so that it can be graphed with the y-values that wer e calculated with symmetric differences. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "for i from 1 to 22 do n[i]:= evalf(sales[i+1]) end do :" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "newsales:=[seq(n[i],i=1..22)]; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 110 "diffquoplot:=plots[display](\{scatterplot(newsales,d iffquo,symbol=box,color=black)\},view=[260..8600,0..0.5]):%;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 70 "finding the least squares line for the ordered pairs, (P,(1/P)*dP/dt)." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "with(DEtools):with(plots):with(stats[statplots]):" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 13 "with(stats);\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 76 "b:='b':\ntemp1:=fit[leastsquare[[x,y], y=a*x+b, \{a,b\}]]([new sales, diffquo]);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "linfcn:=rhs(te mp1);\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "m:=coeff(linfcn,x);" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "b:=coeff(linfcn,x,0);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "graphline:=plot(linfcn,x=260..8600):\ndisplay (diffquoplot,graphline);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 149 "If y ou want to play with the slope and intercept, you can activate the sta tement below, put in values for m and b, and see what the graphs look \+ like." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 116 "#m:=-.0000322:b:=.28679: \nnewline:=x->m*x+b;\ngraphline:=plot(newline(x),x=200..9000):\ndispla y(diffquoplot,graphline);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "slpfd: =dfieldplot(diff(Q(t),t)=(m*Q+b)*Q,Q(t),t=0..26,Q=200..9000):" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 96 "sol2:=(\{scatterplot(times,sales,sy mbol=CIRCLE,thickness=3,color=black)\},view=[0..26,200..9000]):" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "display(slpfd,sol2);" }}}}{MARK "2 \+ 0 0" 0 }{VIEWOPTS 1 1 0 3 2 1804 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }