Unnecessary test in rtest5.mac ?



Problem 48 shows a bug--the test should stay and the bug should be fixed.

(%i5) integrate(%e^x*erf(x),x);
(%o5) %e^x*erf(x)-%e^(1/4)*erf(x-1/2)

The associative rule for multiplication has not been applied:

(%i6) ?print(%);
((MPLUS SIMP)
 ((MTIMES SIMP) ((MTIMES SIMP) -1 ((MEXPT SIMP) $%E ((RAT SIMP) 1 4)))
  ((%ERF SIMP) ((MPLUS SIMP) ((RAT SIMP) -1 2) $X)))
 ((MTIMES SIMP) ((MEXPT SIMP) $%E $X) ((%ERF SIMP) $X)))

(%o6) %e^x*erf(x)-%e^(1/4)*erf(x-1/2)

Doing expand(%o1,0,0) causes the associative rule to be applied:

(%i7) ?print(expand(%o1,0,0));
((MPLUS SIMP)
 ((MTIMES SIMP) -1 ((MEXPT SIMP) $%E ((RAT SIMP) 1 4))
  ((%ERF SIMP) ((MPLUS SIMP) ((RAT SIMP) -1 2) $X)))
 ((MTIMES SIMP) ((MEXPT SIMP) $%E $X) ((%ERF SIMP) $X)))
(%o7) %e^x*erf(x)-%e^(1/4)*erf(x-1/2)

Things like this happen when the code tries to save time with things
like (cons '(mtimes simp) l). Saving time this way isn't worth it--for
one, it causes trouble with tellsimp & friends. It's best to keep
expressions simplified at all times---you never know where an
expression will be sent.

Barton
(who likely marked rtest 5 #48 as a bug :)


-----maxima-bounces at math.utexas.edu wrote: -----

>To: "maxima at math.utexas.edu" <maxima at math.utexas.edu>
>From: Dieter Kaiser <drdieterkaiser at web.de>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 12/08/2008 05:01PM
>Subject: Unnecessary test in rtest5.mac ?
>
>In the test file rtest5.mac problem 48 is declared to be an expected
>error. This is the test:
>
>/* test fails because it's not simplified -- do ?print(integrate(%
>e^x*erf(x),x)) */
>
>integrate(%e^x*erf(x),x);
>%e^x*erf(x)-%e^(1/4)*erf(x-1/2)$
>
>I do not think that we have an error. The result from the integration is
>not as much simplified as possible when we look directly at the
>expressions:
>
>(%i2) :lisp ($read)
>integrate(%e^x*erf(x),x);
>((MPLUS SIMP)
> ((MTIMES SIMP) ((MTIMES SIMP) -1 ((MEXPT SIMP) $%E ((RAT SIMP) 1 4)))
>  ((%ERF SIMP) ((MPLUS SIMP) ((RAT SIMP) -1 2) $X)))
> ((MTIMES SIMP) ((MEXPT SIMP) $%E $X) ((%ERF SIMP) $X)))
>
>(%i2) :lisp ($read)
>%e^x*erf(x)-%e^(1/4)*erf(x-1/2);
>((MPLUS SIMP)
> ((MTIMES SIMP) -1 ((MEXPT SIMP) $%E ((RAT SIMP) 1 4))
>  ((%ERF SIMP) ((MPLUS SIMP) ((RAT SIMP) -1 2) $X)))
> ((MTIMES SIMP) ((MEXPT SIMP) $%E $X) ((%ERF SIMP) $X)))
>
>A lot of problems will fail if we do not help Maxima to simplify the
>result to get an equal expression.
>
>The next test says:
>
>/* Try again, but ratsimp -- it's not a mathematical error */
>
>ratsimp(integrate(%e^x*erf(x),x) - (%e^x*erf(x)-%e^(1/4)*erf(x-1/2)));
>0$
>
>This example shows that Maxima does the correct integration.
>
>I think we should delete the problem 48 to avoid expected errors which
>are not errors. It is an unnecessary test and not an error.
>
>Dieter Kaiser
>
>
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima