Anda di halaman 1dari 7

Math 432 HW 1.

4 Solutions
Assigned: 1, 5, 6, 7, 8, and 14.

Selected for Grading: 5, 14

Solutions:
1. The given initial-value problem is dy/dx = y(2 – y); y(0) = 3. And we're asked to estimate the value of the
solution at the values x = 0.1, 0.2, 0.3, 0.4, and 0.5 using a step size of h = 0.1.
For this exercise Euler's recursive formula, yn + 1 = yn + h∙f (xn, yn), becomes
yn + 1 = yn + 0.1yn(2 – yn).
Using this formula and starting with y0 = 3, I got the following values:

n xn yn
0 0 3
1 0.1 2.7
2 0.2 2.511
3 0.3 2.38269
4 0.4 2.29151
5 0.5 2.22471

5. The given initial-value problem for this exercise is y' = (1/x)(y2 + y); y(1) = 1. We're asked to use h = 0.2
to estimate the values of the solution at the values x = 1.2, 1.4, 1.6, and 1.8.
The formula to use this time is yn + 1 = yn + 0.2(1/xn)(yn2 + yn).
This gives the following values:

n xn yn
0 1 1
1 1.2 1.4
2 1.4 1.96
3 1.6 2.7888
4 1.8 4.10958

6. Given: y' = x – y2; y(1) = 0. Using a step size of h = 0.1, estimate the value of the solution at x = 1.1, 1.2,
1.3, 1.4, and 1.5.
The formula to use is yn + 1 = yn + 0.1(xn – yn2).
Here's what I got:

n xn yn
0 1 0
1 1.1 0.1
2 1.2 0.209
3 1.3 0.32463
4 1.4 0.44409
5 1.5 0.56437
7. This time we need to estimate the value of the solution at the same t-value, t = 1, but four different times.
The initial-value problem is x' = 1 + t sin(tx); x(0) = 0.
The formula to use is xn + 1 = xn + h(1 + tn sin(xn)).
Taking N = 1 step we have h = 1, which gives the following:
n tn xn
0 0 0
1 1 1
Taking N = 2 steps we have h = 0.5, which gives the following:

n tn xn
0 0 0
1 0.5 0.5
2 1 1.06185

Taking N = 4 steps we have h = 0.25, which gives the following:

n tn xn
0 0 0
1 0.25 0.25
2 0.5 0.5039
3 0.75 0.78507
4 1 1.1392

Taking N = 8 steps we have h = 0.125, which gives the following:

n tn xn
0 0 0
1 0.125 0.125
2 0.25 0.25024
3 0.375 0.3772
4 0.5 0.50881
5 0.625 0.64954
6 0.75 0.80539
7 0.875 0.98363
8 1 1.19157
8. The initial-value problem is y' = 1 – sin y; y(0) = 0.
Euler's formula for this exercise is yn + 1 = yn + h(1 – sin yn).

Taking N = 1 step (with h = π) we get:

n xn yn
0 0 0
1 3.14159 3.14159

Taking N = 2 steps (with h = π/2) we get:

n xn yn
0 0 0
1 1.5708 1.5708
2 3.14159 1.5708
Taking N = 4 steps (with h = π/2) we get:

n xn yn
0 0 0
1 0.7854 0.7854
2 1.5708 1.01544
3 2.35619 1.13347
4 3.14159 1.20739

Taking N = 8 steps (with h = π/2) we get:

n xn yn
0 0 0
1 0.3927 0.3927
2 0.7854 0.63512
3 1.1781 0.79484
4 1.5708 0.90725
5 1.9635 0.99058
6 2.35619 1.05484
7 2.74889 1.10596
8 3.14159 1.14763
14. Our initial-value problem is y' = 2xy2; y(0) = 1. We want to find the approximation on the interval [0, 2]
four times, with h = 0.5, 0.1, 0.01, and 0.01.

Here, all in one place, are the four approximations:


For h = 0.5, φ(2) ≈ 24.84375;
for h = 0.1, φ(2) ≈ 6.4573 × 10176;
for h = 0.05, φ(2) ≈ something so large that Excel can't express it;
and the same happens for h = 0.01
I've included a graph at the end of this solution to show why this happens.

Here are the tables of values that you should get.

For h = 0.5:
n xn yn
0 0 1
1 0.5 1
2 1 1.5
3 1.5 3.75
4 2 24.84375

