@@ -156,35 +156,35 @@ newdaesys = structural_simplify(daesys)
156156@test equations (tearing_substitution (newdaesys)) == [D (x) ~ z; 0 ~ x + sin (z) - p * t]
157157@test isequal (unknowns (newdaesys), [x, z])
158158@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 π ];
163163pr = 0.2 ;
164164tt = 0.1 ;
165165@test_skip (@ballocated $ (prob. f)($ du, $ u, $ pr, $ tt)) == 0
166166prob. 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
168168
169169# test the initial guess is respected
170170@named sys = ODESystem (eqs, t, defaults = Dict (z => Inf ))
171171infprob = 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)
173173
174- sol1 = solve (prob, Tsit5 () )
174+ sol1 = solve (prob, RosShamp4 (), reltol = 8e-7 )
175175sol2 = solve (ODEProblem {false} ((u, p, t) -> [- asin (u[1 ] - pr * t)],
176176 [1.0 ],
177177 (0 , 1.0 ),
178178 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
180180
181181@test sol1[x] == first .(sol1. u)
182182@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
184184@test sol1[sin (z) + y]≈ sin .(sol1[z]) .+ sol1[y] rtol= 1e-12
185185
186186@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
188188
189189# 1426
190190function Translational_Mass (; name, m = 1.0 )
0 commit comments