Introduction to Maple (Math 502)
Assignments
Spring Semester, 2006
Assignments are listed by the date due.
PDF and DVI (requires
TeX software) versions of this
page are available for printing. If your browser is prepared to
handle MathML, you should view the
XHTML version of this page; in the opposite
case you should view the classical HTML version.
Most of these assignments are simply exercises designed to prepare
you for tests and the written assignments. While you may find it
helpful to discuss exercises with others, no collaboration is
permitted on the written assignments.
 Wed., May. 17:
Final Examination: 3:30  5:30
The long vector is here.
 Tue., May. 16:
Office Hours:
 1:00  2:00
 4:30  5:30
 Mon., May. 15:
Office Hours:
 3:00  5:00
 Thu., May. 11:
Office Hours:
 3:00  5:00
 Mon., May. 8:
Last class; Written Assignment No. 5 (PDF for printing  classical HTML for terminal window browsing) is due.
There is some updated code for cubic curve arithmetic in the
code archive
 Wed., May. 3:
Review Session: Bring questions
 Mon., May. 1:
 262: 6, 7, 12  14, 16, 17, 20, 21, 24, 25
 Wed., Apr. 26:
Written Assignment No. 4 (PDF for printing  classical HTML for terminal window browsing) is due
 Mon., Apr. 24:
Read: §§ 10.5, 10.6
 224: 3  5
 260: 3  5
 Wed., Apr. 19:
Read: §§ 10.1  10.2
 260: 1, 2
 And this:
Find the area enclosed by the loop of the cubic curve y^{2} = x^{3}  x.
Repeat for the cubic curve y^{2} = x  x^{3}.
 Mon., Apr. 17:
Read: §§ 9.1  9.2
 224: 1, 2
 And this:
Find the polynomial p(x) such that
{d^{7}}/{d x^{7}} exp(1/x^{2}) = {p(x)}/{x^{21}} · exp(1/x^{2}) .

 Mon, Apr 10  Fri, Apr 14
University Recess.
 Wed., Apr. 5:
Written Assignment No. 3 (PDF for printing  classical HTML for terminal window browsing) is due
 Mon., Apr. 3:
Read: §§ 8.6, 8.7, 8.8
 212: 4  6
 And this:
Let p be the prime 128^{15} + 39. Without trying to solve determine
which of the following two congruence equations is solvable:
2^{m}EQUIV 11 (mod p) ਊnd 11^{n}EQUIV 2 (mod p) .

Are you able to solve the solvable one?
 Wed., Mar. 29:
Read: §§ 8.3, 8.4, 8.5
 211: 1  3
 And this:
Let p be the prime 1073741827. Find the smallest integers
m, n > 0 such that 2^{m} EQUIV 3 (mod p) and
2^{n} EQUIV 13 (mod p). Repeat this exercise for the modulus
q = 1073741831 instead of p. What is different with the
second modulus?
 Mon., Mar. 27:
Read: §§ 7.5, 7.6, 8.1, 8.2
 188: 5
 211: 1
 And this:
Explore the Maple function for finding primitive roots mod m,
which is numtheory[primroot].
 a. Find the smallest primitive root modulo 289 that
is larger than 100.
 b. Find the smallest positive nonprime primitive root
mod 40487.
 c. Find the smallest positive number that is primitive
modulo both 101 and 103. Is it primitive mod 101*103?
 d. If c is primitive modulo both 101 and 103, what
congruence condition on integers j, k >= 0 is equivalent to the
condition that c^{j} EQUIV c^{k} (mod 101*103)?
 Wed., Mar. 22:
Read: §§ 7.2  7.4
 188: 3, 4
 And this:
In the context of the last exercise on the previous
assignment you have been told that the squeezed vector
[712147006187606979338143444233878549915653153140991743218564586,
1786621100356707079804781015651798041041290004401049203827247506,
1782184643903441535885937756067735301974983951149305281678962346,
1639000008839632707546680167815675641387259213687418193657940006,
1535960089185549654706004534787094483505037489361312984436350635,
1195799297844909964188410557114692983427064185633447219054911622,
1529236902471918734371483225353942522875473990416411009757742702,
409979669999633360347425246927425729369778446996539051720679885,
1805600608974788719838347443426498779266916648865325622675849897,
1058983644708927766918309320955981103594250701210512127725439642]
(where k is maximum, as before, for the given modulus m) may be
decrypted with the exponent
d = 679417638057246102387290084428241348920601574129013039486178441 .

 A. Decrypt it, expand its terms in base 128, and convert the
