{VERSION 6 0 "IBM INTEL NT" "6.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 "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0
0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }
{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 }
{CSTYLE "Help Normal" -1 30 "Times" 1 12 0 0 0 0 0 0 0 0 0 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 "Text Output" -1 2
1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 0 0 1 3 0 3 0 }1 0
0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 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 "Warning" 2 7 1 {CSTYLE "" -1 -1 "" 0 1 0 0 255 1 0 0 0
0 0 0 1 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output
" -1 11 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }
3 3 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "" 11 12 1 {CSTYLE "" -1 -1 "" 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "Title" -1 18 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 1 2
2 2 1 1 1 1 }3 1 0 0 12 12 1 0 1 0 2 2 19 1 }{PSTYLE "Author" -1 19 1
{CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 8
8 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times"
1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }
{PSTYLE "Normal" -1 257 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 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 258 1
{CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 1 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 18 "" 0 "" {TEXT -1 50 "Applied Symbolic Computat
ion (CS 300) Midterm Exam" }}{PARA 19 "" 0 "" {TEXT -1 27 "Instructor:
Jeremy Johnson" }}{PARA 256 "" 0 "" {TEXT -1 16 "Spring 2003-2004" }
}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 5 "Name:"
}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 3 "ID:" }
}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 103 "By subm
itting this assignment, I swear that this is my work and I have follow
ed the instructions below." }}{PARA 0 "" 0 "" {TEXT -1 103 "Due by Wed
. May 5 at midnight (not late submissions will be accepted). Use subm
it to submit your exam." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 258 "
" 0 "" {TEXT -1 13 "Instructions:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "" 0 "" {TEXT -1 586 "There are 5 questions each worth 20 poin
ts. All of the questions build on material presented in class and cov
ered by assignments 1 and 2. Questions may have several parts. Do as
much as you can. Partial credit will be given; however, you should c
learly state what you were able to do and what you did were not able t
o do. Make sure your functions have specifications and calculations a
re documented. Clearly state any conclusions you draw and how you der
ived them. You should also test your procedures and provide output fr
om test cases to indicate how you tested your functions." }}{PARA 0 "
" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 592 "All work must be \+
done alone. You may use Maple help and the introductory Maple materia
ls that come with Maple. You may also use any of the lecture notes an
d worksheets from class in addition to homework solutions and your not
es from class. You may not consult any other sources. You may not co
nsult anyone else. If you need clarification on a question, you may s
end me email. Depending on the question, I may forward it and the ans
wer to our mailing list. You are under the honor system to abide by t
hese rules. Anyone who does not follow these rules will receive a zer
o for the exam." }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 28 "Question 1 (B
inomial Series)" }}{PARA 0 "" 0 "" {TEXT -1 334 "Write a Maple procedu
re Mysqrt(x,k), 0 < x < 1 and k is a positive integer, which returns y
a k digit floating point approximation of sqrt(1+x) whose error |sqrt
(1+x) - y| <= 1/2*10^(-k). You must use the binomial series and Taylo
r's theorem to determine the number of terms in the series that guaran
tees the specified error bound. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 29 "Question \+
2 (Harmonic Numbers)" }}{PARA 0 "" 0 "" {TEXT -1 24 "The nth harmonic \+
number " }{XPPEDIT 18 0 "harmonic(n) = Sum(1/i,i=1..n)" "6#/-%)harmoni
cG6#%\"nG-%$SumG6$*&\"\"\"F,%\"iG!\"\"/F-;F,F'" }{TEXT -1 0 "" }}
{PARA 0 "" 0 "" {TEXT -1 291 "Maple can compute harmonic(n) exactly us
ing rational arithmetic. Maple can also evaluate expressions using fl
oating point arithmetic. Use Maple's sum command to compute a sequenc
e of the first 10 harmonic numbers. Use evalf to conver this sequence
to a sequence of floating point numbers." }}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 196 "Investigate harmonic(n) numerically (i.e. using floating
point arithmetic) for larger n. What happens to harmonic(n) as n goe
s to infinity? Use Maple's limit function to confirm your hypothesis.
" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 ""
0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 413 "In the remainder of
this question, you will compare harmonic(n) to the natural logarithm \+
(log(n) in Maple refers to the natural logarithm). Numerically compute
the ratio harmonic(n)/log(n) for a sequence of values of n. Use Map
le's limit function to compute the limit as n goes to infinity. Note \+
that the sequence converges very slowly. You may want to compute the \+
ratio for n=10^k for increasing values of k." }}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA
0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "" 0 "" {TEXT -1 66 "You can use the following series expansio
n to estimate harmonic(n)" }}{PARA 0 "" 0 "" {XPPEDIT 18 0 "harmonic(n
) = log(n) + gamma + 1/(2*n) - 1/(12*n^2) + epsilon[n]/(120*n^4)" "6#/
-%)harmonicG6#%\"nG,,-%$logG6#F'\"\"\"%&gammaGF,*&F,F,*&\"\"#F,F'F,!\"
\"F,*&F,F,*&\"#7F,*$F'F0F,F1F1*&&%(epsilonG6#F'F,*&\"$?\"F,*$F'\"\"%F,
F1F," }{TEXT -1 8 ", where " }{XPPEDIT 18 0 "0 < epsilon[n]" "6#2\"\"!
&%(epsilonG6#%\"nG" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "epsilon[n] < 1
" "6#2&%(epsilonG6#%\"nG\"\"\"" }{TEXT -1 44 " and gamma is a constant
approximately equal" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA
0 "> " 0 "" {MPLTEXT 1 0 13 "evalf(gamma);" }}{PARA 11 "" 1 ""
{XPPMATH 20 "6#$\"+\\m:sd!#5" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "" 0 "" {TEXT -1 42 "Use this series to estimate harmonic(100)
." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 0 "" }{TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "" 0 "" {TEXT -1 61 "Maple can symbolically compute with the s
ymbol harmonic(n). " }}{PARA 0 "" 0 "" {TEXT -1 36 "Use Maple's sum f
unction to compute " }{XPPEDIT 18 0 "Sum(harmonic(i),i = 1 .. n-1);" "
6#-%$SumG6$-%)harmonicG6#%\"iG/F);\"\"\",&%\"nGF,F,!\"\"" }{TEXT -1 3
". " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "
> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 58 "Qu
estion 3 (Generating Functions and Recurrence Relations)" }}{PARA 0 "
" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 35 "Use rsolve to solv
e the recurrence " }{XPPEDIT 18 0 "A(n) = 5*A(n-1)+6*A(n-2);" "6#/-%\"
AG6#%\"nG,&*&\"\"&\"\"\"-F%6#,&F'F+F+!\"\"F+F+*&\"\"'F+-F%6#,&F'F+\"\"
#F/F+F+" }{TEXT -1 21 ", A(1) = 1, A(0) = 0." }}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "
" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 172 "Show how to solve this
recurrence using generating functions. I.E. use the recurrence to fi
nd the generating function, and then use a partial fraction (see conve
rt/parfrac" }{TEXT 30 78 " ) decomposition to find the nth term of the
sequence given by the recurrence." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "
" {TEXT -1 40 "Question 4 (Compositions and Partitions)" }}{PARA 0 ""
0 "" {TEXT -1 475 "Write a Maple procedure MyPart(n), n a positive int
eger, that computes all of the unordered partitions of n. You may not
use Maple's function partition (in combinat), but you may use it to f
or testing purposes. An unordered partition of n is a sequence of int
egers n1 <= n2 <= ... <= nt such that n1+ ... + nt = n. It is the sam
e as a composition, except that order does not matter. I.E. the comp
ositions 2+1+1, 1+2+1, 1+1+2 are considered to be the same partition o
f 4." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 273 "
Your procedure should use the function composition to generate all com
positions, and then should remove compositions that are the same as pa
rtitions. Note that there are more efficient ways to do this, however
, if coded properly, this approach should be very simple to do." }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
15 "with(combinat);" }}{PARA 7 "" 1 "" {TEXT -1 67 "Warning, the prote
cted name Chi has been redefined and unprotected\n" }}{PARA 12 "" 1 "
" {XPPMATH 20 "6#7C%$ChiG%%bellG%)binomialG%)cartprodG%*characterG%'ch
ooseG%,compositionG%)conjpartG%+decodepartG%+encodepartG%*fibonacciG%*
firstpartG%)graycodeG%)inttovecG%)lastpartG%,multinomialG%)nextpartG%)
numbcombG%)numbcompG%)numbpartG%)numbpermG%*partitionG%(permuteG%)powe
rsetG%)prevpartG%)randcombG%)randpartG%)randpermG%-setpartitionG%*stir
ling1G%*stirling2G%(subsetsG%)vectointG" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 13 "partition(4);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#7'7&
\"\"\"F%F%F%7%F%F%\"\"#7$F'F'7$F%\"\"$7#\"\"%" }}}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 71 "composition(4,1); composition(4,2); composition(
4,3); composition(4,4);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#7#\"\"%"
}}{PARA 11 "" 1 "" {XPPMATH 20 "6#<%7$\"\"\"\"\"$7$\"\"#F(7$F&F%" }}
{PARA 11 "" 1 "" {XPPMATH 20 "6#<%7%\"\"\"F%\"\"#7%F%F&F%7%F&F%F%" }}
{PARA 11 "" 1 "" {XPPMATH 20 "6#<#7&\"\"\"F%F%F%" }}}{EXCHG {PARA 0 ">
" 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 28 "Que
stion 5 (Unordered Trees)" }}{PARA 0 "" 0 "" {TEXT -1 148 "Unordered t
rees are the same as ordered trees, except that the order of the child
ren do not matter. For example, the unordered trees of size 4 are:" }
}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 25 "4 \+
4 4" }}{PARA 0 "" 0 "" {TEXT -1 31 "| / \\ \+
/ | \\" }}{PARA 0 "" 0 "" {TEXT -1 26 "3 2 1 1 1 \+
1" }}{PARA 0 "" 0 "" {TEXT -1 10 " | |" }}{PARA 0 "" 0 ""
{TEXT -1 8 "2 1" }}{PARA 0 "" 0 "" {TEXT -1 1 "|" }}{PARA 0 "" 0
"" {TEXT -1 1 "1" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 230 "Modify the procedures to generate and count ordered tree
s in assignment 2 to generate and count unordered trees. Empirically \+
investigate the growth rate of the number of unordered trees and compa
re to the number of ordered trees." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "2" 0 }
{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }