University of Florida/Egm4313/s12.team11.imponenti/R4.4

From testwiki
Jump to navigation Jump to search

Part 3

Solved by Luca Imponenti

Find yn(x) , for n=4,7,11 such that:

yn3yn+2yn=rn(x)

for x in [0.9,3] with the initial conditions found.

Plot yn(x) for n=4,7,11 for x in [0.9,3].

Homogeneous Solution

The homogeneous case is shown below:

y'h3y'h+2yh=0

This equation has the following roots:

λ1=1,λ2=2

Which gives yields the homogeneous solution

yh=c1ex+c2e2x
General Solution, n=4

Using the taylor series approximation from earlier with n=4 we have

r4(x)=log(2)+(x1)2ln(10)(x1)28ln(10)+(x1)324ln(10)(x1)464ln(10)

We know the particular solution, yp4(x), ve will have this form:

yp4(x)=a4(x1)4+a3(x1)3+a2(x1)2+a1(x1)+a0

taking the derivatives of this solution

y'p4(x)=ddxyp4(x)=4a4(x1)3+3a3(x1)2+2a2(x1)+a1

and

y'p4(x)=ddxy'p4(x)=12a4(x1)3+6a3(x1)2+2a2

Plugging the above equations into the original ODE yields the following matrix equation:

[200001220001292000662000232]*[a4a3a2a1a0]=[164ln(10)124ln(10)18ln(10)12ln(10)log(2)]

The unknown vector a can be easily solved by forward substitution,the following values were calculated in matlab:

a4=.0034,a3=.0113,a2=.0577,a1=.1624,a0=.1624

So the particular solution yp4 is

yp4=0.16240.1624*(x1).0577*(x1)2.0113*(x1)3.0034*(x1)4

We can now find the general solution for n=4, y4(x).

y4(x)=yh(x)+yp4(x)

y4(x)=c1ex+c2e2x+0.16240.1624*(x1) .0577*(x1)2.0113*(x1)3.0034*(x1)4

Solving using the initial conditions yields;

        y4(x)=.0595ex.0076e2x+0.16240.1624*(x1)
          .0577*(x1)2.0113*(x1)3.0034*(x1)4
General Solution, n=7

Using the taylor series approximation from earlier with n=7 we have

r7(x)=log(2)+(x1)2ln(10)(x1)28ln(10)+(x1)324ln(10)(x1)464ln(10)+(x1)5160ln(10)(x1)6384ln(10)+(x1)7896ln(10)

In a similar fashion we construct a matrix equation for n=7:

[200000002120000004218200000030152000000201220000001292000000662000000232]*[a7a6a5a4a3a2a1a0]=[1896ln(10)1384ln(10)1160ln(10)164ln(10)124ln(10)18ln(10)12ln(10)log(2)]

Solving:

a7=.0002,a6=.0020,a5=.0141,a4=.0725,a3=.3034,a2=.9029,a1=1.9072,a0=2.1084

So the particular solution yp7 is

yp7=2.1084+1.9072*(x1)+.9029*(x1)2+.3034*(x1)3+.0725*(x1)4+.0141*(x1)5+.0020*(x1)6+.0002*(x1)7

We can now find the general solution for n=7, y7(x).

y7(x)=yh(x)+yp7(x)

y7(x)=c1ex+c2e2x+2.1084+1.9072*(x1)+.9029*(x1)2+

.3034*(x1)3+.0725*(x1)4+.0141*(x1)5+.0020*(x1)6+.0002*(x1)7

Solving using our initial conditions yields

    y7(x)=.7271ex+.0233e2x+2.1084+1.9072*(x1)+   
 .9029*(x1)2+.3034*(x1)3+.0725*(x1)4+.0141*(x1)5+
               .0020*(x1)6+.0002*(x1)7
General Solution, n=11

Using the taylor series approximation from earlier with n=11 we have

r11(x)=log(2)+(x1)2ln(10)(x1)28ln(10)+(x1)324ln(10)(x1)464ln(10)+(x1)5160ln(10)(x1)6384ln(10)+

(x1)7896ln(10)(x1)82048ln(10)+(x1)94608ln(10)(x1)1010240ln(10)+(x1)1122528ln(10)

Finally, we write out the matrix equation for n=11:

File:R4.4.JPG

A*[a11a10a9a8a7a6a5a4a3a2a1a0]=[122528ln(10)110240ln(10)14608ln(10)12048ln(10)1896ln(10)1384ln(10)1160ln(10)164ln(10)124ln(10)18ln(10)12ln(10)log(2)]

Solving the system in matlab:

a11=0,a10=.0002,a9=.0019,a8=.0181,a7=.15,a6=1.0675,a5=6.4597,

a4=32.4318,a3=130.0033,a2=390.3968,a1=781.289,a0=781.6873

So the particular solution yp11 is

yp11=781.6873+781.289*(x1)+390.3968*(x1)2+130.0033*(x1)3+32.4318*(x1)4+

6.4597*(x1)5+1.0675*(x1)6+.15*(x1)7+.0181*(x1)8+.0019*(x1)9+.0002*(x1)10

We can now find the general solution for n=11, y11(x).

y11(x)=yh(x)+yp11(x)

y11(x)=c1ex+c2e2x+781.6873+781.289*(x1)

+390.3968*(x1)2+130.0033*(x1)3+32.4318*(x1)4

6.4597*(x1)5+1.0675*(x1)6+.15*(x1)7+.0181*(x1)8+.0019*(x1)9+.0002*(x1)10

Solving using our initial conditions yields

    y11(x)=287.5907ex+.05e2x+781.6873+781.289*(x1)
     
      +390.3968*(x1)2+130.0033*(x1)3+32.4318*(x1)4
      
               6.4597*(x1)5+1.0675*(x1)6+ 
   
    .15*(x1)7+.0181*(x1)8+.0019*(x1)9+.0002*(x1)10
Plot

y4 shown in red

y7 shown in blue

y11 shown in green

File:Plotr4.JPG

Part 4

Solved by Luca Imponenti

Use the matlab command ode45 to integrate numerically y3y+2y=r(x) with r(x)=log(1+x)

and the initial conditions from Part 3 to obtain the numerical solution for y(x).

Plot y(x) in the same figure as above.

Matlab Solution

The numerical solution calculated using the matlab ode45 command is shown below:

 ans =
   0.2788
   0.2854
   0.2923
   0.2997
   0.3074
   0.3229
   0.3401
   0.3592
   0.3804
   0.4040
   0.4302
   0.4595
   0.4921
   0.5285
   0.5691
   0.6145
   0.6651
   0.7218
   0.7850
   0.8557
   0.9346
   1.0228
   1.1213
   1.2313
   1.3542
   1.4914
   1.6445
   1.8155
   2.0063
   2.2193
   2.4569
   2.7219
   3.0175
   3.3471
   3.7146
   4.1243
   4.5809
   5.0898
   5.6568
   6.2885
   6.9921
   7.3442
   7.7142
   8.1032
   8.5119
Plot

Plotting the aboved vector of y-values,along with the results from earlier yields the following graph:

File:Plotr4ode45.JPG

where the answer calculated in matlab is shown in yellow.

Egm4313.s12.team11.imponenti (talk) 08:04, 14 March 2012 (UTC)

Template:CourseCat