@@ -476,16 +476,25 @@ end
476
476
expr = sec (x ^ 2 + 4 x + 4 ) ^ 3 - 3
477
477
roots = ia_solve (expr, x)
478
478
@test length (roots) == 6 # 2 quadratic roots * 3 roots from cbrt(3)
479
+ @test length (Symbolics. get_variables (roots[1 ])) == 1
480
+ _n = only (Symbolics. get_variables (roots[1 ]))
481
+ vals = substitute .(roots, (Dict (_n => 0 ),))
482
+ @test all (x -> isapprox (norm (sec (x^ 2 + 4 x + 4 ) ^ 3 - 3 ), 0.0 , atol = 1e-14 ), vals)
483
+
479
484
roots = ia_solve (expr, x; complex_roots = false )
480
485
@test length (roots) == 2
481
486
# the `n` in `θ + n * 2π`
482
487
@test length (Symbolics. get_variables (roots[1 ])) == 1
483
- @test length (Symbolics. get_variables (roots[2 ])) == 1
488
+ _n = only (Symbolics. get_variables (roots[1 ]))
489
+ vals = substitute .(roots, (Dict (_n => 0 ),))
490
+ @test all (x -> isapprox (norm (sec (x^ 2 + 4 x + 4 ) ^ 3 - 3 ), 0.0 , atol = 1e-14 ), vals)
491
+
484
492
roots = ia_solve (expr, x; complex_roots = false , periodic_roots = false )
485
493
@test length (roots) == 2
486
494
@test length (Symbolics. get_variables (roots[1 ])) == 0
487
- @test length (Symbolics. get_variables (roots[2 ])) == 0
488
- @test_nowarn eval .(Symbolics. toexpr .(roots))
495
+ @test length (Symbolics. get_variables (roots[2 ])) == 0
496
+ vals = eval .(Symbolics. toexpr .(roots))
497
+ @test all (x -> isapprox (norm (sec (x^ 2 + 4 x + 4 ) ^ 3 - 3 ), 0.0 , atol = 1e-14 ), vals)
489
498
end
490
499
end
491
500
0 commit comments