AMATH 301
Homework 3: Spring 2011
DUE: Monday, April 25 at 03:00:00 AM
i
The Fibonacci sequence Fo, Fi, F2,..., with F = 0 and F; = 1, is defined as
Faso = Fast + Fe
and can be represented as a matrix equation
tak Fy
Xe = Ae Xp, where A= [{ al and = [ Eel
Therefore it follows that x,41 is the product of A‘** and xp, ie.
(a) Use the Matlab command “eig” to find the matrix A of eigenvalues \ and matrix
X of eigenvectors x of the 2x2 matrix A. Rescale the eigenvectors such that each
has a value of 1 as its second entry. Populate a column vector [1 2)” with the
resulting eigenvalues such that |A,| > |As|- Call X, the (rescaled as above) eigenvector
corresponding to Ay, and likewise %,, corresponding to 2. Form these into a 2x2
matrix X, with Xs, being the first column and , being the second, ic.
Verify for yourself in Matlab that A = KAX~! = XAK7.
ANSWERS: The 2x2 matrix of eigenvectors should be saved as Al.dat. The 2x1
column vector of eigenvalues should be saved as A2.dat.
(b) Find the following elements of the Fibonacci sequence Fs, Fr... Fios (computing
the power of the matrix A efficiently, i.e., using its eigenvalues and eigenvectors)
ANSWER: The elements should be saved as a column vector A3.dat.
In this problem, we will explore an eigenvalue problem motivated by particle physics.
‘The energy levels E” and corresponding states W” of N = Nz-+Np = 4 identical bosonic
atoms confined to a double-well trapping potential may be found by computing the
eigenvalues and corresponding eigenvectors of the many-atom Schrédinger equation
IW" (2, 2, X3,%4) = E"WY (1,2, %3, X4).We can cast this problem into matrix form: the corresponding matrix H is tridiagonal
and Hermitian or self adjoint, ic. H' = (H*)’ = H, where (-)* denotes complex
conjugation and (.)" the unconjugated transpose.
Its main diagonal is given vin, = AN, + hNp and its main+1 diagonal is given
by [xix = VVC Np, resulting in the following matrix eigenvalue problem
HO’ = E°C",
or, equivalently,
Oh+4h V/OFI4 0 0 0 a oy
Th+3h V+ 13 0 0 a or
Qh+2h V/@+IZ 0 oC
Bath VYB+iII | | os
dh+0h oa &
Note that only the diagonal and superdiagonals of Hare illustrated above,
(a) Use the “diag( .n)” and “eig” commands in Matlab to build the tridiagonal n
H and to find the energies (eigenvalues) and tates (cigenvectors) of this
particle system, Assume that h = 1 and V = V(a) = —lexp(—a) with a = 1 (this
can be interpreted in terms of a characteristic frequency of the trapping potential).
Organize these energies from smallest (the ground state, with v = 0) to largest: (the
fourth excited state, with v = 4) and place them into a. single row vector. Be sure to
explicitly perform this sort as the Scorelator’s “cig” command will not automatically
order the eigenvalues
ANSWERS: The 1x5 row vector of energies should be saved as Ad.dat. The 5x5
matrix of eigenstates should be saved as A5.dat and ordered so that column 1 corre-
sponds to the ground state energy, column 2 to the first excited state energy, and so
on,
(b) Compute CtC, where
crm Ge
Cm om
cra cree ost | =
om am
Go Cr
and store your result in a matrix. Is this what you would expect?
ANSWER: The 5x5 matrix should be saved as AG.dat.
(c) Now vary the double-well barrier height, which is related to V = V(a), by increasing
@ from 1 to 5 in steps of one. In each case solve the corresponding matrix eigenvalueproblem and store the corresponding energies (from smallest to largest) in a row vector
(one vector for each value of «).
ANSWERS: Five 1x5 row vectors of energies should be saved as A7.dat for a =
A8.dat for a = 2, through All.dat for a = 5.
Notice that the energies are becoming degenerate as the barrier height is increased.
Degeneracy means that two or more eigenvalues are identical.
Consider the following information:
(0,1, 2,3, 4,5, 6, 7, 8,9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)
v(t) = (15, 17, 18, 13, 15, 19, 21, 20, 20, 22, 24, 25, 28, 26, 29, 27, 30, 32, 32, 32, 35, 37, 36)
‘The first row vector represents time (in seconds) and the second row vector represents
the velocity as a function of time (in meters/second).
(a) Fit the data with the parabolic fit
f() = Al + Bt+C
and calculate the By error. Use “polyfit” and “polyval” to get: your results. Evaluate
the curve f(t) for t= 0: 0.01 : 22 and save this in a column vector,
ANSWER: The error and curve should be written out as A12.dat and A13.dat re~
spectively.
(b) Use the “interp1” and “spline” commands to generate an interpolated approxima-
tion to the data for ¢ = 0 : 0.01: 22. Save these two results as cohumn vectors.
ANSWER: Should be written out as Al4.dat and A15.dat.
For your own understanding, plot all of the different curves on top of the data and
try experimenting with various line styles, colors, and marker styles. For ideas and
examples see the help of “plot” or “linestyle” and the example VisualizeBisection.m
on the Examples section of the website./MEVSIN\\
XAMATH 301 HOMEWORK 3
clear all; close all; cle
% PROBLEM 1
A=[1 151 @1;
[V,D]=eig(A);
X1=VC: 195
C:,2)5
X2=X2/(X2(2, 335
Xtilde=[X2,X1]}
DC2,2);D¢1,1)];
Fediag(D);
[eigenval I]-sortCF, 'descend’);
save Al.dat Xtilde -ascii
save A2.dat eigenval -ascii
for r=75:108
FibCCr-74), :)=(V*(D.ACr))*VAC-1))* [150];
end
Fib
Fib2C: ,1)=Fib(1:34,2)
save A3.dat Fib2 -ascii
xProblem 2
he1;
a=1;
'=-1*exp(-a);
Hezeros(5,5);
for m=0:3
Vvec((m1) ,1)=V¥sqrt(Cm1)*(4-m));
end
n=0:45MESA
H=diag(n*h+(4-n)*h)+diag(Vvec,1)+diag(Vvec,-1);
[Q,R]=eigCH);
Tadiag(R);
[energies I]=sort(T, 'ascend");
energies=energies';
Qnat=Q;
Qnat=QC: ,D;
save A4.dat energies -ascii
save AS.dat Qnat -ascii
Z=Qnat'*Q
save A6.dat Z -ascii
%a=1
V=-1*exp(-a);
Hezeros(5,5);
for m=0:3
WecC(m+1) ,1)=V*sqrtCCm+-1)*(4-m));
end
n=0:4;
Hedi ag(n*h+(4-n)*h)+diag(Vvec, 1)+diag(Wec,-1);
[Q,R]=eigCH);
Tadiag(R);
[energies1 I]=sort(T, 'ascend');
energiesl=energies1';
save A7.dat energies1 -asciiME}ISA\\
%a=2
Ve-1*exp(-a);
Hezeros(5,5);
for m=0:3
VecC(m1),1}=V*sqrt(Cm+1)*C4-m));
end
n=0:4;
Hediag(n*h+(4-n)*h)+diag(Wec , 1)+diag(Vvec, -1);
[Q,R]=eigCH);
T=diag(R);
[energies2 T]=sort(T, ascend");
energies2=energies2" ;
save A8.dat energies2 -ascii
%a=3
het;
053;
V=-1*exp(-a);
Hezeros(5,5);
for m=0:3
Vvec((me1) ,1)=V*sqrt((m1)*(4-m));
end
n0:4;
Hediag(n*h+(4-n)*h)+diag(Wvec,1)+diag(Wec,-1);
[Q,R]=eigCH);
Tediag¢R);MeTSa\\
[energies3 I]=sort(T, 'ascend');
energies3-energies3' ;
save A9.dat energies3 -ascii
Ka=4
hel;
a=4;
V=-1*exp(-a);
Hezeros(5,5);
for m=-0:3
Wec((m+1) ,1)=V*sqrtC(m+1)*(4-m)) 5
end
n=0:4;
Hediag(n*h+(4-n)*h)+diag(Vvec,1)+diag(Wvec,-1);
[Q,R]=eigCH);
T=diag(R);
[energies4 I]=sort(T, 'ascend’);
energies4=energies4’ ;
save A10.dat energies4 -ascii
%a=5
hel;
a=5;
/=-1*exp(-a);
Hezeros(5,5);
for m=@:3
Vwec((m+1) ,1)=V*sqrt((m+1)*(4-m));
endMESA
n=0:4; a
H=ediag(n*h+(4-n)*h)+diag(Vvec,1)+diag(Vvec,-1);
[Q,R]=eigCH);
Tediag(R);
[energiesS I]=sort(T, 'ascend’);
energiesS=energies5';
save A1l.dat energiesS -ascii
#Problem 3
t=[0:22];
n=Length(t);
v=
[15,17,18,13,15,19,21,20,20,22,24,25,28,26,29,27,30,32,32,32,35,
37,3615
coef fpolyfit(t,v,2)5
A=coeff(1);
Becoeff(2);
C=coefF(3);
tp=0:0.01:22;
yp=polyval (coeff, tp);
ypp=polyval (coeff, t);
“error=sqrt((1/23)*sum(Cypp-v) 2);
yp=yp';
save A12.dat error -ascii
save A13.dat yp -ascii
Isinterpl(t,v, tp);
SesplineCt,v, tp);
save A14.dat I -ascii
save A15.dat S -ascii