risch: recognize Derivatives as components (#1012)
If I understand it correctly, when heurisch sees f(x), it needs to extract f(x)
derivative and put it into set of terms. Each term is then called a new
variable and we do computations in their space.
But previously, components(Derivative(f(x),x), x) was only
set([f(x), x])
instead of
set([Derivative(f(x),x), f(x), x])
which resulted in that
heurisch(f(x), x) -> x⋅f(x)
I don't understand this stuff, but keeping Derivatives in a list of
components seems logical to me, and by the way, now heurisch is a bit
more clever:
In [1]: heurisch(f(x), x)
In [2]: heurisch(diff(f(x),x), x)
Out[2]: f(x)
In [3]: heurisch(f(x)*diff(f(x),x), x)
Out[3]:
2
f (x)
─────
2
In [4]: heurisch(diff(f(x),x) / f(x), x)
Out[4]: log(f(x))
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
CC: Mateusz Paprocki <mattpap@gmail.com>
Signed-off-by: Ondrej Certik <ondrej@certik.cz>
Signed-off-by: Mateusz Paprocki <mattpap@gmail.com>