#2676 integral incorrect when variable is subscripted

None
closed
nobody
5
2014-02-19
2014-01-15
dan hayes
No

wxMaxima version: 13.4.0
Maxima version: 5.31.1
Maxima build date: 2013-09-24 09:49:12
Host type: i686-pc-mingw32
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.8

integrate(x[1]*exp(-%i*w[1]*x[1]-a[1]*x[1]),x[1]);

it gives :

%e(2*(-%i*w[1]-a[1])*x[1])/(-%i*w[1]-a[1])/2

Too bad there is no way to post what maxima outputs-
this would be a nice addition and make things easier.

Discussion

  • Robert Dodier

    Robert Dodier - 2014-01-18
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -5,9 +5,15 @@
     Lisp implementation type: GNU Common Lisp (GCL)
     Lisp implementation version: GCL 2.6.8
    
    +~~~~
     integrate(x[1]*exp(-%i*w[1]*x[1]-a[1]*x[1]),x[1]);
    +~~~~
    
    -it gives : %e(2*(-%i*w[1]-a[1])*x[1])/(-%i*w[1]-a[1])/2
    +it gives :
    +
    +~~~~
    +%e(2*(-%i*w[1]-a[1])*x[1])/(-%i*w[1]-a[1])/2
    +~~~~
    
     Too bad there is no way to post what maxima outputs-
     this would be a nice addition and make things easier.
    
     
  • Robert Dodier

    Robert Dodier - 2014-01-18

    Not sure what you mean by posting what Maxima outputs -- how about

    display2d:false;
    and then generate the result you want to show and just cut & paste it? If not that, perhaps you can explain what you want.

     
  • Robert Dodier

    Robert Dodier - 2014-01-18
    • labels: --> integration
     
  • Robert Dodier

    Robert Dodier - 2014-01-18

    Looks like the presence of a subscripted variable (x[1] here) tickles the bug. When the variable is a simple variable (e.g. x), the result is correct. Here is a simpler example which shows the same bug.

    (%i19) integrate (x[1]*exp(x[1]), x[1]);
    (%o19) %e^(2*x[1])/2
    

    Correct result with simple variable:

    (%i20) integrate (x*exp(x), x);
    (%o20) (x-1)*%e^x
    
     
  • Robert Dodier

    Robert Dodier - 2014-01-18
    • summary: maxima gives blatant WRONG answer when doing simple integral --> integral incorrect when variable is subscripted
     
  • Rupert Swarbrick

    • status: open --> closed
     
  • Rupert Swarbrick

    Ha, well there turns out to be an really trivial solution for this! (2 line patch; 4 including the test...) It was because $DEFINT was using STRIPDOLLAR to make temporary variable names and these clashed with names in the database of known integrals ("X" is a pretty common choice, it seems...)

    Just pushed a fix to master, after checking that it doesn't break anything.

     
  • Rupert Swarbrick

    Aargh, I'm being incompetent. The comment above should have gone to bug #2675. Re-opening this accordingly.

     
  • Rupert Swarbrick

    • status: open --> closed
     
  • Rupert Swarbrick

    I've just pushed a fix for this bug which will hopefully catch others of this type too.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks