Skip to content

Commit

Permalink
fixed quiz 3 shooting method problem
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleniemeyer committed Feb 26, 2020
1 parent 8fe508c commit 04d4002
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions _build/quizzes/quiz3-BVPs.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
next_page:
url: /contributing.html
suffix: .md
search: z t r y delta equation frac begin end ri align infty left right n lambda m solution text ti x b guess sin method tn k h problem annular fin dr boundary eigenvalue prime pi finite difference temperature radius dt where given neq quad ldots forward euler outer described heat transfer step size figure center ode location differences recursion c condition into solve replace eigenfunction principal gather cos bcs therefore associated shooting value target sample quiz problems bvps distribution inner d rm radial distance centerline independent variable constant depends coefficient thermal conductivity thickness annulus assuming choose spatial img src
search: z t r y delta equation frac begin end ri align solution text infty left right x n lambda m ti b guess sin method tn k h problem annular fin dr boundary eigenvalue prime pi finite difference temperature radius dt where given neq quad ldots forward euler leftarrow outer described heat transfer step size figure center ode location differences recursion c condition into solve replace eigenfunction principal gather cos bcs therefore associated shooting value target sample quiz problems bvps distribution inner d rm radial distance centerline independent variable constant depends coefficient thermal conductivity thickness annulus assuming choose spatial img

comment: "***PROGRAMMATICALLY GENERATED, DO NOT EDIT. SEE ORIGINAL FILES IN /content***"
---
Expand Down Expand Up @@ -41,7 +41,7 @@ <h2 id="Problem-1:-Finite-difference-method">Problem 1: Finite difference method
Write the boundary condition at $r = r_2$ in recursion form (i.e., the equation you would implement into your system of equations to solve for temperature).</p>
<h3 id="Solution">Solution<a class="anchor-link" href="#Solution"> </a></h3><p>a.) Replace the derivatives in the given ODE with finite differences, and replace any locations with the $i$ location:
\begin{equation}
r_i \frac{T_{i-1} - 2T_i + T_{i+1}}{\Delta r^2} + \frac{T_{i+1} - T_{i-1}}{\Delta r} - r_i m^2 (T_i - T_{\infty}) = 0
r_i \frac{T_{i-1} - 2T_i + T_{i+1}}{\Delta r^2} + \frac{T_{i+1} - T_{i-1}}{2\Delta r} - r_i m^2 (T_i - T_{\infty}) = 0
\end{equation}
or
\begin{equation}
Expand Down Expand Up @@ -90,20 +90,20 @@ <h3 id="Solution">Solution<a class="anchor-link" href="#Solution"> </a></h3><p>F
z_1' &amp;= y' = z_2 \\
z_2' &amp;= y'' = 4 z_1
\end{align}
with BCs $z_1 (0) = 0$ and $z_2 (0) = 3$, we do not know $y'(0) = z_2(0) = ?$</p>
with BCs $z_1 (x=0) = z_{1,1} = 0$ and $z_1(x=1) = z_{1,3} = 3$, we do not know $y'(0) = z_2(x=0) = z_{2,1} = ?$</p>
<p>Try some guess #1: $y' (0) = 0 = z_2 (0)$, with the forward Euler method:
\begin{align}
z_1 (0.5) &amp;= z_1 (0) + z_2(0) 0.5 = 0 \\
z_2 (0.5) &amp;= z_2 (0) + \left( 4z_1(0) \right) 0.5 = 0 \\
z_1 (1.0) &amp;= z_1 (0.5) + z_2(0.5) 0.5 = 0 \\
z_2 (1.0) &amp;= z_2 (0.5) + \left( 4z_1(0.5) \right) 0.5 = 0
z_{1,2} = z_1 (0.5) &amp;= z_1 (0) + z_2(0) 0.5 = 0 \\
z_{2,2} = z_2 (0.5) &amp;= z_2 (0) + \left( 4z_1(0) \right) 0.5 = 0 \\
z_{1,3} = z_1 (1.0) &amp;= z_1 (0.5) + z_2(0.5) 0.5 = 0 \leftarrow \text{solution 1} \\
z_{2,3} = z_2 (1.0) &amp;= z_2 (0.5) + \left( 4z_1(0.5) \right) 0.5 = 0
\end{align}
so for solution 1: $y(1) = 0 \neq 3$.</p>
<p>For guess #2: $y' (0) = 2 = z_2 (0)$, with the forward Euler method:
\begin{align}
z_1 (0.5) &amp;= z_1 (0) + z_2(0) 0.5 = 1.0 \\
z_2 (0.5) &amp;= z_2 (0) + \left( 4z_1(0) \right) 0.5 = 2.0 \\
z_1 (1.0) &amp;= z_1 (0.5) + z_2(0.5) 0.5 = 2.0 \\
z_1 (1.0) &amp;= z_1 (0.5) + z_2(0.5) 0.5 = 2.0 \leftarrow \text{solution 2} \\
z_2 (1.0) &amp;= z_2 (0.5) + \left( 4z_1(0.5) \right) 0.5 = 4.0
\end{align}
so for solution 1: $y(1) = 2 \neq 3$.</p>
Expand All @@ -116,7 +116,7 @@ <h3 id="Solution">Solution<a class="anchor-link" href="#Solution"> </a></h3><p>F
\begin{align}
z_1 (0.5) &amp;= z_1 (0) + z_2(0) 0.5 = 1.5 \\
z_2 (0.5) &amp;= z_2 (0) + \left( 4z_1(0) \right) 0.5 = 3.0 \\
z_1 (1.0) &amp;= z_1 (0.5) + z_2(0.5) 0.5 = 3.0 \\
z_1 (1.0) &amp;= z_1 (0.5) + z_2(0.5) 0.5 = 3.0 \leftarrow \text{solution 3} \\
z_2 (1.0) &amp;= z_2 (0.5) + \left( 4z_1(0.5) \right) 0.5 = 6.0
\end{align}
so for solution 3: $y(1) = 3$ which is the target.</p>
Expand Down
16 changes: 8 additions & 8 deletions content/quizzes/quiz3-BVPs.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Write the boundary condition at $r = r_2$ in recursion form (i.e., the equation

a.) Replace the derivatives in the given ODE with finite differences, and replace any locations with the $i$ location:
\begin{equation}
r_i \frac{T_{i-1} - 2T_i + T_{i+1}}{\Delta r^2} + \frac{T_{i+1} - T_{i-1}}{\Delta r} - r_i m^2 (T_i - T_{\infty}) = 0
r_i \frac{T_{i-1} - 2T_i + T_{i+1}}{\Delta r^2} + \frac{T_{i+1} - T_{i-1}}{2\Delta r} - r_i m^2 (T_i - T_{\infty}) = 0
\end{equation}
or
\begin{equation}
Expand Down Expand Up @@ -103,22 +103,22 @@ First decompose into two 1st-order ODEs:
z_1' &= y' = z_2 \\
z_2' &= y'' = 4 z_1
\end{align}
with BCs $z_1 (0) = 0$ and $z_2 (0) = 3$, we do not know $y'(0) = z_2(0) = ?$
with BCs $z_1 (x=0) = z_{1,1} = 0$ and $z_1(x=1) = z_{1,3} = 3$, we do not know $y'(0) = z_2(x=0) = z_{2,1} = ?$

Try some guess \#1: $y' (0) = 0 = z_2 (0)$, with the forward Euler method:
\begin{align}
z_1 (0.5) &= z_1 (0) + z_2(0) 0.5 = 0 \\
z_2 (0.5) &= z_2 (0) + \left( 4z_1(0) \right) 0.5 = 0 \\
z_1 (1.0) &= z_1 (0.5) + z_2(0.5) 0.5 = 0 \\
z_2 (1.0) &= z_2 (0.5) + \left( 4z_1(0.5) \right) 0.5 = 0
z_{1,2} = z_1 (0.5) &= z_1 (0) + z_2(0) 0.5 = 0 \\
z_{2,2} = z_2 (0.5) &= z_2 (0) + \left( 4z_1(0) \right) 0.5 = 0 \\
z_{1,3} = z_1 (1.0) &= z_1 (0.5) + z_2(0.5) 0.5 = 0 \leftarrow \text{solution 1} \\
z_{2,3} = z_2 (1.0) &= z_2 (0.5) + \left( 4z_1(0.5) \right) 0.5 = 0
\end{align}
so for solution 1: $y(1) = 0 \neq 3$.

For guess \#2: $y' (0) = 2 = z_2 (0)$, with the forward Euler method:
\begin{align}
z_1 (0.5) &= z_1 (0) + z_2(0) 0.5 = 1.0 \\
z_2 (0.5) &= z_2 (0) + \left( 4z_1(0) \right) 0.5 = 2.0 \\
z_1 (1.0) &= z_1 (0.5) + z_2(0.5) 0.5 = 2.0 \\
z_1 (1.0) &= z_1 (0.5) + z_2(0.5) 0.5 = 2.0 \leftarrow \text{solution 2} \\
z_2 (1.0) &= z_2 (0.5) + \left( 4z_1(0.5) \right) 0.5 = 4.0
\end{align}
so for solution 1: $y(1) = 2 \neq 3$.
Expand All @@ -132,7 +132,7 @@ then, use this guess:
\begin{align}
z_1 (0.5) &= z_1 (0) + z_2(0) 0.5 = 1.5 \\
z_2 (0.5) &= z_2 (0) + \left( 4z_1(0) \right) 0.5 = 3.0 \\
z_1 (1.0) &= z_1 (0.5) + z_2(0.5) 0.5 = 3.0 \\
z_1 (1.0) &= z_1 (0.5) + z_2(0.5) 0.5 = 3.0 \leftarrow \text{solution 3} \\
z_2 (1.0) &= z_2 (0.5) + \left( 4z_1(0.5) \right) 0.5 = 6.0
\end{align}
so for solution 3: $y(1) = 3$ which is the target.
Expand Down

0 comments on commit 04d4002

Please sign in to comment.