resulting vector, regarded as a sequence of ASCII
codes, to a string.
 B. Can you determine what the encrypting exponent was?
 Mon., Mar. 20:
Read: §§ 6.3, 7.1
 174: 5
 188: 1, 2
 And this: Given a vector of digits in base 128 what is the
largest block size k for squeezing the vector into a vector of digits
for base 128^{k} so that the resulting squeezed vector can be faithfully
encrypted by taking a suitable power of each entry modulo the integer
m = 2468256835981809063232453773840873253369376547681693188080273739 ?

 Wed., Mar. 15:
Midterm Test in class
 Mon., Mar. 13:
A light assignment prior to the midterm test:
 • Bring review questions.
 • Use network resources to find Maple code for solving
Sudoku puzzles, and then find out how long it takes Maple
to solve this one:

..8...1.2

.7.1...94

...3..5..

.8..4.9..

...815...

..1.6..4.

..5..7...

79...6.1.

6.4...2..
WARNING: Be careful when downloading code from the network.
First make sure a location where you find code is trustworthy,
and then look over any code before running it.
 Wed., Mar. 8:
Written Assignment No. 2 (PDF for printing  classical HTML for terminal window browsing) is due.
Examples of procedures for Monday's assignment are now in
the code archive.
 Mon., Mar. 6:
Read: §§ 6.1  6.2
 174: 2
 And this, which is related to cryptography:
Write Maple procedures that operate on lists of integers
as follows:
Takes two arguments, a list name v and an integer a, and returns
a new list in which each entry x_{j} of the input list is replaced
by x_{j} + a.
Takes three arguments, (a) a list of digits relative to a base
b (the first argument), (b) the base b > 1 (second argument), and
(c) an integer k >= 1, and returns a list of digits relative to
b^{k} as base in which the successive entries of the new list are the
integers in the interval
that are represented in
base b by the successive sequences of length k in the input list.
In each expansion the first digit will be “most significant” and the
input sequence should be internally “padded”, i.e., padded inside
the procedure, with trailing zeros, if necessary, in order to make its
total length a multiple of k.
Takes three arguments, (a) a list of digits relative to base
b^{k}, (b) the integer b > 1, and (c) the integer exponent k > 0,
and returns a sequence of digits relative to base b obtained
successively in groups of length k by expanding each input integer
in base b, with the “most significant” digit listed first and any
trailing 0's arising from expansion of the last input integer removed.
Note that, for given values of the second and third arguments, the last
two procedures invert each other.
 Wed., Mar. 1:
Read: §§ 5.3  5.4
 151: 3  5
 And this: Conduct some experiments in
cryptography using computers (PDF for printing  classical HTML for terminal window browsing).
 Mon., Feb. 27:
Announcement: The midterm test will be held on Wednesday, March 15.
Read: §§ 5.1  5.2
 151: 1, 2
 And this: Write a Maple procedure that given a univariate polynomial
f(x) and a polynomial b(x) of degree at least 1 returns the vector
of coefficients c_{j}(x) for the badic expansion of f(x)
f(x) = SUM_{j >= 0}^{j}[ c_{j}(x) b(x) ]

where deg(c_{j}(x)) < deg(b(x)) for each j >= 0.
 Mon.  Fri., Feb. 20  24
 University Winter Recess
 Wed., Feb. 15:
Scan: Chapter 4
Exercises:
 137: 1, 4
 And this:
Write a Maple procedure that given a base b >= 2 and a triple of
vectors equivalent to the base b representation of a positive
rational number  each vector consisting of digits relative to the
base b, with the vectors in order being (a) the digit sequence
(possibly empty) to the left of the decimal point, (b) the digit
sequence (possibly empty) to the right of the decimal point before the
repetition pattern, and (c) the digit sequence (if any) that repeats
 returns the positive rational number as a fraction m/n where m
