-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Recently, there has been a bug announced in this list. Basically, maxima
failed to integrate properly expresions of the type:
integrate(3^log(x), x);
It produced an erroneous result, which is worst than not producing result at
all. The reason is just it tries to use the sin algorithm to evaluate the
integral instead of the risch algorithm, which is more general but produces
results which are harder to simplify.
One quick hack to test this could be to type
:lisp(push '%risch nounl)
before evaluating such integral (NOTE: :lisp(pop nounl) to return to the sin
algorithm). So I have made a hack which tests for the presence of some
exponential function with a base different from $%E (neper constant) in the
integrand to call the risch algorithm instead of the sin one. The patch, over
the file "simp.lisp" is:
< (DEFMFUN $INTEGRATE NARGS
< (LET ($RATFAC)
< (COND ((= NARGS 2)
< (WITH-NEW-CONTEXT (CONTEXT)
< (IF (MEMQ '%RISCH NOUNL) (RISCHINT (ARG 1) (ARG 2))
< (SININT (ARG 1) (ARG 2)))))
< ((= NARGS 4) ($DEFINT (ARG 1) (ARG 2) (ARG 3) (ARG 4)))
< (T (WNA-ERR '$INTEGRATE)))))
- ---
> (defmfun $integrate nargs
> (let ($ratfac)
> (cond ((= nargs 2)
> (with-new-context (context)
> (let ((arg_1 (arg 1)))
> (if (and (not (atom arg_1))
> (or (memq '%risch nounl)
> (search-base-exponent arg_1)))
> (rischint arg_1 (arg 2))
> (sinint arg_1 (arg 2))))))
> ((= nargs 4) ($defint (arg 1) (arg 2) (arg 3) (arg 4)))
> (t (wna-err '$integrate)))))
>
> (defun search-base-exponent (list-args &aux (exp-base '$%E))
> (cond ((or (atom list-args) (atom (first list-args)))
> nil)
> ((eq (first (first list-args)) 'MEXPT)
> ;; We are looking for something like ((MEXPT *) ** ...) with **
> ;; (the base) different from $%E.
> (if (eq (first (rest list-args)) exp-base)
> (search-base-exponent (rest (rest list-args)))
> t))
> (t
> (or (search-base-exponent (first list-args))
> (search-base-exponent (rest list-args))))))
>
>
It is just a quick and dirty trick as one may test by typing
diff(integrate(3^log(x), x), x);
after applying it. The risch algorithm produces good results, but in a funny
format (it is not aware of simplification).
- --
Juan Pablo Hierro Álvarez
hierro en ideafix punto litec punto csic punto es
Clave pública: 0xA8707ADF en pgp.rediris.es
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8uomfd1aMoahwet8RAvwcAJ4+exEh1KHTkdP8LDEDR4YCxblaJQCeJqgQ
LYf0uXhIB+lGTNoPg1dAJC4=
=zKbI
-----END PGP SIGNATURE-----