def test_functions(): g = WildFunction('g') p = Wild('p') q = Wild('q') f = cos(5 * x) notf = x assert f.match(p * cos(q * x)) == {p: 1, q: 5} assert f.match(p * g) == {p: 1, g: cos(5 * x)} assert notf.match(g) is None F = WildFunction('F', nargs=2) assert F.nargs == FiniteSet(2) f = Function('f') assert f(x).match(F) is None F = WildFunction('F', nargs=(1, 2)) assert F.nargs == FiniteSet(1, 2) # issue sympy/sympy#2711 f = meijerg(((), ()), ((0, ), ()), x) a = Wild('a') b = Wild('b') assert f.find(a) == { 0: 1, x: 1, meijerg(((), ()), ((0, ), ()), x): 1, (): 3, (0, ): 1, ((), ()): 1, ((0, ), ()): 1 } assert f.find(a + b) == {0: 1, x: 1, meijerg(((), ()), ((0, ), ()), x): 1} assert f.find(a**2) == {x: 1, meijerg(((), ()), ((0, ), ()), x): 1}
def test_Function(): f = Function('f') fx = f(x) w = WildFunction('w') assert str(f) == "f" assert str(fx) == "f(x)" assert str(w) == "w_"
def test_functions_X1(): g = WildFunction('g') p = Wild('p') q = Wild('q') f = cos(5 * x) assert f.match(p * g(q * x)) == {p: 1, g: cos, q: 5}
def test_Function(): f = Function('f') fx = f(x) w = WildFunction('w') assert str(f) == 'f' assert str(fx) == 'f(x)' assert str(w) == 'w_'
def test_functions(): g = WildFunction('g') p = Wild('p') q = Wild('q') f = cos(5 * x) notf = x assert f.match(p * cos(q * x)) == {p: 1, q: 5} assert f.match(p * g) == {p: 1, g: cos(5 * x)} assert notf.match(g) is None F = WildFunction('F', nargs=2) assert F.nargs == FiniteSet(2) f = Function('f') assert f(x).match(F) is None F = WildFunction('F', nargs=(1, 2)) assert F.nargs == FiniteSet(1, 2)
def test_functions(): g = WildFunction('g') p = Wild('p') q = Wild('q') f = cos(5 * x) notf = x assert f.match(p * cos(q * x)) == {p: 1, q: 5} assert f.match(p * g) == {p: 1, g: cos(5 * x)} assert notf.match(g) is None
def test_WildFunction(): sT(WildFunction('w'), "WildFunction('w')")