Edwin Woollett | 6 Sep 00:56

integrate adds "ind" to correct answer

A standard technique to get definite integrals
is to differentiate a known integral with respect
to a parameter.

This technique is used first to generate the
correct answer:

(%i1) display2d : false$
(%i2) assume( a > 0, w > 0 )$
(%i3) i1 : 'integrate( exp( -a*x)*cos( w*x ), x , 0 , inf )$
(%i4) i2 : ev(i1, nouns);
(%o4) a/(w^2 + a^2)
(%i5) di2 : ( diff(i2, a),  ratsimp(%%) );
(%o5) (w^2 - a^2)/(w^4 + 2*a^2*w^2 + a^4)
(%i6) eqn : (-1)*(diff( i1, a)  =  di2 );
(%o6) 'integrate( x*%e^-(a*x)*cos( w*x), x, 0, inf)
        = -(w^2 - a^2)/(w^4 + 2*a^2*w^2 + a^4)

but direct use of integrate adds "ind" to the
correct answer.

(%i7) integrate(x*exp(-a*x)*cos( w*x), x, 0, inf);
(%o7) ind  -  (w^2 - a^2)/(w^4 + 2*a^2*w^2 + a^4)

Is this a bug?

Ted Woollett
Raymond Toy | 6 Sep 04:54

Re: integrate adds "ind" to correct answer



On Fri, Sep 5, 2008 at 6:59 PM, Edwin Woollett <woollett <at> charter.net> wrote:
A standard technique to get definite integrals
is to differentiate a known integral with respect
to a parameter.

This technique is used first to generate the
correct answer:

(%i1) display2d : false$
(%i2) assume( a > 0, w > 0 )$
(%i3) i1 : 'integrate( exp( -a*x)*cos( w*x ), x , 0 , inf )$
(%i4) i2 : ev(i1, nouns);
(%o4) a/(w^2 + a^2)
(%i5) di2 : ( diff(i2, a),  ratsimp(%%) );
(%o5) (w^2 - a^2)/(w^4 + 2*a^2*w^2 + a^4)
(%i6) eqn : (-1)*(diff( i1, a)  =  di2 );
(%o6) 'integrate( x*%e^-(a*x)*cos( w*x), x, 0, inf)
       = -(w^2 - a^2)/(w^4 + 2*a^2*w^2 + a^4)

but direct use of integrate adds "ind" to the
correct answer.

(%i7) integrate(x*exp(-a*x)*cos( w*x), x, 0, inf);
(%o7) ind  -  (w^2 - a^2)/(w^4 + 2*a^2*w^2 + a^4)

Is this a bug?

Yes this is a bug.

Ray
 

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Edwin Woollett | 6 Sep 21:02

Re: integrate adds "ind" to correct answer

On Sept. 05, 2008, Raymond Toy wrote:

>> but direct use of integrate adds "ind" to the
>> correct answer.
>>
>> (%i7) integrate(x*exp(-a*x)*cos( w*x), x, 0, inf);
>> (%o7) ind  -  (w^2 - a^2)/(w^4 + 2*a^2*w^2 + a^4)
>>
>> Is this a bug?
>>
>> Yes this is a bug.
> 
> Ray
>

Since maxima can find the indefinite integral, this
must be a limit(...)  bug:

(%i2) assume( a > 0, w > 0 )$
(%i3) indef : integrate( x*exp( - a*x)*cos(w*x), x);
(%o3) %e^-(a*x)*(((w^3+a^2*w)*x+2*a*w)*sin(w*x)
                +((-a*w^2-a^3)*x+w^2-a^2)*cos(w*x))
       /(w^4+2*a^2*w^2+a^4)
(%i4) nindef : num( indef);
(%o4) %e^-(a*x)*(((w^3+a^2*w)*x+2*a*w)*sin(w*x)
                +((-a*w^2-a^3)*x+w^2-a^2)*cos(w*x))
(%i5) coeff( nindef, exp( - a*x) );
(%o5) ((w^3+a^2*w)*x+2*a*w)*sin(w*x)+((-a*w^2-a^3)*x+w^2-a^2)*cos(w*x)
(%i6) limit(nindef, x, 0, plus);
(%o6) w^2-a^2
(%i7) limit(nindef, x, inf );
(%o7) ind

 limit(..) makes use of  assume(..) info to get:

(%i8) limit ( exp( -a*x), x, inf );
(%o8) 0
(%i9) limit( exp( -a*x)*cos( w*x), x, inf );
(%o9) 0
(%i10) limit( x*exp( -a*x)*cos( w*x), x, inf );
(%o10) 0

So what is the problem with this "indef" expr?

Ted Woollett
Raymond Toy | 7 Sep 01:31

Re: integrate adds "ind" to correct answer

Edwin Woollett wrote:
> On Sept. 05, 2008, Raymond Toy wrote:
>
>>> but direct use of integrate adds "ind" to the
>>> correct answer.
>>>
>>> (%i7) integrate(x*exp(-a*x)*cos( w*x), x, 0, inf);
>>> (%o7) ind  -  (w^2 - a^2)/(w^4 + 2*a^2*w^2 + a^4)
>>>
>>> Is this a bug?
>>>
>>> Yes this is a bug.
>>
>> Ray
>>
>
> Since maxima can find the indefinite integral, this
> must be a limit(...)  bug:
Not necessarily.  While I have not had a chance to look at the cause of
the bug, the algorithm for definite integration is usually very, very
different from the typical school method of finding the indefinite
integral and plugging in the limits.  Usually, maxima tries to convert
the definite integral into some kind of contour integral and evaluates
that via residues using precomputed  results or by explicitly computing
the residues.

Ray
Edwin Woollett | 7 Sep 03:27

Re: integrate adds "ind" to correct answer

on sept 06, 09, Raymond Toy wrote

>>
>> Since maxima can find the indefinite integral, this
>> must be a limit(...)  bug:
> Not necessarily.  While I have not had a chance to look at the cause of
> the bug, the algorithm for definite integration is usually very, very
> different from the typical school method of finding the indefinite
> integral and plugging in the limits.  Usually, maxima tries to convert
> the definite integral into some kind of contour integral and evaluates
> that via residues using precomputed  results or by explicitly computing
> the residues.
>
> Ray
>
>
If we force use of the limit method, ldefint(..) also chokes in a different 
way.
If we help it out by putting exp(-a*x) out front, it also gets "ind"

(%i1) display2d:false$
(%i2) assume( a>0, w>0 )$
(%i3) le : ldefint(x*exp(-a*x)*cos(w*x),x,0,inf);
(%o3) ('limit(w^3*x*%e^-(a*x)*sin(w*x)+a^2*w*x*%e^-(a*x)*sin(w*x)
                                      +2*a*w*%e^-(a*x)*sin(w*x)
                                      -a*w^2*x*%e^-(a*x)*cos(w*x)
                                      -a^3*x*%e^-(a*x)*cos(w*x)
                                      +w^2*%e^-(a*x)*cos(w*x)
                                      -a^2*%e^-(a*x)*cos(w*x),x,inf))
       /(w^4+2*a^2*w^2+a^4)
       -w^2/(w^4+2*a^2*w^2+a^4)+a^2/(w^4+2*a^2*w^2+a^4)
(%i4) learg : part(le,1,1,1);
(%o4) w^3*x*%e^-(a*x)*sin(w*x)+a^2*w*x*%e^-(a*x)*sin(w*x)
                              +2*a*w*%e^-(a*x)*sin(w*x)
                              -a*w^2*x*%e^-(a*x)*cos(w*x)
                              -a^3*x*%e^-(a*x)*cos(w*x)+w^2*%e^-(a*x)*cos(w*x)
                              -a^2*%e^-(a*x)*cos(w*x)
(%i5) collectterms(learg,exp(-a*x));
(%o5) leart
(%i6) collectterms(learg,exp(-a*x));
(%o6) %e^-(a*x)*(w^3*x*sin(w*x)+a^2*w*x*sin(w*x)+2*a*w*sin(w*x)
                               -a*w^2*x*cos(w*x)-a^3*x*cos(w*x)+w^2*cos(w*x)
                               -a^2*cos(w*x))
(%i7) limit(%,x,inf);
(%o7) ind

Ted Woollett
Raymond Toy | 7 Sep 03:36

Re: integrate adds "ind" to correct answer

Edwin Woollett wrote:
> On Sept. 05, 2008, Raymond Toy wrote:
>
>>> but direct use of integrate adds "ind" to the
>>> correct answer.
>>>
>>> (%i7) integrate(x*exp(-a*x)*cos( w*x), x, 0, inf);
>>> (%o7) ind  -  (w^2 - a^2)/(w^4 + 2*a^2*w^2 + a^4)
>>>
>>> Is this a bug?
>>>
>>> Yes this is a bug.
>>
>> Ray
>>
>
> Since maxima can find the indefinite integral, this
> must be a limit(...)  bug:
>
> (%i2) assume( a > 0, w > 0 )$
> (%i3) indef : integrate( x*exp( - a*x)*cos(w*x), x);
> (%o3) %e^-(a*x)*(((w^3+a^2*w)*x+2*a*w)*sin(w*x)
>                +((-a*w^2-a^3)*x+w^2-a^2)*cos(w*x))
>       /(w^4+2*a^2*w^2+a^4)
> (%i4) nindef : num( indef);
> (%o4) %e^-(a*x)*(((w^3+a^2*w)*x+2*a*w)*sin(w*x)
>                +((-a*w^2-a^3)*x+w^2-a^2)*cos(w*x))
> (%i5) coeff( nindef, exp( - a*x) );
> (%o5) ((w^3+a^2*w)*x+2*a*w)*sin(w*x)+((-a*w^2-a^3)*x+w^2-a^2)*cos(w*x)
> (%i6) limit(nindef, x, 0, plus);
> (%o6) w^2-a^2
> (%i7) limit(nindef, x, inf );
> (%o7) ind
>
> l
I looked at how maxima tries to evaluate this integral.  In this
particular case, it does compute the antiderivative and uses limit to
find the limits.  So this is, a bug in limit.

Note that this integral is a Laplace transform integral, and specint
produces the desired result.

Ray

Gmane