You are on page 1of 13

NE-333, Homework #5

Due Wednesday, 3/14/2012


General homework guidelines (applicable to this assignment, and all others this term). Please
show all the work that you do to arrive at your answer. You should include sufficient detail such
that someone reasonably familiar with current class material could follow your work and reproduce
your conclusions. Collaboration is allowed and encouraged, but you should be sure you can do all
the work on your own. Each assignment must also be written up individually by each student.
Clearly identify which problem you are solving. It would not be inappropriate to print out these
assignments and use each problem description as a cover sheet. Please use plenty of space for your
work. Do not cram your results into as few lines as possible. Paper is cheap. People concerned
about sustainable homework are encouraged to use recycled paper and to write on both sides!
When working with systems of linear equations you should manually solve any problem up to 3x3
size. You may use computer aids to solve larger systems, but make sure it is clear what
system/problem you are solving as well as what is the result.
Homework assignments are due at the beginning of class on the due date.
You may (should) use computer aids to check your work, but except as stated above, the assigned
problems should be worked manually in accordance with the methods given in class.
1. (10 points) The general solution of the Airy ODE was shown in class to be:
1
2
3 6 9
0
( )
4 7 10
1
( )
( ) 1 ...
(3)(2) (6)(5)(3)(2) (9)(8)(6)(5)(3)(2)
...
(4)(3) (7)(6)(4)(3) (10)(9)(7)(6)(4)(3)
y x
y x
x x x
Y x a
x x x
a x
1
+ + + +
1
]
1
+ + + + +
1
]
1 4 4 4 4 4 4 4 442 4 4 4 4 4 4 4 4 43
1 4 4 4 4 4 4 4 4 4 2 4 4 4 4 4 4 4 4 4 3
Given initial conditions Y(0) = 1 and Y(0) = 1, find the value of the arbitrary constants a
0
and a
1
and then write a MATLAB code to calculate and plot y
1
(x), y
2
(x) and
0 1 1 2
( ) ( ) ( ) Y x a y x a y x +
on the interval [-7,+3]. Note that you will need to retain terms up
to and including powers of x
51
in y
1
(x) and x
52
in y
2
(x) to obtain an accurate solution
throughout this interval. Also note that the Airy functions built into MATLAB are NOT
the same as the y
1
(x) and y
2
(x) solutions. Include copies of your code and output with your
assignment.
Important: to avoid calculation overflow/underflow, you should calculate each successive
term in the series from the previous term, that is, if you need to calculate the partial sum

2 3 10 10
10
0
1
! 2! 3! 10!
n
i
x x x x
S x
n

+ + + + +

L
DO (something like):
term=1; % set term equal to i=0 term of series
sum=term; % set initial value of running sum
for i=1:10
term=term*x/i; % calculate next term from current term
sum=sum+term; % update running sum
end
DO NOT DO (anything like):
sum=1; % set sum equal to i=0 term of series
for k=1:10
% calculate each successive term from scratch
% and add it to running sum
sum=sum+x^k/factorial(k);
end
%airyfunction
%Y(x(1))
clc, clear all
x=-7:3; %Interval of the sequence
n=3; %Starting Value for the Power for y1(x)
%Have to use n=3 because otherwise we would be adding huge numbers if it
%was to the i
term=1; % set term equal to i=1 for first term of series
sum=term; % set initial value of running sum
for i=3:3:51;
term=term.*(x.^n/((i)*(i-1))); % calculate next term from current term
by using the given series
sum=sum+term;% update running sum
end
%Producing the values of the series
onesum=sum+1;
%Plotting the Series vs. the x values

subplot(1,2,1); plot(x,onesum)
xlabel 'x'%Labeling the Graph
ylabel 'y'
hold on
%Y(x(2))
t=-7:3; %Interval of the sequence
k=3; %Starting Value for the Power for y1(x)
%Have to use n=3 because otherwise we would be adding huge numbers if it
%was to the i
term=t; % set term equal to i=x first term of series
sum=term; % set initial value of running sum
for i=4:3:52
term=term.*(t.^k/((i)*(i-1))); % calculate next term from current term
sum=sum+term;% update running sum
end
%Producing the values of the series
twosum=sum;
%Plotting the Series vs. the x values
P=plot(t,twosum);
set(P,'Color','green','LineWidth',2)
L=legend('Y(x(1))','Y(x(2))');
title('y(0) = 1 and y(0) = 1');
F = get(gca, 'title');
set(F,'FontWeight', 'bold', 'FontName', 'Helvetica','FontSize', 8)
xlabel 'x' %Labeling the Graph
ylabel 'y'

