Numerical Analysis in Engineering
ME 140A, Fall 2007
Homework #6 Solution
Dec 6, 2007
By: Mohamad NasrAzadani: [email protected]
1.
a)
One can integrate
dy
dx
= (1 + 2
x
)
√
y,
y
(0) = 1
(1)
using separation of variables technique. Toward this goal, we may
write
dy
√
y
=
(1 + 2
x
)
dx
Z
dy
√
y
=
Z
(1 + 2
x
)
dx
2
√
y
=
x
+
x
2
+
C,
→
y
(0) = 1
→
C
= 2
y
=
1
2
(
x
+
x
2
) + 1
2
(2)
b)
Euler scheme is applied as following to solve equation (1), numeri
cally
y
n
+1
=
y
n
+
f
(
x
n
, y
n
)Δ
x
(3)
where
f
(
x, y
) is given by
f
(
x, y
) = (1 + 2
x
)
√
y
(4)
One can see the results obtained with Euler scheme in figure 1 for vaious
Δ
x
’s.
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
c) Heun (predictorcorrector) scheme (with no iteration) is implemented
as following to solve equation (1), numerically
y
0
n
+1
=
y
n
+
f
(
x
n
, y
n
)Δ
x
y
n
+1
=
y
n
+
f
(
x
n
, y
n
) +
f
(
x
n
+1
, y
0
n
+1
)
2
Δ
x.
(5)
One can see the results obtained with Heun scheme in figure 2 for vaious
Δ
x
’s.
d) Fourth order RungeKutta is implemented as following to solve equa
tion (1), numerically
k
1
=
f
(
x
n
, y
n
)
k
2
=
f
(
x
n
+ 0
.
5Δ
x, y
n
+ 0
.
5Δ
xk
1
)
k
3
=
f
(
x
n
+ 0
.
5Δ
x, y
n
+ 0
.
5Δ
xk
2
)
k
4
=
f
(
x
n
+ Δ
x, y
n
+ Δ
xk
3
)
y
n
+1
=
y
n
+
Δ
x
6
(
k
1
+ 2
k
2
+ 2
k
3
+
k
4
)
(6)
One can see the results obtained with 4th order RungeKutta method
in figure 3 for vaious Δ
x
’s.
In figure 4), the results for Δ
x
= 0
.
025 obtained using the mentioned
methods are plotted and comnpared with the analytical solutions.
Also, in figure 5, relative error at
y
(1) is plotted vs Δ
x
in logarithmic
scale.
The slope of each line would give us the order of accuracy of
each numerical technique.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Meiburg
 Numerical Analysis, Heun's method, Runge–Kutta methods, dy dt, order RungeKutta method, diﬀerent step sizes

Click to edit the document details