@@ -156,35 +156,35 @@ newdaesys = structural_simplify(daesys)
156
156
@test equations (tearing_substitution (newdaesys)) == [D (x) ~ z; 0 ~ x + sin (z) - p * t]
157
157
@test isequal (unknowns (newdaesys), [x, z])
158
158
@test isequal (states (newdaesys), [x, z])
159
- @test_deprecated ODAEProblem (newdaesys, [x => 1.0 ], (0 , 1.0 ), [p => 0.2 ])
160
- prob = ODEProblem (newdaesys, [x => 1.0 ], (0 , 1.0 ), [p => 0.2 ])
161
- du = [0.0 ];
162
- u = [1.0 ];
159
+ @test_deprecated ODAEProblem (newdaesys, [x => 1.0 , z => - 0.5 π ], (0 , 1.0 ), [p => 0.2 ])
160
+ prob = ODEProblem (newdaesys, [x => 1.0 , z => - 0.5 π ], (0 , 1.0 ), [p => 0.2 ])
161
+ du = [0.0 , 0.0 ];
162
+ u = [1.0 , - 0.5 π ];
163
163
pr = 0.2 ;
164
164
tt = 0.1 ;
165
165
@test_skip (@ballocated $ (prob. f)($ du, $ u, $ pr, $ tt)) == 0
166
166
prob. f (du, u, pr, tt)
167
- @test du≈ [ - asin (u[ 1 ] - pr * tt) ] atol= 1e-5
167
+ @test du ≈ [u[ 2 ], u[ 1 ] + sin (u[ 2 ]) - pr * tt] atol= 1e-5
168
168
169
169
# test the initial guess is respected
170
170
@named sys = ODESystem (eqs, t, defaults = Dict (z => Inf ))
171
171
infprob = ODEProblem (structural_simplify (sys), [x => 1.0 ], (0 , 1.0 ), [p => 0.2 ])
172
- @test_throws Any infprob. f (du, u , pr, tt)
172
+ @test_throws Any infprob. f (du, infprob . u0 , pr, tt)
173
173
174
- sol1 = solve (prob, Tsit5 () )
174
+ sol1 = solve (prob, RosShamp4 (), reltol = 8e-7 )
175
175
sol2 = solve (ODEProblem {false} ((u, p, t) -> [- asin (u[1 ] - pr * t)],
176
176
[1.0 ],
177
177
(0 , 1.0 ),
178
178
0.2 ), Tsit5 (), tstops = sol1. t, adaptive = false )
179
- @test Array (sol1)≈ Array (sol2) atol= 1e-5
179
+ @test Array (sol1[x] )≈ Array (sol2[ 1 , :] ) atol= 1e-5
180
180
181
181
@test sol1[x] == first .(sol1. u)
182
182
@test sol1[y] == first .(sol1. u)
183
- @test sin .(sol1[z]) .+ sol1[y]≈ pr[1 ] * sol1. t atol= 1e -5
183
+ @test sin .(sol1[z]) .+ sol1[y]≈ pr[1 ] * sol1. t atol= 5e -5
184
184
@test sol1[sin (z) + y]≈ sin .(sol1[z]) .+ sol1[y] rtol= 1e-12
185
185
186
186
@test sol1[y, :] == sol1[x, :]
187
- @test (@. sin (sol1[z, :]) + sol1[y, :])≈ pr * sol1. t atol= 1e -5
187
+ @test (@. sin (sol1[z, :]) + sol1[y, :])≈ pr * sol1. t atol= 5e -5
188
188
189
189
# 1426
190
190
function Translational_Mass (; name, m = 1.0 )
0 commit comments