@@ -4564,3 +4564,65 @@ def test_params_multi_value_widgets_1():
45644564 new_params = {(a , b ): (- 3 , 4 ), c : 2 }
45654565 s .params = new_params
45664566 assert s .params == {a : - 3 , b : 4 , c : 2 }
4567+
4568+
4569+ def test_implicit_2d_series_boolean_and ():
4570+ x , y = symbols ("x, y" )
4571+
4572+ cond1 = y + 2 * Abs (x ) > 0
4573+ cond2 = x > 0
4574+ cond3 = y < 0
4575+
4576+ s1 = ImplicitSeries (cond1 , (x , - 5 , 5 ), (y , - 10 , 10 ), adaptive = False )
4577+ assert s1 .adaptive is False
4578+ s1 .get_data ()
4579+ assert s1 .adaptive is False
4580+
4581+ s2 = ImplicitSeries (cond1 , (x , - 5 , 5 ), (y , - 10 , 10 ), adaptive = True )
4582+ assert s2 .adaptive is True
4583+ # because of Abs, the adaptive algorithm is going to fail, so the uniform
4584+ # meshing algorithm takes over
4585+ with warns (
4586+ UserWarning ,
4587+ match = "Adaptive meshing could not be applied to the expression. Using uniform meshing."
4588+ ):
4589+ s2 .get_data ()
4590+ assert s2 .adaptive is False
4591+
4592+ s3 = ImplicitSeries (cond2 , (x , - 5 , 5 ), (y , - 10 , 10 ), adaptive = False )
4593+ assert s3 .adaptive is False
4594+ s3 .get_data ()
4595+ assert s3 .adaptive is False
4596+
4597+ s4 = ImplicitSeries (cond2 , (x , - 5 , 5 ), (y , - 10 , 10 ), adaptive = True )
4598+ assert s4 .adaptive is True
4599+ s4 .get_data ()
4600+ assert s4 .adaptive is True
4601+
4602+ with warns (
4603+ UserWarning ,
4604+ match = "The provided expression contains Boolean functions."
4605+ ):
4606+ # Because of boolean And, the adaptive algorithm takes over
4607+ s5 = ImplicitSeries (
4608+ cond2 & cond3 , (x , - 5 , 5 ), (y , - 10 , 10 ), adaptive = False )
4609+ assert s5 .adaptive is True
4610+ s5 .get_data ()
4611+ assert s5 .adaptive is True
4612+
4613+ s6 = ImplicitSeries (cond2 & cond3 , (x , - 5 , 5 ), (y , - 10 , 10 ), adaptive = True )
4614+ assert s6 .adaptive is True
4615+ s6 .get_data ()
4616+ assert s6 .adaptive is True
4617+
4618+ s7 = ImplicitSeries (cond1 & cond2 , (x , - 5 , 5 ), (y , - 10 , 10 ), adaptive = True )
4619+ assert s7 .adaptive is True
4620+ # because of Abs, the adaptive algorithm is going to fail, so the uniform
4621+ # meshing algorithm takes over
4622+ with warns (
4623+ UserWarning ,
4624+ match = "Adaptive meshing could not be applied to the expression. Using uniform meshing."
4625+ ):
4626+ s7 .get_data ()
4627+ assert s7 .adaptive is False
4628+
0 commit comments