File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ RecipesBase 0.1.0
3
3
DiffEqBase 3.0.0
4
4
RecursiveArrayTools 0.4.0
5
5
DiffEqPDEBase 0.4.0
6
+ NLsolve 0.14.1
6
7
DiffEqMonteCarlo
7
8
DiffEqNoiseProcess
8
9
Juno
Original file line number Diff line number Diff line change
1
+ using NLsolve
1
2
"""
2
3
`Base.length(tab::ODERKTableau)`
3
4
@@ -15,3 +16,16 @@ r(z) = \\frac{\\det(I-zA+zeb^T)}{\\det(I-zA)}
15
16
```
16
17
"""
17
18
stability_region (z,tab:: ODERKTableau ) = det (eye (tab. stages)- z* tab. A + z* ones (tab. stages)* tab. α' )/ det (eye (tab. stages)- z* tab. A)
19
+
20
+ """
21
+ `stability_region(tab::ODERKTableau)`
22
+
23
+ Calculates the length of the stability region in the real axis.
24
+ """
25
+ function stability_region (tab:: ODERKTableau ; initial_guess= - 3.0 )
26
+ residual! = function (resid, x)
27
+ resid[1 ] = abs (stability_region (x[1 ], tab)) - 1
28
+ end
29
+ sol = nlsolve (residual!, [initial_guess])
30
+ sol. zero[1 ]
31
+ end
Original file line number Diff line number Diff line change
1
+ using DiffEqDevTools, Base. Test
2
+
3
+ @test stability_region (constructDormandPrince6 (), initial_guess= - 3.5 ) + 3.95413 < 1e-3
4
+ @test stability_region (constructTsitourasPapakostas6 (), initial_guess= - 3.5 ) + 3.95413 < 1e-3
5
+ @test stability_region (constructRadauIIA5 (), initial_guess= 12. ) - 11.84 < 1e-2
You can’t perform that action at this time.
0 commit comments