and n are positive integers without common divisor.
 Mon., Feb. 13:
Written Assignment No. 1 (PDF for printing  classical HTML for terminal window browsing) is due
 Wed., Feb. 8:
Read: §§ 3.4  3.6
Exercises:
 93: 6  10
 Find: the length of the repeating pattern in the (base 10)
decimal expansion of 355/113 (which is the 4th convergent in
the continued fraction expansion of pi). Repeat this exercise
for the base 2 expansion of the same rational number.
 And this:
Write a Maple procedure that when given a finite continued fraction,
presented as the vector
[  a_{0},a_{1},a_{2},a_{3}, …, a_{n}  ] 
representing
a_{0} + {1}/{a_{1}+{1}/{a_{2} + {1}/{… + a_{n}}}} ,

with the a_{i} all integers and a_{i} >= 1 for i >= 1, returns
the rational number it represents.
Previous assignment:
procedure written
for the last exercise.
 Mon., Feb. 6:
Read: §§ 3.1  3.3
Exercises:
 63: 12, 13
 93: 1  5
 And this: Write a Maple procedure that for two given
integers m,n > 0 returns a vector of vectors [v, w] where
v is the vector of successive quotients and w the vector of
successive remainders in application of the Euclidean algorithm
to the pair (m, n).
More Maple code:
See this.
 Wed., Feb. 1:
Read: §§ 2.5  2.6
Exercises:
 63: 6  11
 And this: Examine all iterates of the Syracuse function
applied to each integer n up to 10,000 and find the integer n
in that range having an iterate s_{k}(n) for which the ratio s_{k}(n)/n
of the iterate to the starting integer is largest. Hint: If
the problem is modified to consider only integers n up to 100, then
the integer in that smaller range having an iterate with largest ratio
is 27, and the iterate presenting the largest ratio is s_{77}(27) = 9232.
About the Syracuse function: It is generally conjectured that for
each integer n > 1 there is some integer k > 1 such that the kth
iterate of s applied to n is 1. No proof of this has been known.
For more information see the
survey article by
J. C. Lagarias found at arXiv.
Maple code for the Syracuse function: This is essentially the same
as what was shown in class on Wednesday the 25th. It is provided for
those who may still be having trouble getting it to run.

syr := n > if n <= 1 then 1 elif n mod 2 = 0 then n/2 else 3*n+1 fi;
 Mon., Jan. 30:
Read: §§ 2.1  2.4
Exercises:
 63: 1  5
 And this: The Syracuse function s is defined for integers n by
The iterates of s are
s_{1}(n) = s(n), s_{2}(n) = s(s(n)), s_{3}(n) = s(s(s(n))),… .

For example, s_{1}(6) = s(6) = 3, s_{2}(6) = s(3) = 10, s_{3}(6) = s(10) = 5,
s_{4}(6) = s(5) = 16, s_{5}(6) = s(16) = 8, s_{6}(6) = s(8) = 4,
s_{7}(6) = s(4) = 2, s_{8}(6) = s(2) = 1. Since the 8th iterate of s
applied to 6 is 1, all higher iterates of s applied to 6
are 1.
Find the 5 smallest values of n for which the first 2n + 1
iterations of s applied to n fail to yield 1.
 Wed., Jan. 25:
Acquire the textbook. Read through chapter 1, and try some of
what is sketched there for yourself in Maple.
About free general purpose computer algebra systems: The
following items were found through a web search, but none of them have
been reviewed.
 Axiom

Axiom has been in development since 1973 and was
sold as a commercial product. It has been released as free software
under the Modified BSD License. It is sponsored by CAISS, the Center
for Algorithms and Interactive Scientific Software, at The City
College of New York.
 Maxima

Maxima is a descendant of Macsyma, the computer
algebra system developed in the late 1960s at the Massachusetts
Institute of Technology. It is free under the GNU General Public
License subject to some export restrictions from the U.S. Department
of Energy. A proprietary version of Macsyma is also
available.
 Mon., Jan. 23:
First meeting: No assignment.
UP 
TOP 
Department