Closed jirikuncar closed 6 years ago
Note also that the added test is satisfied using the current master, probably due to a change upstream, in sympy:
def test_integral():
"""Test that variables behave as symbols."""
from sympy import integrate
assert demo_g in demo_fall.free_symbols
assert demo_g * demo_fall.definition.t**S(3) / S(6) == integrate(
demo_fall.rhs, demo_fall.definition.t)
So maybe we can just add the test alone.
The thing is, they probably should not behave as symbols. I finally understood what is meant by the comment that symbols in an expression could balance non-matching units. For example, one could formulate an empirical equation where the units of the proportionality constant are not known a priori. One could use a symbol for the constant, then solve the equation for the symbol, substitute the units of all variables and in this way deduce the appropriate units of the constant. So, all we need to test for is that integrate() works if the integration variable is a quantity. This was the original test. We could add additional tests for other methods, one-by-one. No need to treat a quantity as a free_symbol in general.
OK, variables do not behave as symbols, but this is probably not needed after all. Most importantly, integrate() with variables works now.
Apparently, this broke test_units() in test_equations.py.