I'm wondering if anyone else would be interested in a more general
simplification function that would return an expression with all non-x
terms absorbed into constants. This is like constantsimp but is more
general. Are there features of the tests that are not desirable:
def test_proportional_form():
x,y,z,C,k = symbols('x y z C k')
from sympy import var
C0, C1, C2, C3, C4 = symbols('C:5')
k0, k1 = symbols('k:2')
assert proportional_form(y + z, x, C) == C0
assert proportional_form(y + z, x) == C0
assert str(proportional_form(y + C, x)) == '_C0'
assert proportional_form(Integral(x, (x, 1, 2)), x, C) == C0
assert proportional_form(x**2*y*exp(x+z) + x*y + x*z, x, C) ==
C1*x**2*exp(x) + C0*x
assert proportional_form(x**2*y*exp(x+z) + x*y + x*z, x, k) ==
k1*x**2*exp(x) + k0*x
assert proportional_form(3 + y*x + x*z, x, C) == C0 + C1*x
assert proportional_form(3 + y*x + x*z + x**2*z, x, C) == C0 +
C1*x + C2*x**2
assert proportional_form(x - y, x, C) == C0 + x
assert proportional_form(-x + y, x, C) == C0 - x
assert proportional_form(-2*x + y, x, C) == C0 + C1*x
This is in my csimp branch.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.