Sie sind auf Seite 1von 7

OLLSCOIL NA hÉIREANN, CORCAIGH

THE NATIONAL UNIVERSITY OF IRELAND, CORK

COLÁISTE NA hOLLSCOILE, CORCAIGH


UNIVERSITY COLLEGE, CORK

SUMMER EXAMINATION 2007

FIRST SCIENCE

APPLIED MATHEMATICS

AM1054 – Mathematical Software

Prof. I. D. Abrahams
Professor A. Pokrovskii
Dr. M. H. Quinlan
Mr. D. J. Cahalane

Instructions:
Answer three questions.
You must answer Question 1.

Time allowed: 90 minutes.

100 Marks

Page 1 of 7
Question 1. Answer 4 parts. [40 marks, equal marks for all parts.]

ü Part (a)

Write and plot a function g which has a graph as shown.


2

1.5

0.5

2 4 6 8 10

ü Part (b)
1

0.5

1 2 3 4 5 6
-0.5

-1

In an attempt to reproduce the graphic above, a Mathematica user evaluated the following the faulty input.

fns = 8Sin@θD, Sin@2 θD, Sin@3 θD<;


Plot@fns, 8θ, 0, 2 π<D

(i) Correct the second line of the input (by adding an appropriate function) and use your modified input to
produce the desired graphic.
(ii) What attribute of the Plot function is responsible for the original input not producing the desired graphic?

ü Part (c)
u@xD
Find the derivative of the quotient ÅÅÅÅ
ÅÅÅÅÅÅ and express the result as a single quotient to reproduce the familiar
v@xD
form of the "quotient rule" of differentiaion.

Page 2 of 7
ü Part (d)

Consider the circle Hx − L + y2


1 2 3 3
2 2 and parabola y2 2 x:

-0.5 0.5 1 1.5 2 2.5 3

-1

-2

Find the points of intersection.

ü Part (e)

(i) Find the cube roots of unity (i.e. the values of z that satisfy z3 = 1).

è!!!! è!!!!
91, − 12 − 2 3 , − 12 + 2 3 =.
(ii) Make use of the function ComplexExpand to give the answer in the form

ü Part (f)

(i) Explain why the expression

x2 ê. Subscript → List

evaluates to 8x, 2<.

(ii) Replace "somethingElse" in the following input so that the expression

x2 ê. Subscript → somethingElse

evaluates to 2 x

Page 3 of 7
Question 2
This questions concerns finding and plotting the complex roots of an equation.

ü Part (a) [15 marks]

(i) Find the five values 8z1 , ..., z5 < of the complex variable z that solve the equation z5 - z - 5 = 0.
(ii) Express the list of roots 8z1 , ..., z5 < as a list of complex numbers in numerical form.
(iii) Use Table to create the list of five points 88x1 , y1 <, ..., 8x5 , y5 << where, for each point i, the values
8xi , yi < are the real and imaginary parts of the root zi , respectively.
(iv) Plot these points to produce a graphic similar to the following:

ImHzL

0.5

ReHzL
-1 -0.5 0.5 1 1.5

-0.5

-1

Page 4 of 7
ü Part (b) [15 marks]

The equation z5 - z - 5 = 0 becomes Hx + Â yL5 - Hx + Â yL - 5 = 0.


The complex variable z can be rewritten in terms of its real and imaginary parts: let z = x + Â y.

We can consider the real and imaginary parts of the left hand side (LHS) of the equation, both of which must
evaluate to zero at the values of z which are roots.

Re@Hx + yL5 − Hx + yL − 5D êê ComplexExpand

−5 − x + x5 − 10 x3 y2 + 5 x y4

Im@Hx + yL5 − Hx + yL − 5D êê ComplexExpand

−y + 5 x4 y − 10 x2 y3 + y5

(i) Create a plot showing the values of z for which the real part of the LHS is equal to zero. (Suggestion: You
might wish to use, among others, the options Contours, ContourShading and PlotPoints.)
(ii) Similarly, create a graphic showing for which values of z the imaginary part of the LHS is equal to zero.
(iii) Combine these graphics with the graphic from Part (a) to produce a graphic similar to the following.

ImHzL
2

ReHzL
-2 -1 1 2

-1

-2

Page 5 of 7
Question 3
This question concerns random walks and iterative loops (Do and While).

ü Part (a) [15 marks]

Joe Soap, a college student, is endeavouring to walk from Speedy Ed's Nightclub to Billhilly's Chicken
Take-away. Being sligthly the worse for wear, at each attempt to take a step Joe either moves forward one
pace with 75% probability or moves back one pace with 25% probability.

(i) Seed the random generator to 10 and generate 300 steps of the walk described above. (Suggestion: For
each step, you could consider drawing at random from the list {1,1,1,-1}.)
(ii) Use ListPlot to illustrate the student's progress.

ü Part (b) [15 marks]

When Speedy Ed's Nightclub closes 250 students emerge, all of whom would like to dine at Billhilly's
Chicken Take-away. They are all in the same condition as Joe (i.e. at each attempt to take a step a student
either moves forward one pace with 75% probability or moves back one pace with 25% probability). The
Take-away is 100 paces from the Nightclub.

(i) Seed the random generator to 30.


(ii) Find the average number of steps taken by the 250 students to travel from the Nightclub to the Take-away.
(Suggestion: First use a While loop to generate the path of a student until he/she reaches the destination. Then
use a Do loop to generate 300 such paths.)

Page 6 of 7
Question 4
This question concerns obtaining and manipulating a numerical solution of a differentital equation.

ü Part (a) [15 marks]

(i) Use NDSolve to obtain a numerical solution of the following differential equation, subject to the given
initial conditions, which is valid for 0 § t § 25.

y @tD + 2 Hy@tD2 − 1L y @tD + y@tD 0

y@0D 1
5 , y @0D 1
5

(ii) Plot the solution for 0 § t § 25.


(iii) Plot the first derivative of the solution on the same interval.

ü Part (b) [15 marks]

The output from NDSolve in Part (a) is in the form of an interpolating function. We will now look more
closely at the interpolating function and extract the set of points at which NDSolve estimated values for the
solution.

(i) The list of values of t at which the solution was estimated is recorded in the first part of the third part of
the InterpolationFunction object. With the appropriate use of indexing, assign this list the alias
tValues.
(ii) Use ListPlot to plot the value of the numerical solution for each value of t in the list tValues.
(iii) How many steps did NDSolve take in generating this solution?
(iv) What were the minimum, maximum and mean step sizes?

Page 7 of 7