MAT 331 Homework Exercises. Set #3 (Oct 9, 00).


NOTE: [No Maple] means that the problem does not involve Maple, except as a word processor to write your solution. In this case you can alternatively turn in a short paper, if you are more comfortable with that.


#10 (exp 10/26)
Write a Maple procedure named charcount which takes a character and a string as inputs and as output tells you how many times the character shows up in the string. [Hint: you will probably want to use the for..do statement to enable you to examine each character of the string, and use another local variable to keep track of how many times you find the character].

#11 (exp. 10/26)
Write a Maple procedure named frequency which uses a global variable alphabet, takes a string of text as input, and as output prints each character of alphabet and how many times that character showed up in the input text. If you wish to you are allowed to build this procedure in pieces by having it call other procedures you have written, (similarly to our Ceasar2 procedure, which called the procedures ToNum and FromNum) but make sure that you turn these in as part of your homework.

#12 (exp. 10/26)
The maple file codedtext.mws which is contained in the directory
/mt/FortSalonga/home/mat331/www/problems was generated by a Ceasar cipher with a shift of one on a 30 letter alphabet (the small letters, a period, a blank, a dash and a comma). However, even though you know what shift was used, the alphabet string was not what you might expect (i.e. it was not just ``abcdefghijklmnopqrstuvwxyz ,.-''). Instead, while the characters of the alphabet are in order, the symbols are interspersed throughout the alphabet.

Find the original message as well as the exact alphabet string that was used, given that the alphabet string started the letter ``a''. [Hint: You can use the Ceasar2 procedure from the text to try decoding this by starting with a more usual alphabet on 30 letters and applying a shift of minus one to the coded text, then try to correct your alphabet to make the message completely readable. You may also find it helpful to use your frequency procedure from the previous problem to try to figure out which character a space is shifted to. Since a space shows up about once for each word, it is likely to be the character that shows up most often.]

#13 (exp. 10/26)
Find all the critical points of g(x,y) = (2x2-x)(y2-1) and determine which ones are local maximum, minimum or saddle points. What are the absolute maximum and minimum of g? [Hint: You may find array, matrix and other commands form the linalg library useful.]

#14 (exp. 10/26)
Define a Maple function h(x,y) that is 0 in the first quadrant, x-y for x < 0 and xy in the rest of the plane.

#15 (exp. 11/2)
Write a Maple procedure that takes as input two integers a,b, and returns the following objects: l, s, p. Here l is the list of all primes between a+1 and b(extremes included), s their sum, and p their product. Also, have Maple print on the screen ``Above average'' if the number of these primes is greater than $\frac{b}{\log b} -
\frac{a}{\log a}$; ``Below average'' otherwise. [Hint: See isprime, print. Check op on how to add an element to a list]

#16 (exp. 11/9)
[No Maple] Find all the solutions to the differential equation

\begin{displaymath}\frac{dx}{dt} = -2 x(t), \quad t\in\mathbb{R} .
\end{displaymath}

Among them, single out the one for which x(0)=3. [Hint: Once again you might want to use dsolve]



 

MAT 331
2000-10-11