@@ -54,7 +54,24 @@ function check_approx(arr1, arr2)
5454 return true
5555end
5656
57- @variables x y z a b c d e
57+ @variables x y z a b c d e s
58+
59+ @testset " Solving in terms of a constant var" begin
60+ eq = ((s^ 2 + 1 )/ (s^ 2 + 2 * s + 1 )) - ((s^ 2 + a)/ (b* c* s^ 2 + (b+ c)* s + d))
61+ calcd_roots = sort_arr (Symbolics. solve_interms_ofvar (eq, s), [a,b,c,d])
62+ known_roots = sort_arr ([Dict (a=> 1 , b=> 1 , c=> 1 , d=> 1 )], [a,b,c,d])
63+ @test check_approx (calcd_roots, known_roots)
64+
65+ eq = (a+ b)* s^ 2 - 2 s^ 2 + 2 * b* s - 3 * s
66+ calcd_roots = sort_arr (Symbolics. solve_interms_ofvar (eq, s), [a,b])
67+ known_roots = sort_arr ([Dict (a=> 1 / 2 , b=> 3 / 2 )], [a,b])
68+ @test check_approx (calcd_roots, known_roots)
69+
70+ eq = (a* x^ 2 + b)* s^ 2 - 2 s^ 2 + 2 * b* s - 3 * s + 2 (x^ 2 )* (s^ 3 ) + 10 * s^ 3
71+ calcd_roots = sort_arr (Symbolics. solve_interms_ofvar (eq, s), [a,b])
72+ known_roots = sort_arr ([Dict (a=> - 1 / 10 , b=> 3 / 2 , x=> - im* sqrt (5 )), Dict (a=> - 1 / 10 , b=> 3 / 2 , x=> im* sqrt (5 ))], [a,b,x])
73+ @test check_approx (calcd_roots, known_roots)
74+ end
5875
5976@testset " Invalid input" begin
6077 @test_throws AssertionError symbolic_solve (x, x^ 2 )
0 commit comments