Sign Error: integral(1/(x+x^2),x) ?
Brought to you by:
rjolly
Meditor is an amazing open-source project. I've just started using it on my Palm-based Treo and I'm very delighted with it's abilities. :)
However, I notice when I [Expand]:
integral(1/(x+x^2),x)
Meditor replies with:
root[0](1, 0, -1)*log(1-root[0](1, 0, -1)-2*x*root[0](1, 0, -1)+root[1](1, 0, -1)log(1-root[1](1, 0, -1)-2*x*root[1](1, 0, -1))
which Meditor [Simplifies] to:
log(-x)-log(1+x)
when really the answer should be:
log(x)-log(1+x)
Logged In: YES
user_id=692744
Hi,
The issue has to do with branch cuts, which meditor doesn't
handle. In the integral the subexpression
-2*x*root[0](1, 0, -1)
is simplified to
-2*x
because
root[0](1, 0, -1) = solve(x^2-1,x)
is simplified to 1, not -1
I think there's no mathematical mistake in my implementation
of Bronstein's paper (see docs/math_background.txt for the
reference).
If one takes back the derivative, one gets the integrand
alright:
d(log(-x)-log(1+x),x)
(expand)
(simplify)
1/(x+x^2)
Raphael
Logged In: YES
user_id=1124645
I don't know anything about Bronstein's paper or how you
implement the solution, but if his algorithm says the integral
(1/(x+x^2),x) is log(-x)-log(1+x), then his algorithm must
have a flaw. Since we cannot find the log of zero or negative
numbers, the integral function has no values in its Domain or
Range. :)
Logged In: YES
user_id=692744
It depends what domain or range. Your integral works in
]0,inf[ , mine works in ]-1,0[ (unless I'm mistaken).
Raphael
Logged In: YES
user_id=1124645
You're right, there is a tiny spot there. However, any integral
that results in a log is defined as being the absolute value of
the inside of the log, so it's defined everywhere but zero.
This is useful because log represents the area under 1/x, for
example. Since 1/x is defined everywhere but zero, we
should be able to find the area underneath it in any domain
that doesn't cross zero.
Logged In: YES
user_id=692744
Ok, so the integral should really be:
log(abs(x))-log(abs(1+x))
As a matter of fact, I only implemented the mathematical
paper as accurately as I could, and this was not dealt with.
I think this is because symbolic computation algorithms are
meant to leave a part of the needed thinking to the user...
But I guess that Maple or Mupad etc. have this answer right,
and that meditor could be improved. But as these kind of
subtleties are not my primary interest (it being
implementing the algorithms fundamentals), don't expect it
any soon (and I leave the bug closed).
Raphael