For h = 0.1:
n xn yn
0 0 1
1 0.1 1
2 0.2 1.02
3 0.3 1.061616
4 0.4 1.129237712
5 0.5 1.231251937
6 0.6 1.38285007
7 0.7 1.612322988
8 0.8 1.976264946
9 0.9 2.601164648
10 1 3.819055003
11 1.1 6.736091225
12 1.2 16.71857472
13 1.3 83.80115252
14 1.4 1909.685775
15 1.5 1023041.618
16 1.6 3.13985E+11
17 1.7 3.15478E+22
18 1.8 3.38389E+44
19 1.9 4.12225E+88
20 2 6.4573E+176
For h = 0.05 the values eventually get too large for Excel to represent them:
n x n yn
0 0 1
1 0.05 1
2 0.1 1.005
3 0.15 1.01510025
4 0.2 1.030556678
5 0.25 1.051797619
6 0.3 1.079454575
7 0.35 1.11441124
8 0.4 1.157878175
9 0.45 1.211505449
10 0.5 1.277553995
11 0.55 1.359161205
12 0.6 1.46076376
13 0.65 1.588793606
14 0.7 1.752870839
15 0.75 1.967949772
16 0.8 2.258411744
17 0.85 2.666445633
18 0.9 3.270789879
19 0.95 4.233615859
20 1 5.936348666
21 1.05 9.460372215
22 1.1 18.85772967
23 1.15 57.9752662
24 1.2 444.5053877
25 1.25 24154.71015
26 1.3 72955407.49
27 1.35 6.91924E+14
28 1.4 6.46324E+28
29 1.45 5.84829E+56
30 1.5 4.9594E+112
31 1.55 3.6893E+224
32 1.6 #NUM!
33 1.65 #NUM!
34 1.7 #NUM!
35 1.75 #NUM!
36 1.8 #NUM!
37 1.85 #NUM!
38 1.9 #NUM!
39 1.95 #NUM!
40 2 #NUM!
And again, for h = 0.01, the values get too large – even sooner this time, near x = 1.14.
n xn yn n xn yn n xn yn
0 0 1 50 0.5 1.321216165 100 1 18.2987638
1 0.01 1 51 0.51 1.338672287 101 1.01 24.9956589
2 0.02 1.0002 52 0.52 1.35695113 102 1.02 37.6162747
3 0.03 1.00060016 53 0.53 1.37610082 103 1.03 66.4819507
4 0.04 1.00120088 54 0.54 1.396173547 104 1.04 157.530856
5 0.05 1.002002803 55 0.55 1.417225993 105 1.05 673.703045
6 0.06 1.003006813 56 0.56 1.439319818 106 1.06 10205.0947
7 0.07 1.00421404 57 0.57 1.462522203 107 1.07 2218056.99
8 0.08 1.005625864 58 0.58 1.486906475 108 1.08 1.0529E+11
9 0.09 1.007243917 59 0.59 1.512552809 109 1.09 2.3944E+20
10 0.1 1.00907009 60 0.6 1.539549038 110 1.1 1.2498E+39
11 0.11 1.011106535 61 0.61 1.567991573 111 1.11 3.4363E+76
12 0.12 1.013355675 62 0.62 1.597986463 112 1.12 2.621E+151
13 0.13 1.01582021 63 0.63 1.629650616 113 1.13 1.539E+301
14 0.14 1.018503126 64 0.64 1.663113206 114 1.14 #NUM!
15 0.15 1.021407702 65 0.65 1.698517309 115 1.15 #NUM!
16 0.16 1.024537523 66 0.66 1.736021803 116 1.16 #NUM!
17 0.17 1.02789649 67 0.67 1.775803589 117 1.17 #NUM!
18 0.18 1.031488832 68 0.68 1.8180602 118 1.18 #NUM!
19 0.19 1.035319121 69 0.69 1.863012863
20 0.2 1.039392287 70 0.7 1.910910137
21 0.21 1.043713632 71 0.71 1.962032222
22 0.22 1.048288853 72 0.72 2.016696122
23 0.23 1.053124054 73 0.73 2.075261833
24 0.24 1.058225778 74 0.74 2.138139824
25 0.25 1.063601018 75 0.75 2.205800124
26 0.26 1.069257254 76 0.76 2.278783437
27 0.27 1.075202471 77 0.77 2.357714817
28 0.28 1.081445197 78 0.78 2.443320632
29 0.29 1.08799453 79 0.79 2.536449757
30 0.3 1.094860176 80 0.8 2.638100279
31 0.31 1.102052489 81 0.81 2.749453449
32 0.32 1.109582511 82 0.82 2.871917256
33 0.33 1.117462021 83 0.83 3.007182959
34 0.34 1.125703582 84 0.84 3.157299238
35 0.35 1.1343206 85 0.85 3.324770685
36 0.36 1.143327382 86 0.86 3.512690386
37 0.37 1.152739205 87 0.87 3.724921079
38 0.38 1.162572381 88 0.88 3.966346723
39 0.39 1.172844348 89 0.89 4.243228275
40 0.4 1.183573746 90 0.9 4.563717029
41 0.41 1.19478052 91 0.91 4.938612265
42 0.42 1.206486024 92 0.92 5.382508283
43 0.43 1.218713136 93 0.93 5.915581959
44 0.44 1.231486387 94 0.94 6.566472403
45 0.45 1.244832104 95 0.95 7.377101328
46 0.46 1.258778566 96 0.96 8.411112184
47 0.47 1.273356182 97 0.97 9.769450901
48 0.48 1.28859768 98 0.98 11.62102902
49 0.49 1.304538327 99 0.99 14.267976
Here is a graph of the actual solution y = 1/(1 – x2).
y


x

        









Euler's method isn't converging on any particular value because, for xn ≈ 1, the slopes are nearly infinite, and
so the tangent line approximation takes us far away from the solution's graph.

Anda mungkin juga menyukai