Professional Documents
Culture Documents
Computational Mathematics List of Projects
Computational Mathematics List of Projects
List of Projects
There are two categories of projects, one for homework, each has 5 points.
The other one is a final project. It has 30 points
1
Homework
20
Y
(x i) + x20
i=1
infinity whenever |zk | > 2 for some k. (Can you show them?) For the visualization of the Mandelbrot set,
consider the integer-valued function
o
n
(
c
/M
min k |zk (c)| > 2
, where {zk (c)} denotes the sequence generated by
u(c) =
0
cM
(
z0 (c) = 0
zn+1 (c) = (zn (c))2 + c.
That is, u(c) records the iteration number when the sequence escapes the circle of radius 2.
Your assignment Write a MATLAB function m-file mandelbrot.m and a MATLAB script prob2.m.
The mandelbrot function you write takes the form
mandelbrot.m
function mandelbrot(x0,y0,w0)
% Write your code here...
%
end
Your function mandelbrot(x0,y0,w0) needs to create a figure showing u(c) for c in the square [x0
w0 , x0 + w0 ] [y0 w0 , y0 + w0 ] of the complex plane.
Specifically, partition [x0 w0 , x0 + w0 ] [y0 w0 , y0 + w0 ] into 500 500 pixels and create a complex
matrix C representing the coordinate of each pixel. Initialize an all-zero matrix Z with the same size as C.
Iterate z z 2 + c elementwise (or pixelwise) for a maximal iteration 500 times. Along the iterations, setup
the matrix U such that Uij = u(Cij ). The whole computation shouldnt take more than 10 seconds typically.
There are numbers of way to visualize the matrix U . You may use imagesc command with your own
choice of colormap. You may also use the code written below.
figure;
% pcolor plot
hp = pcolor(U);
% colormap
c summer = colormap(summer);
my cmap = repmat(c summer([1:end,end:-1:1],:),floor(N/64),1);
colormap(my cmap);
caxis([0,N])
colorbar
set(hp,'EdgeColor','none','FaceColor','interp')
set(gcf,'Renderer','zbuffer') % zbuffer renderer interpolates color differently
axis equal
axis off
drawnow
You are encouraged to modify these colormap/plot commands to create even better visualization.
For your own first test, try mandelbrot(-0.5,0,1.5). You can play with viewing in different coordinates
(x0 , y0 , w0 ). You can also share a coordinate with your friends or on Piazza. You can put your favorite
coordinate in your script prob2.m. It is okay if your coordinate is the same as your friends.
n
X
ak z k ?
k=0
Do you see roots of f tend to sit on the unit circle? An even less obvious example: if a0 , . . . , an are
independent normal distributed random complex numbers, where are the roots of
r
n
X
nk
f (z) =
ak z k ?
k!
k=0
They tend to sit in the unit disk uniformly. And notice that they tend to repel each other, which is what
one wont see if one just throw n points uniformly in the disk independently. The third example: again
a0 , . . . , an are defined as same as the above examples; where are roots of
s
n
X
n
n
n!
k
f (z) =
ak
z ,
=
?
k
k
k!(n k)!
k=0
The roots will scatter over the complex plane. But after one uses the stereographic projection to map the
complex plane to the unit sphere, the roots sit uniformly, repelling each other, on the unit sphere. This last
example is your assignment.
Your assignment Write a MATLAB function m-file named stellar.m taking the form
stellar.m
function stellar(n)
%
%
in which you generate (n + 1) independent normal random complex numbers a0 , . . . , an and find the n roots
z1 , . . . , zn C to
s
n
X
n
zk .
f (z) =
ak
k
k=0
Your function stellar will need to generate a figure which includes a 3D plot of the stereographic-projection
image of z on the unit sphere.
We will test your function with a few numbers of n less or equal to 500. For example
stellar(20)
stellar(100)
stellar(500)
You may include the following code for 3D plotting. Suppose the vectors x, y, z are the list of x, y, z
coordinates of the 3D points you want to plot,
figure
[sx,sy,sz] = sphere(50); % data of the sphere surface
surf(sx,sy,sz,...
% surface plot a sphere
'FaceColor','w',...
% white sphere
'EdgeColor','none',...
'FaceAlpha',.8,...
% a bit transparent
'FaceLighting','phong') % better light rendering
hold on
plot3(x,y,z,'k*')
% the 3D points
axis equal
axis off
cameratoolbar
% a better 3D nevigation tool than the default one
cameratoolbar('SetMode','orbit')
cameratoolbar('SetCoordSys','none')
camproj perspective
light
n
k
>> factorial(500)
ans =
Inf
n
k
http://en.wikipedia.org/wiki/Stereographic_projection
Many classical iterative methods were aiming to solve the Poisson equation. It is a good project to compare
the performance of classical iterative solvers for solving the Poisson equation in 1D and 2D.
Google search engine mainly use power method to find the largest eigenvalue of a stochastic matrix. A
stochastic matrix A = (pij )nn is also called transition matrix, which satisfies
pij 0,
P
j pij = 1.
The search engine is modeled by a graph (V, E). The vertices V are those web pages containing key words
in the inquiry sentence. At node j (page j), let Nj denote the number of pages that j is linked to (out-link).
Let pij = 1/Nj if there is a link from j to i. The edges E = {(i, j)} denote those nonzero links from j to i.
Project: Find the map of the locations of cities from their pair distances
1
n
In this project, you will draw Julia set on the complex plane. Consider the complex Newtons iterative map
g (z) = z P (z)/P0 (z), where P (z) := z 3 + ( 1)z . Notice that there are three roots of P (z) = 0.
A region is called the basin of a root z0 if each point inside is attracted to z0 through Newtons iteration.
To find the basin region of z0 , you may partition your domain into N N grid points. You may check the
property of each points under Newtons iteration. You then identify each point as (i) in one of the basins, or
(ii) outside the basin (i.e. Newtons iteration does not converge). The complementary of the basins is called
a Julia set. It is a fractal set. Plot this Julia set as a function of for proper range of . You may plot the
orbits for those points on the Julia set. You may also find some reference to figure out how to plot the Julia
set more efficient and more accurately.
Ref. H.-O. Peitgen and P.H. Richter, The beauty of fractals, Springer.
00
0 t tmax
Here (t) is the angle at time t the pendulum made with the vertical
line, whose acceleration 00 (t) (angular acceleration) is projected from the
gravitational acceleration, assuming that the length of pendulum is 1 and
the gravity is 1 plus an extra vertical force f (t).
For a gravity driven pendulum (f (t) = 0), it swings back and forth
about the central bottom = 0. An interesting fact is that when the
external force f (t) is highly oscillatory, the pendulum may swing back
and forth about the central top = , as if the pendulum is inverted.
Your Assignment Write an m-file prob3.m, which can be a script or a
function with no input argument. In prob3.m you will solve the pendulum
ODE using ode45 with tmax = 20 twice: first with f (t) = 0, next with
f (t) = 500 cos(50t). Create the plots of solutions (t) of both cases, plotted in a single axes. Your figure
should include a clear x-label, y-label and a legend that indicates which curve correspond to which case. The
MATLAB functions xlabel, ylabel, legend, title are useful. You may write auxiliary m-files; remember
to include them when you submit.
10
11
This problem is quoted from D. OLeary, Scientific Computing with Case Study, 2009.
12
This problem is quoted from D. OLeary, Scientific Computing with Case Study, 2009.
13
14
15