You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The solution from RK2 is growing with time, no matter how small a time step we take. RK4 will be conditionally stable, if $h < 2\sqrt{2}/\omega \approx 0.707$.
58
+
:::
59
+
60
+
:::{prf:example} Stability regions of RK
61
+
62
+
```{code-cell}
63
+
r2 = lambda z: 1 + z + z**2/2
64
+
r3 = lambda z: 1 + z + z**2/2 + z**3/6
65
+
r4 = lambda z: 1 + z + z**2/2 + z**3/6 + z**4/24
66
+
67
+
n = 100
68
+
x = linspace(-3,0.5,n)
69
+
y = linspace(-3,3,n)
70
+
X,Y = meshgrid(x,y)
71
+
Z2 = r2(X + 1j*Y)
72
+
Z3 = r3(X + 1j*Y)
73
+
Z4 = r4(X + 1j*Y)
74
+
contour(X,Y,abs(Z2),levels=[1],colors="black")
75
+
contour(X,Y,abs(Z3),levels=[1],colors="blue")
76
+
contour(X,Y,abs(Z4),levels=[1],colors="red")
77
+
xlabel('real(z)'), ylabel('imag(z)')
78
+
title('Stability domain of RK2, RK3, RK4')
79
+
grid(True), axis('equal');
80
+
```
81
+
82
+
Zoomed view around the imaginary axis
83
+
84
+
```{code-cell}
85
+
contour(X,Y,abs(Z2),levels=[1],colors="black")
86
+
contour(X,Y,abs(Z3),levels=[1],colors="blue")
87
+
contour(X,Y,abs(Z4),levels=[1],colors="red")
88
+
axis([-0.3, 0.3, -3, 3])
89
+
xlabel('real(z)'), ylabel('imag(z)')
90
+
title('Stability domain of RK2, RK3, RK4')
91
+
grid(True);
92
+
```
93
+
94
+
RK2 does not enclose any portion of the imaginary axis, it is tangential to it, while RK3 and RK4 enclose a part of the imaginary axis. In case of RK4, the interval $[ -\ii 2\sqrt{2}, \ii 2\sqrt{2}]$ is inside the stability domain.
0 commit comments