Subject: bug in integrate, is anyone working on this?
From: Stavros Macrakis
Date: Sun, 3 Jun 2012 16:26:51 -0400
Clearly if you're calculating point values independently and
compositionally, there is no way of having sqrt(x^2) evaluate to x for both
positive and negative x, because there is no notion of differentiability.
That is why arbitrary rules about branch cuts are useful in numeric
computation. Of course, that doesn't *rule out* numerical computation that
yields prefers results that are "more" continuous and differentiable.
My point was that if you look at the function *globally* (in which case
analytic continuation make sense), then it is reasonable to treat sqrt(x^2)
= x and for that matter asin(sin(x)) = x. Even better if there are
well-defined points (the equivalent of "initial conditions" in a
differential equation) to help choose the branch. For example, if
f(x)=asin(sin(x)) and we know that f(0) = %pi, then f(x) =%pi-x.
-s
On Sun, Jun 3, 2012 at 2:20 PM, Richard Fateman
<fateman at eecs.berkeley.edu>wrote:
> On 6/2/2012 11:07 AM, Stavros Macrakis wrote:
>
> Rich,
>
> Doesn't it come down to the semantics of sqrt(x^2)?
>
> Yes, but it is a little more involved, in that the argument revolves
> around whether you
> are asking about the sqrt(9) where the 9 comes from sqrt(x^2) evaluated at
> x=3 or
> sqrt(9) where the 9 comes from sqrt(x^2) evaluated at x=-3.
>
> That is, more people are willing to state that sqrt(9) being 3 because
> "if you meant the other sqrt, you would have said -sqrt(9)" than the next
> argument..
>
> Draw a graph of sqrt(x^2) for x in [-1,1]
>
> If "sqrt" means "positive square root", then this is abs(x) (Maxima's
> normal behavior). But if you treat sqrt as multivalued, then you need some
> way to decide whether sqrt(x^2) for negative x is x=-abs(x) or -x = abs(x).
> One reasonable way to do this is as the analytic continuation of
> sqrt(x^2) for positive x, which would make sqrt(x^2) -> +/- x.
>
> So the current Maxima results are arguably correct (with the arbitrary
> choice of +x rather than -x over the whole range). Mathematica's result is
> clever because it includes that pesky sqrt in the result. Cf.
> Mathematica's integrate(sqrt(x^2),x) => x*sqrt(x^2)/2.
>
> What does Mathematica do for definite integrals?
>
> -s
>
> On Sat, Jun 2, 2012 at 1:25 PM, Richard Fateman <fateman at eecs.berkeley.edu
> > wrote:
>
>> sin(x)^2/sqrt(1-cos(x)^2);
>>
>> integrate(%,x,-1,1) returns 0, but the integrand is
>> always non-negative.
>>
>> integrate(%,x) returns cos(x) which is not
>> right either.
>>
>> Mathematica gives -cot(x)*sqrt(sin(x)^2) :)
>>
>> This kind of integration problem is not new.
>>
>>
>> RJF
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
>
>
>