@@ -34,12 +34,12 @@ def test_univariate():
3434 assert len (roots ) == 128
3535 assert np .max (np .abs (f (roots ))) < tol1
3636
37- def test_univariate_power ():
37+ def test_univariate_power ():
3838 coeff = np .zeros (5 )
3939 coeff [0 ], coeff [1 ], coeff [2 ], coeff [3 ], coeff [4 ] = - 2 , 2 , 3 , 4 , 5
4040 f = yr .MultiPower (coeff )
4141
42- roots = yr .solve (f , - 2 , 1 )
42+ roots = yr .solve (f , - 1 , 1 )
4343 assert len (roots ) == 2
4444 assert np .max (np .abs (f (roots ))) < tol1
4545
@@ -48,8 +48,8 @@ def test_univariate_cheb():
4848 coeff [0 ], coeff [1 ], coeff [2 ], coeff [3 ] = 0 , 1 , 2 , 3
4949 f = yr .MultiCheb (coeff )
5050
51- roots = yr .solve (f , - 0.5 , 1 )
52- assert len (roots ) == 2
51+ roots = yr .solve (f , - 1 , 1 )
52+ assert len (roots ) == 3
5353 assert np .max (np .abs (f (roots ))) < tol1
5454
5555# Test Multidimensional Examples
@@ -103,6 +103,28 @@ def test_multiCheb_multiPower():
103103 assert np .max (np .abs (f (roots ))) < tol2
104104 assert np .max (np .abs (g (roots ))) < tol2
105105
106+ # Test MultiCheb and MultiPower
107+ def test_multiCheb_multiPower_non_unit_box ():
108+ """
109+ f(x,y) = 5x^3 + 4 xy^2 + 3x^2 + 2y^2 + 1
110+ g(x,y) = 5 T_2(x) + 3T_1(x)T_2(y) + 2
111+
112+ """
113+
114+ coeff = np .zeros ((4 ,4 ))
115+ coeff [3 ,0 ], coeff [1 ,2 ], coeff [2 ,0 ], coeff [0 ,2 ], coeff [0 ,0 ] = 5 , 4 , 3 , 2 , 1
116+ f = yr .MultiPower (coeff )
117+
118+ coeff = np .zeros ((3 ,3 ))
119+ coeff [2 ,0 ], coeff [1 ,2 ], coeff [0 ,0 ] = 5 , 3 , 2
120+ g = yr .MultiCheb (coeff )
121+
122+ roots = yr .solve ([f ,g ],[- 2 ,- 2 ],[2 ,2 ])
123+
124+ assert len (roots ) == 2
125+ assert np .max (np .abs (f (roots ))) < tol2
126+ assert np .max (np .abs (g (roots ))) < tol2
127+
106128def test_multiPower ():
107129 """
108130 f(x,y) = 5x^3 + 4 xy^2 + 3x^2 + 2y^2 - 5
@@ -117,9 +139,9 @@ def test_multiPower():
117139 coeff [2 ,1 ], coeff [1 ,2 ], coeff [2 ,0 ], coeff [0 ,2 ], coeff [0 ,0 ] = 3 , - 4 , 3 , 2 , - 1
118140 g = yr .MultiPower (coeff )
119141
120- roots = yr .solve ([f ,g ],[- 2 , - 2 ],[2 , 2 ])
142+ roots = yr .solve ([f ,g ],[- 1 , - 1 ],[1 , 1 ])
121143
122- assert len (roots ) == 2
144+ assert len (roots ) == 1
123145 assert np .max (np .abs (f (roots ))) < tol2
124146 assert np .max (np .abs (g (roots ))) < tol2
125147
@@ -208,8 +230,8 @@ def test_exact_option():
208230 yroots_non_exact = yr .solve (funcs ,a ,b ,exact = False )
209231 yroots_exact = yr .solve (funcs ,a ,b ,exact = True )
210232
211- actual_roots = np .load ('../../ Polished_results/polished_2.3.npy' )
212- chebfun_roots = np .loadtxt ('../../ Chebfun_results/test_roots_2.3.csv' , delimiter = ',' )
233+ actual_roots = np .load ('../Polished_results/polished_2.3.npy' )
234+ chebfun_roots = np .loadtxt ('../Chebfun_results/test_roots_2.3.csv' , delimiter = ',' )
213235
214236 assert len (yroots_non_exact ) == len (actual_roots )
215237 assert len (yroots_exact ) == len (actual_roots )
0 commit comments