Beispiel #1
0
def test_variable_replacement():
    """Test replace variables by values and symbols in expression."""
    expr = demo_fall
    vdict = Variable.__defaults__.copy()
    vdict[Symbol('x')] = 1
    assert replace_variables(expr, vdict) == \
        Eq(demo_d, 4.9 * demo_fall.definition.t ** 2)
Beispiel #2
0
def test_substitution():
    """Test if .subs() method gives the same result as replace_variables."""
    assert demo_fall.subs(demo_d, demo_d1) == \
        replace_variables(demo_fall, {demo_d: demo_d1})