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
While the default algorithms, along with `alg_hints = [:stiff]`, will suffice in most cases, there are times when you may need to exert more control. The purpose of this part of the tutorial is to introduce you to some of the most widely used algorithm choices and when they should be used. The corresponding page of the documentation is the [ODE Solvers](https://docs.juliadiffeq.org/dev/solvers/ode_solve/) page which goes into more depth.
2
8
3
9
## Diagnosing Stiffness
@@ -36,46 +42,46 @@ sol = solve(prob,Tsit5())
36
42
retcode: MaxIters
37
43
Interpolation: specialized 4th order "free" interpolation
38
44
t: 999977-element Array{Float64,1}:
39
-
0.0
45
+
0.0
40
46
4.997501249375313e-10
41
47
5.4972513743128435e-9
42
-
3.289919594544218e-8
43
-
9.055581394883546e-8
48
+
3.289919594544218e-8
49
+
9.055581394883546e-8
44
50
1.7309428803584187e-7
45
-
2.79375393394586e-7
46
-
4.149527171475212e-7
47
-
5.807919390815544e-7
48
-
7.81280701490125e-7
49
-
⋮
50
-
1.8457012081010522
51
-
1.845702696026691
52
-
1.8457041839548325
53
-
1.8457056718857727
54
-
1.845707159819413
55
-
1.8457086477557534
56
-
1.8457101356946952
57
-
1.8457116236362385
58
-
1.8457131115805805
51
+
2.79375393394586e-7
52
+
4.149527171475212e-7
53
+
5.807919390815544e-7
54
+
7.81280701490125e-7
55
+
⋮
56
+
1.8457012081010522
57
+
1.845702696026691
58
+
1.8457041839548325
59
+
1.8457056718857727
60
+
1.845707159819413
61
+
1.8457086477557534
62
+
1.8457101356946952
63
+
1.8457116236362385
64
+
1.8457131115805805
59
65
u: 999977-element Array{Array{Float64,1},1}:
60
-
[0.0, 2.0]
66
+
[0.0, 2.0]
61
67
[-0.0009987513736106552, 1.9999999999997504]
62
-
[-0.010904339759596433, 1.9999999999699458]
63
-
[-0.06265556194129239, 1.9999999989523902]
64
-
[-0.1585948892562767, 1.9999999924944207]
65
-
[-0.2700352862461109, 1.9999999746155703]
66
-
[-0.3783197963325601, 1.9999999398563364]
67
-
[-0.47467864703912216, 1.9999998815910678]
68
-
[-0.5499302545937235, 1.999999796115446]
69
-
[-0.6026934372089534, 1.9999996800439757]
70
-
⋮
71
-
[-0.7770871866226842, 1.8321769350351387]
72
-
[-0.7770880934309836, 1.8321757783565626]
73
-
[-0.7770890004563554, 1.832174621674691]
74
-
[-0.7770899073362528, 1.832173464989294]
75
-
[-0.7770908141915421, 1.832172308300448]
76
-
[-0.777091721022237, 1.8321711516081531]
77
-
[-0.7770926279492066, 1.832169994912486]
78
-
[-0.7770935349724621, 1.8321688382134467]
68
+
[-0.010904339759596433, 1.9999999999699458]
69
+
[-0.06265556194129239, 1.9999999989523902]
70
+
[-0.1585948892562767, 1.9999999924944207]
71
+
[-0.2700352862461109, 1.9999999746155703]
72
+
[-0.3783197963325601, 1.9999999398563364]
73
+
[-0.47467864703912216, 1.9999998815910678]
74
+
[-0.5499302545937235, 1.999999796115446]
75
+
[-0.6026934372089534, 1.9999996800439757]
76
+
⋮
77
+
[-0.7770871866226842, 1.8321769350351387]
78
+
[-0.7770880934309836, 1.8321757783565626]
79
+
[-0.7770890004563554, 1.832174621674691]
80
+
[-0.7770899073362528, 1.832173464989294]
81
+
[-0.7770908141915421, 1.832172308300448]
82
+
[-0.777091721022237, 1.8321711516081531]
83
+
[-0.7770926279492066, 1.832169994912486]
84
+
[-0.7770935349724621, 1.8321688382134467]
79
85
[-0.7770944418503102, 1.8321676815108816]
80
86
````
81
87
@@ -96,46 +102,46 @@ sol = solve(prob,alg_hints = [:stiff])
96
102
retcode: Success
97
103
Interpolation: specialized 3rd order "free" stiffness-aware interpolation
98
104
t: 694-element Array{Float64,1}:
99
-
0.0
105
+
0.0
100
106
4.997501249375313e-10
101
-
5.454105825317844e-9
107
+
5.454105825317844e-9
102
108
1.8954286226539402e-8
103
-
4.149674379723465e-8
104
-
7.308080698498873e-8
109
+
4.149674379723465e-8
110
+
7.308080698498873e-8
105
111
1.1714649583268228e-7
106
112
1.7481330012839592e-7
107
113
2.4862371241875205e-7
108
114
3.4025555832660864e-7
109
-
⋮
110
-
5.69767949075004
111
-
5.748994165486137
112
-
5.811844321155623
113
-
5.886853430367259
114
-
5.969502584336209
115
-
6.05645855489726
116
-
6.143414525458311
117
-
6.230370496019361
118
-
6.3
115
+
⋮
116
+
5.69767949075004
117
+
5.748994165486137
118
+
5.811844321155623
119
+
5.886853430367259
120
+
5.969502584336209
121
+
6.05645855489726
122
+
6.143414525458311
123
+
6.230370496019361
124
+
6.3
119
125
u: 694-element Array{Array{Float64,1},1}:
120
-
[0.0, 2.0]
126
+
[0.0, 2.0]
121
127
[-0.0009987513736106515, 1.9999999999997504]
122
-
[-0.010819454588930516, 1.9999999999704143]
123
-
[-0.036850919195836614, 1.999999999647449]
124
-
[-0.07803540833511657, 1.999999998347307]
125
-
[-0.13124866317048456, 1.9999999950290166]
126
-
[-0.19755036285072544, 1.9999999877524572]
127
-
[-0.272075415352352, 1.999999974149605]
128
-
[-0.35045254633113243, 1.9999999510683737]
129
-
[-0.4264538643666248, 1.9999999153142478]
130
-
⋮
131
-
[0.6849948021041035, -1.9679959070285558]
132
-
[0.7068255882516246, -1.9322949901761672]
133
-
[0.7369247908644185, -1.8869463160135977]
134
-
[0.7789756893010558, -1.8301403490903476]
135
-
[0.8358041460218815, -1.7634992825515126]
136
-
[0.9131711695745722, -1.6876171241799416]
137
-
[1.0200095610067244, -1.6038403486733988]
138
-
[1.182122272069454, -1.5086434776790882]
128
+
[-0.010819454588930516, 1.9999999999704143]
129
+
[-0.036850919195836614, 1.999999999647449]
130
+
[-0.07803540833511657, 1.999999998347307]
131
+
[-0.13124866317048456, 1.9999999950290166]
132
+
[-0.19755036285072544, 1.9999999877524572]
133
+
[-0.272075415352352, 1.999999974149605]
134
+
[-0.35045254633113243, 1.9999999510683737]
135
+
[-0.4264538643666248, 1.9999999153142478]
136
+
⋮
137
+
[0.6849948021041035, -1.9679959070285558]
138
+
[0.7068255882516246, -1.9322949901761672]
139
+
[0.7369247908644185, -1.8869463160135977]
140
+
[0.7789756893010558, -1.8301403490903476]
141
+
[0.8358041460218815, -1.7634992825515126]
142
+
[0.9131711695745722, -1.6876171241799416]
143
+
[1.0200095610067244, -1.6038403486733988]
144
+
[1.182122272069454, -1.5086434776790882]
139
145
[1.3982811580024197, -1.4194614700844543]
140
146
````
141
147
@@ -154,46 +160,46 @@ sol = solve(prob)
154
160
retcode: Success
155
161
Interpolation: Automatic order switching interpolation
156
162
t: 1927-element Array{Float64,1}:
157
-
0.0
163
+
0.0
158
164
4.997501249375313e-10
159
165
5.4972513743128435e-9
160
-
3.289919594544218e-8
161
-
9.055581394883546e-8
166
+
3.289919594544218e-8
167
+
9.055581394883546e-8
162
168
1.7309428803584187e-7
163
-
2.79375393394586e-7
164
-
4.149527171475212e-7
165
-
5.807919390815544e-7
166
-
7.81280701490125e-7
167
-
⋮
168
-
6.204648226459174
169
-
6.219556296846657
170
-
6.233842035405188
171
-
6.247504825256131
172
-
6.260547615587699
173
-
6.2729765212211905
174
-
6.2848005774657025
175
-
6.296031197826328
176
-
6.3
169
+
2.79375393394586e-7
170
+
4.149527171475212e-7
171
+
5.807919390815544e-7
172
+
7.81280701490125e-7
173
+
⋮
174
+
6.204648226459174
175
+
6.219556296846657
176
+
6.233842035405188
177
+
6.247504825256131
178
+
6.260547615587699
179
+
6.2729765212211905
180
+
6.2848005774657025
181
+
6.296031197826328
182
+
6.3
177
183
u: 1927-element Array{Array{Float64,1},1}:
178
-
[0.0, 2.0]
184
+
[0.0, 2.0]
179
185
[-0.0009987513736106552, 1.9999999999997504]
180
-
[-0.010904339759596433, 1.9999999999699458]
181
-
[-0.06265556194129239, 1.9999999989523902]
182
-
[-0.1585948892562767, 1.9999999924944207]
183
-
[-0.2700352862461109, 1.9999999746155703]
184
-
[-0.3783197963325601, 1.9999999398563364]
185
-
[-0.47467864703912216, 1.9999998815910678]
186
-
[-0.5499302545937235, 1.999999796115446]
187
-
[-0.6026934372089534, 1.9999996800439757]
188
-
⋮
189
-
[1.1173199781760204, -1.5429755449491689]
190
-
[1.1481789818936488, -1.526090225258629]
191
-
[1.1805062564165951, -1.5094585545821166]
192
-
[1.2143604506793437, -1.4931001271860491]
193
-
[1.2498033047017658, -1.477032218841621]
194
-
[1.286899775928202, -1.461269894062796]
195
-
[1.3257186497126714, -1.4458259322647566]
196
-
[1.3663322749653013, -1.4307111536240857]
186
+
[-0.010904339759596433, 1.9999999999699458]
187
+
[-0.06265556194129239, 1.9999999989523902]
188
+
[-0.1585948892562767, 1.9999999924944207]
189
+
[-0.2700352862461109, 1.9999999746155703]
190
+
[-0.3783197963325601, 1.9999999398563364]
191
+
[-0.47467864703912216, 1.9999998815910678]
192
+
[-0.5499302545937235, 1.999999796115446]
193
+
[-0.6026934372089534, 1.9999996800439757]
194
+
⋮
195
+
[1.1173199781760204, -1.5429755449491689]
196
+
[1.1481789818936488, -1.526090225258629]
197
+
[1.1805062564165951, -1.5094585545821166]
198
+
[1.2143604506793437, -1.4931001271860491]
199
+
[1.2498033047017658, -1.477032218841621]
200
+
[1.286899775928202, -1.461269894062796]
201
+
[1.3257186497126714, -1.4458259322647566]
202
+
[1.3663322749653013, -1.4307111536240857]
197
203
[1.3818948926590964, -1.4252572688140688]
198
204
````
199
205
@@ -262,7 +268,51 @@ using BenchmarkTools
262
268
263
269
264
270
````
265
-
791.900 μs (13116 allocations: 1.42 MiB)
271
+
872.884 μs (13109 allocations: 1.42 MiB)
272
+
retcode: Success
273
+
Interpolation: Automatic order switching interpolation
0 commit comments