ode2 not providing the solution



"Stavros Macrakis" <stavros.macrakis@verizon.net> writes:

> This error is coming from the Integrate routine:
> 
>    integrate( x*%E^(a*x/2)*SIN(SQRT(b-a^2)*x) , x)
>         => Quotient by...
> 
> Another similar problem:
> 
>    integrate( x*%E^(a*x)*SIN(SQRT(b-a^2)*x/2) , x)
>         => quotient is not exact
> 
> Usually, this sort of problem is solved by changing GCD algorithm
> (setting the GCD variable), but in this case, all the GCD routines have
> the same problem.

It's just that the other gcd functions don't get a chance ;-)

In the examples above, RISCHINT binds $GCD to $ALGEBRAIC and PGCDA
then chooses between $SUBRES and $SPMOD, depending on the arguments.
The top-level setting of $GCD has no influence on this.

Here's a way to experiment with other settings.  Redefine

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(DEFUN PGCDCOFACTS (X Y) 
  (loop
     with errrjfflag = t
     thereis
     (catch 'raterr 
       (LET ((A (PGCDA X Y T)))
         (COND ((CDR A) A)
               ((EQUAL (SETQ A (CAR A)) 1) (LIST 1 X Y))
               ((AND $ALGEBRAIC (NOT (PCOEFP A)))
                (CONS A (PROG2 (SETQ X (RQUOTIENT X A)
                                     Y (RQUOTIENT Y A)
                                     A (PGCDCOFACTS (CDR X) (CDR Y)))
                            (LIST (PTIMES (CAR X) (CADDR A))
                                  (PTIMES (CAR Y) (CADR A))
                                  (PTIMES (CADR A) (CDR Y))))))
               ((EQ A X) (LIST X 1 (PQUOTIENT Y X)))
               ((EQ A Y) (LIST A (PQUOTIENT X Y) 1))
               (T (LIST A (PQUOTIENT X A) (PQUOTIENT Y A))))))
     do (merror "Try a different gcd algorithm, perhaps.")))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Then you can do things like

(C1) debugmode(true);
(D1)                                 TRUE
(C2) integrate(x*%e^(a*x/2)*sin(sqrt(b-a^2)*x), x);
Try a different gcd algorithm, perhaps.
 -- an error.  Entering the Maxima Debugger dbm
(dbm:1) gcd;
ALGEBRAIC
(dbm:1) gcd:spmod;
SPMOD
(dbm:1) :r
                                            a x
                                            ---
             3                         2     2                2
(D2) - (((6 a  - 8 a b) x - 16 b + 20 a ) %E    SIN(SQRT(b - a ) x)

                                            a x
                                            ---
             2               2               2                2
 + SQRT(b - a ) ((16 b - 12 a ) x - 16 a) %E    COS(SQRT(b - a ) x))

      2       2        4
/(16 b  - 24 a  b + 9 a )
(C3) 

Wolfgang