Files
TMA4135/exercise8/problem1.typ
2025-10-21 06:56:07 +02:00

47 lines
1.1 KiB
Typst

#import "lib.typ": butcher
= problem 1
<p1>
== a)
the following runge-kutta method -- ralston's method -- has an order of 3, since
we have three upper rows in our butcher tableau.
#butcher(3, (
$1 slash 2$,
$1 slash 2$,
$3 slash 4$,
0,
$3 slash 4$,
$2 slash 9$,
$1 slash 3$,
$4 slash 9$,
))
== b)
let $f(t, y) := y'(t) = t e^(-y)$, with $y(0) = 0$.
to compute the first step of ralston's method, we need to compute each stage
derivative using the step size $h = 0.48$
$
k_1 & = f(t_0, y_0) = 0 dot e^(-0) = 0 \
k_2 & = f(t_0 + h/2, y_0 + k_1 h / 2) = 0.24 dot e^(-0) = 0.24 \
k_3 & = f(t_0 + 3/4 h, y_0 + 3/4 k_2 h) = 0.36 dot e^(-3/4 dot 0.24 dot 0.48) \
& = #let t = { 0.36 * calc.exp(-3 / 4 * 0.24 * 0.48) }; #t
$
then we can combine these using
$
y_(n+1) = y_n + h sum_(i=1)^s b_i k_i
$
where $s$ is our order, 3, and $b_i$ are the coefficients along the bottom row.
thus we obtain
$
y_1 & = y_0 + 0.48 dot sum_(i=1)^3 b_i k_i \
& = 0.48 dot (2/9 dot 0 + 1/3 dot 0.24 + 4/9 dot #calc.round(t, digits: 4)) \
& = #{ 0.48 * (2 / 9 * 0 + 1 / 3 * 0.24 + 4 / 9 * t) }
$
after one step of ralston's method.