hold off

y= twosum + onesum;
subplot(1,2,2); plot(x,y, 'Color','black', 'LineWidth',2);
axis([-7 3 0 30])
xlabel 'x'%Labeling the Graph
ylabel 'y'
title({'Y(x(2)) + Y(x(2))'});
T = get(gca, 'title');
set(T,'FontWeight', 'bold', 'FontName', 'Helvetica','FontSize', 8)
L = get(gca, 'title');
- 8 - 6 - 4 - 2 0 2 4
- 2
0
2
4
6
8
1 0
1 2
1 4
1 6
x
y
y ( 0 ) = 1 a n d y ( 0 ) = 1


- 7 - 6 - 5 - 4 - 3 - 2 - 1 0 1 2 3
0
5
1 0
1 5
2 0
2 5
3 0
x
y
Y ( x ( 2 ) ) + Y ( x ( 2 ) )
Y ( x ( 1 ) )
Y ( x ( 2 ) )
Airy ODE

(10 points) Find the solution to the equation 0 y y x y
about the ordinary point
0
0 x using power series methods. Find the general solution and explicitly state the first
four non-zero terms of each of the two linearly independent solutions. Also state the
general solution in terms of infinite power series (i.e., state the general series in power
series notation).
3 * 5 * 7 7
5
2 * 4 * 6 6
4
3 * 5 5
3
2 * 4 4
2
3
1
) 2 (
) 1 ( ) 1 )( 2 ( 0 ) 1 ( ) 1 )( 2 (
2
2 0 2
0 ] ) 1 )( 2 [( 2
) ( ) 1 )( 2 ( 2
0 ) 1 ( ) 1 )( 2 (
0 ) 1 ( ) 1 )( 2 (
) 1 )( 2 ( ... 2 * 3 * 4 2 * 3 1 * 2 ) (
) 1 ( ... 3 2 ) (
... ) (
1 5
7
0 4
6
1 3
5
0 2
4
1
3
2
2 2
0
2 0 2 0 2
1
2 0 2
1 1
0
1
2 2
0 0
1
1
0
2
0 0
1
0
2
0
2
4
4
2
3 2
' '
0
1
2
3 2 1
'
0
2
2 1
a a
a n
a a
a n
a a
a n
a a
a n
a
a n
n
a
a
n a a n n n a a n n
a
a a a a a
x a na a n n a a
x a a x a n x a n n a
x a x a n x a n n
x a x a n x x a n n
x a n n x a x a a x y
x a n x a x a a x y
x a x a x a a x y
n
n
n n n n
n
n
n n n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n
n o





+

+ + + + + +

+ + +
+ + +
+ + +
+ + +
+ + + +
+ + +
+ + +
+
+ +

+
+

2 4 6 3 5 7
0 1
:
( ) [1 ...] [ ...]
2 4*2 6*4*2 3 5*3 7*5*3
General Solution
x x x x x x
y x a a x + + + + + + + + +
2 2 1
0 0
:
1 2 ( !)
1( ) , 2( )
2 ! (2 1)!
m
m m
m
m m
SumationSolution
m
y x x y x x
m m

+


+

2. (10 points) The ODE 4 0 y y + has the solution about x
0
= 0 of the form
( ) ( ) ( )
( )
( ) ( ) ( )
2 4 6 3 5 7
0 1
1 2
( ) ( )
2 2 2 2 2 2
( ) 1 ... 2 ...
2! 4! 6! 3! 5! 7!
y x y x
x x x x x x
Y x a a x
1 1
+ + + + + 1 1
1 1
] ]
1 4 4 4 4 4 2 4 4 4 4 4 3 1 4 4 4 4 4 42 4 4 4 4 4 43
Suppose we wish to examine the behavior of partial sum approximations to y
2
(x). Using
MATLAB, write a code to calculate and plot the first 50 non-zero terms of
2
( ) y x
on the
interval [-5,5], that is plot
( )
( ) ( ) ( ) ( )
3 5 7 99
2,50
2 2 2 2
( ) 2 ...
3! 5! 7! 99!
x x x x
y x x + +
Also plot five term (i.e., powers up to x
9
) and ten term (i.e., powers up to x
19
)
approximations to
2
( ) y x
. By comparing the five and ten term approximations with the 50
term approximation, determine in what interval each of the lower approximations is within
+/-0.001 of the 50 term approximation. Note that you should follow the guidance given in
problem #1 to avoid computational overflow/underflow errors. Include copies of your
code and output with your assignment.
%Determing the interval where the 5 and 10 term approximations are within
%+/-.0001 of the 50 term approximation.

%Fifty_Term_Approximation
clc, clear all
x=-5:.01:5; %x interval from -5 to 5 in increments of .0001
n=2; %Power Used in the given series
term=2*x; % set term equal to 2*x for i=0 term of the series
sum=term; % set initial value of running sum
for i=3:2:99 %Iteration to conduct a 50 term approximation
term=(-1^((i-1)/2))*(term.*((2*x).^n))/(factorial(i)/factorial(i-2));
% calculate next term by multiplying the current term by the equation
% found
sum=sum+term; % update running sum
end
subplot(4,1,1);plot (x,sum); %Plot the 50 term approximation vs. the x values

hold on %Used to put multiple plots on one graph
xlabel 'x' %Labeling the Graph
ylabel 'y'

%Five Term Approximation
z=-5:.01:5; %Interval between -5 and 5, with increments of .01
n=2; %Power used in the equation
term1=2*z; % set term equal to i=2*x term of series
sum1=term1; % set initial value of running sum
for i=3:2:9
%Write the equation and iterate a to find a series
term1=(-1^((i-1)/2))*(term1.*((2*z).^n))/(factorial(i)/factorial(i-2));
% calculate next term by multiplying the current term by the equation
% found
sum1=sum1+term1; % update running sum
end
sum1; %Final sums of the series at the respective x values
plot(x,sum1, 'r')%Plot of the Series vs. the x values for the five term
approximation
xlabel 'x' %Labeling the Plot
ylabel 'y'
axis([-5 5 -2 2])
hold on
%Ten Term Approximation
t=-5:.01:5;
n=2;
term2=2*t; % set term equal to i=0 term of series
sum2=term2; % set initial value of running sum
for i=3:2:19 %iteration to find the ten term approximation
term2=(-1^((i-1)/2))*(term2.*((2*t).^n))/(factorial(i)/factorial(i-2));
% calculate next term by multiplying the current term by the equation
% found
sum2=sum2+term2; % update running sum
end

plot(x,sum2,'black');%Plotting the ten term approximation

legend('sum','sum1','sum2')
T=title({'First 50 Non-Zero Terms', 'y"+4y=0: solution about x0 = 0'});
F = get(gca, 'title');
set(F,'FontWeight', 'bold', 'FontName', 'Helvetica','FontSize', 16)
set(F,'FontWeight', 'bold', 'FontName', 'Helvetica','FontSize', 16)





A=sum-sum1; %50 Aerm Approximation-5 Term Approximation
B=sum-sum2; %50 Term Approximation-10 Term Approximation
subplot(4,1,2); plot(x,A,'b'); %Plotting A
hold on
plot(x,B,'r') %Plotting B
hold off
legend('A','B')


%compare the grapgs and values for A and B with respect to the 50th term
%approx and the

subplot(4,2,5);plot(x, sum,'black','linewidth',2)
axis([-1.7 -1.5 -.5 .5])
hold on
plot(x,A,'b')
hold on
plot(x,B,'r')

subplot(4,2,6);plot(x, sum,'black','linewidth',2)
axis([1.5 1.7 -.5 .5])
hold on
plot(x,A,'b')
hold on
plot(x,B,'r')
-5 -4 -3 -2 -1 0 1 2 3 4 5
-2
0
2
x
y
First 50 Non-Zero Terms
y"+4y=0: solution about x0 = 0


-5 -4 -3 -2 -1 0 1 2 3 4 5
-2000
0
2000


sum
sum1
sum2
A
B
The interval each of the lower approximations is within +/-0.001 of the 50 term approximation:
For the 5 term approximation with regards to the 50 term approximation, the values of x are
[-1.320, 1.320],
For the difference between the 50 term approximation and the 10 term approximation the values of
x are [-3.130, 3.130]
(10 points) The Bessel Equation of order 0 with parameter 1 is 0 y x y x y x
2 2
+ + . Perform
the following:
a) Show that x
0
= 0 is a regular singular point of the Bessel equation of order 0 with
parameter 1.
0 lim ) 1 * ( lim ) ( * ) ( lim ) 2
1 1 lim )
1
)( ( lim ) ( * ) ( lim ) 1
0 ) ( ) ( 0
1
0
0 , 1 , 0 * ) (
2
0
2
0
2
0 0
' ' 2 2
2 2 2


+ + + + + +
+ +


x x x q x x
x
x x p x x
x q x p y y y
x
y y x y x y x
y x y x y x
x x
o
x x
x x
o
x x
o
o

This proves that x
o
=0 is a regular singular point
b) Show that the solution J
0
(x) which is given below converges for all values of x>0
(i.e., show that the series has an infinite radius of convergence).
Ratio Test:
converges
n
x
n
x
n n n n
n n
n
n
x
x
n
n
n x
n x
n
n
n
n
n
n
n
n
n
n
n
n
n
n n n
n n n
n
, 1
1
lim
2
1
1
1
*
2
1
* 1 * * 1 lim
2
1
2
2
) 2 (
) 2 (
1
1
) 1 )( 2 )...( 1 )( )( 1 (
) 1 )( 2 )...( 1 (
)! 1 (
!
*
) 2 (
) 2 (
*
) )! 1 ((
) ! (
*
) 1 (
) 1 (
lim
) 2 ! /( ) 1 (
) 2 )!* 1 /(( ) 1 (
lim
1 ) 1 ( 2 ) 1 (
2
2
1 2
2 ) 1 (
2
2
2 ) 1 (
2 2
2 ) 1 ( ) 1 ( 2 ) 1 (
<
+
+

+
+

+


+ +
+
+
+

+ + +

c) Use MATLAB to plot the J
0
(x) solution (about the point x
0
= 0) which was shown
in class to be
( )
) 0 x (
2 ! n
x ) 1 (
1 ) x ( J
1 n
2
n
n 2 n
0
>

Although the above solution is technically valid only for x > 0, we can define J
0
(0) = 1.
Plot this function on the interval [0,10]. Note that you will need to retain terms up to and
including powers of x
30
to obtain an accurate solution throughout this interval. Also note
that you should follow the guidance given in problem #1 to avoid computational
overflow/underflow errors. Include copies of your code and output with your assignment.
%Plotting the series Jo(x)=1+(the sum from 1 to
%inf.)((-1^n)*x^(2n))/(factorial(n)*2^n)^2 for x>0
x=0:.01:10 %Interval between 0 to 10
term=1; % set term equal to 1 for i=0 term of the series
sum=term; % set initial value of running sum
for i=1:15 %30 iterations
term=term.*((-1)*(x.^(2)))/(i*2)^2;
%Calculating the next term by multiplying the previous term with the
given function.
sum=sum+term; % update running sum
end
sum; %the entire series from 1 to 30 plus the original value of 1 at a0
%Ploting the series verse values of x from 0 to 10
plot(x,sum)%Plotting the sum vector with the x interval from 0 to 10.
xlabel 'x'%Labeling the graph
ylabel 'y'
0 1 2 3 4 5 6 7 8 9 10
-0.5
0
0.5
1
x
y
(10 points) The Bessel Equation of order is 0 y
4
1
x y x y x
2 2

,
_

+ +
. Perform
the following:
a) Find the first solution about the regular singular point x
0
= 0 using the method of
Frobenius. State your solution in terms of an infinite power series. As part of your
solution, show that the leading coefficient a
0
has the value
/ 2
for 2 / 1 per
the definition given in class, which was )) 1 ( 2 /( 1 ) ( a
0
+

. You will need to
either calculate or look up the value of ( ) 3 2 .
v r
v r
v r v r r r a Line
x a v a a n r a n r n r
a v a r ra r x v a ra a r r x
x a v a a n r a n r n r
x v a x v a x a r x ra x a r r x a r r
x a x a x a n r x a n r n r
x a n r n r x y
x a n r x y
x a x y
n
n r
n n n n
r r
n
n r
n n n n
r r r r r r
n n
n r
n
n r
n
n
n r
n
n
n r
n
n
n r
n
n
n r
n
n
n r
n

t
+
+ + + + +
+ + + + + +
+ + + + + +
+ + + + +
+ + + + +
+ +
+

+ + +

+ + +

+
1
2 2 2 2
0
2
2
2
1
2
1 1
1 2
0 0 0
2
2
2
1 2
1
2
0
1
1 0
1
1 0
0 0
2 2
0 0
0
2 ' '
1
0
1 '
1
0
1
0 0 ] [ 1
0 ] ) ( ) 1 )( [(
] ) 1 ( ) 1 [( ] ) 1 ( [
0 ] ) ( ) 1 )( [(
) 1 ( ) )( 1 ( ) 1 (
) ( ) 1 )( (
) 1 )( ( ) (
) ( ) (
) (

... 4 , 3 , 2
) 1 (
0 ) 2 (
0 ) ( ) (
0 ] ) ( ) 1 ( ) 1 [(
0 # ; ( 2
2
2
2
2
2
2 2
2
2
2 1 1
1

+

+ + +
+ + + + + +
+ + + + +

+

n
n n
a
a
a a nv nv n
v a a a v n a v v vn n nv n
x v a a a v n a v va v
some v r Line
n
n
n n
n n n n
n
n r
n n n

0
2
2
1
1
0
4
4
6
0
2
2
4
0
2
)! 1 2 (
) 1 (
* ) (
:
2 * 3 * 4 * 5 * 6 * 7
) 1 (
) 1 6 ( 6
2 * 3 * 4 * 5
) 1 (
) 1 4 ( 4
) 3 ( 2
n
n n
o
n
x
x a x y
Solution First
a a
a
a a
a
a
a
]
)! 1 2 (
) 1 (
1 [ * * / 2 ) (
/ 2 7978845608 . )
2
1
(
)) 2 / 3 ( * 2 (
1
)
2
1
(
)) 1 ( * 2 (
1
) (
53 8862269254 . ) 2 / 3 (
1
2
2
1
1
0
2
1 0
0


n
n n
v
n
x
x x y
a
a
v
v a

b) Explicitly state the first four non-zero terms of the first solution
]
! 7 ! 5 ! 3
1 [ * * / 2 ) (
]
) 2 )( 3 )( 4 )( 5 )( 6 )( 7 ( ) 2 )( 3 )( 4 )( 5 ( ) 2 )( 3 (
1 [ * * / 2 ) (
6 4 2
2
1
1
6 4 2
2
1
1
x x x
x x y
x x x
x x y
+
+

c) Find the Taylor Series representation for sin(x) and show that
) 0 x ( x sin
x
2
) x ( J
2 / 1
>

...)
! 7 ! 5 ! 3
( / 2 ) sin( *
...
! 7 ! 5 ! 3
) sin(
sin
)! 1 2 (
) 1 (
7 5 3
7 5 3
0
1 2
x x x
x x a
x x x
x x
x
n
x
o
n
n n
+
+

off Checks x x
x
x
x
x x x
x x x
x x
n
x
x
x
x n
x
x x J
n
x
x a
x x x
x x a
n
n n
n
n n
n
n n
o
*
2 2
*
*
2 * 2
* / 2
2
*
...)
! 7 ! 5 ! 3
1 ( * * / 2
)! 1 2 (
) 1 (
*
2
*
) sin( *
2
)! 1 2 (
) 1 (
*
2
* ) (
)! 1 2 (
) 1 (
* * ...)
! 7 ! 5 ! 3
1 ( * * / 2 ) sin( *
6 4 2
0
2
0
2
2 / 1
0
2
0
6 4 2


+
+

+
0
2
2 / 1
0
2 6 4 2
)! 1 2 (
) 1 (
* *
2
sin
2
) (
*
2
*
2
)! 1 2 (
) 1 (
* ...)
! 7 ! 5 ! 3
1 ( * ) sin(
n
n n
n
n n
n
x
x x
x
x J so
x x
x
also
n
x
x
x x x
x x


Note: I am aware that this equation is solved in several widely available mathematics texts
(and web articles). It will benefit you to solve this equation yourself, perhaps checking
Boyce & DiPrima after you are done to make sure you got the right result. It will not
benefit you at all to merely copy the solution out of a textbook. Show your work; B&D
skips over a lot of intermediate steps.
Extra Credit #1: Up to +3 points for typing the non-code portions of this assignment (i.e.,
problems 2, 4 and 5).
ASSIGNMENT IS TYPED
Extra Credit #2: (up to +2 points) Determine the interval for which the y
2,50
(x) solution in
problem #3 is within +/- 0.001 of the complete infinite series representation of y
2
(x).

You might also like