User:Egm4313.s12.team11.perez.gp/R6.5

R6.5
Solved by: Gonzalo Perez

Part R4.2, p.7c-26
For each value of n=3,5,9, re-display the expressions for the 3 functions $$ y_{p,n} (x), y_{h,n} (x), y_n (x) \! $$, and plot these 3 functions separately over the interval $$ [0,20 \pi] \! $$.

R4.2 p.7-26: Consider the L2-ODE-CC (5) p.7b-7 with $$ sin x \! $$ as excitation:

$$ y''-3y'+2y=r(x) \! $$              (5)p.7-7

$$ r(x) = sin x \! $$                     (1)p.9-15

and the initial conditions:

$$ y(0) = 1, y'(0) = 0. \! $$                      (3b)p.3-7

Exact solution: $$ y(x) = y_h (x) + y_p (x) \! $$                   (2)p.9-15

Re-display the expressions for $$ y_p (x), y_h (x), y(x) \! $$.

Superpose each of the above plot with that of the exact solution.

Solution
The graphs are to be separately graphed as follows.

For n = 3, the code that will generate the graph looks like this:





For n = 6:





For n = 9:





Part R4.3, p.7c-28
Understand and run the TA's code to produce a similar plot, but over a larger interval $$ [0,10] \! $$. Do zoom-in plots about the points $$ x=-0.5,0,+0.5 \! $$ and comment on the accuracy of different approximations.

R4.3 p.7-28: Consider the L2-ODE-CC (5) p.7b-7 with $$ log(1+x) \! $$ as excitation:

$$ y''-3y'+2y=r(x) \! $$     (5)p.7-7

$$ r(x) = log(1+x) \! $$     (1)p.7-28

and the initial conditions:

$$ y(-\frac{3}{4})=1, y'(-\frac{3}{4})=0 \! $$    (2)p.7-28

Solution
For n=4 (from x = 0 to x = 10):





For n=4 (zoom-in plots around x = -0.5):





For n=4 (zoom-in plots around x = 0):





For n=4 (zoom-in plots around x = +0.5):





For n=7 (from x = 0 to x = 10):





For n=11 (from x = 0 to x = 10):





Where the black line represents n=11 and the blue line represents log(1+x).

The problem asks for n=4, 7, and 11. The TA had up to n=16, but the problem does not ask for this. Manipulating the code and graphs to only account for these n values, n=16 has been disregarded.

Combined plots for n=7 and n=11 (zoom-in plots around x = -0.5):





Combined plots for n=7 and n=11 (zoom-in plots around x = 0):







Combined plots for n=7 and n=11 (zoom-in plots around x = 0.5):





Part R4.4, p.7c-29
Understand and run the TA's code to produce a similar plot, but over a larger interval $$ [0.9,10] \! $$, and for n=4,7. Do zoom-in plots about $$ x=1,1.5,2,2.5 \! $$ and comments on the accuracy of the approximations.

R4.4 p.7-29: Extend the accuracy of the solution beyond $$ \hat{x}=1 \! $$.

Solution
The general code that can be used to graph the plots of n=4,7,11 is:



With the above code, we can add the following code to graph n=4.

For n = 4 (from x = 0.9 to x = 10):





For n = 7 (from x = 0.9 to x = 10):





For n=11 (from x = 0.9 to x = 10):





Repeating the same common part of the code, let's graph the other plots around x = 1, 1.5, 2, 2.5:

For n = 4, 7, 11 at x = 1:





For n = 4, 7, 11 at x = 1.5:





For n = 4, 7, 11 at x = 2:





For n = 4, 7, 11 at x = 2.5:





For the last part, the first (and unchanged TA's code) is the following:



The second part includes the change that had to be made in order to solve this problem: