From: jpg@spectre.unm.edu (Jeffrey P. Golden)
Newsgroups: sci.math.symbolic
Subject: Re: Integral Tables
Date: 28 Sep 92 23:19:34 GMT
Organization: Dept. of Math & Stat, University of New Mexico, Albuquerque


Reply-To: jpg@macsyma.com

> Date: 28 Sep 92 17:32:11 GMT
> From: mroussel@alchemy.chem.utoronto.ca (Marc Roussel)
> Subject: Re: Integral Tables
> Message-Id: <1992Sep28.173211.6153@alchemy.chem.utoronto.ca>
> References: <1992Sep24.041238.13433@infodev.cam.ac.uk>, 
>             <1992Sep24.163552.12172@alchemy.chem.utoronto.ca>, 
>             <10843.Sep2607.19.3092@virtualnews.nyu.edu>ivea
> Organization: Department of Chemistry, University of Toronto
> 
> In article <10843.Sep2607.19.3092@virtualnews.nyu.edu> brnstnd@nyu.edu
> (D. J. Bernstein) writes:
> >In article <1992Sep24.163552.12172@alchemy.chem.utoronto.ca>
> >mroussel@alchemy.chem.utoronto.ca (Marc Roussel) writes:
> >> For instance, how you should simplify
> >> sqrt((1-x)^2) depends on the range of the integral; abs(1-x) is 
> >> always correct but causes the symbolic integrator fits.
> >
> >Gee, was it just my imagination that Macsyma would pester me with ``is
> >1-x positive or negative?'' whenever I gave it such an integral?
>
> Macsyma is probably the most reliable of the symbolic packages. 
> In this case however, its behaviour is unsatisfactory.  

The latest versions of Macsyma don't do what you think they do.


> If the quadrature I have entered eventually reduces to
> 
>	 / 1
>	 |
>	 |   sqrt((x-1)^2) dx
>	 |
>	 / 0
>
> a symbolic package ought to be able to solve the trivial linear
> inequality and decide that this is just
>
>	 / 1
>	 |
>	 |   (1-x) dx
>	 |
>	 / 0

This is what (Symbolics, Macsyma Inc.) Macsyma 417 does.
You can  trace(?defint,?antideriv);  to see this.


> I agree that Macsyma's "solution" to this problem (ask the user) 

Macsyma 417 does not ask the user anything here.


> is better than Maple's or Mathematica's (do the "obvious" but wrong
> simplification to x-1).  (Note:  It's been some time since I've tested
> this problem with either Maple or Mathematica.  Waterloo and Wolfram may
> have fixed this particular bug.  If they have, it shouldn't be too hard
> to find another one.)  What would Macsyma do however if the integral to
> solve was
> 
>	 / 2
>	 |
>	 |   sqrt((x-1)^2) dx
>	 |
>	 / 0

PC Macsyma 417.125 returns  1  as the answer here without requiring 
interval splitting.  That's because  integrate(sqrt((x-1)^2),x);  
 ->  (x-1)*abs(x-1)/2  also does the trick.


> The correct thing to do of course is to split the range and then reduce
> this integral to
>
>	 / 1	          / 2
>	 |                |
>	 |   (1-x) dx  +  |   (x-1) dx  
>	 |                |
>	 / 0              / 1

A more interesting example, supporting your case, is  
integrate(sqrt(x+1/x-2),x,a,b) . 
( factor(x+1/x-2); in Macsyma returns  (x-1)^2/x . )
Macsyma 417 correctly does  integrate(sqrt(x+1/x-2),x,0,1);  ->  4/3  
and  integrate(sqrt(x+1/x-2),x,1,2);  ->   4/3 - 2*sqrt(2)/3, but it 
punts on  integrate(sqrt(x+1/x-2),x,0,2);  with a message telling 
you why.  It punts because we plan to implement interval splitting 
here but we haven't yet.


> If any of these programs became good at solving inequalities, some of these
> problems would go away.  Others would persist.  The basic problem (as I
> see it) is that integration is not just symbol manipulation.  All of the
> symbolic programs that I know of try to reduce all operations to that.
> By kludging their routines, the makers of such programs may eventually
> make them as reliable as good tables used by a beginning calculus
> student, but that's about it.  What is really needed is for these programs
> to either get considerably smarter (unlikely) or for them to generate
> proper warnings when dubious steps are used to generate an answer.

When a CAS automatically simplifies  sqrt(x^2)  to x  or  
sqrt(x*y)  to  sqrt(x)*sqrt(y)  without knowing anything about x 
or y then they're being dubious from the word go, so I guess 
warnings would almost always be needed.  In general, I'm not 
excusing any system here; all CAS have bugs.  Some bugs are 
fundamental, and take a lot of careful design, effort, etc. to fix.

From: Jeffrey P. Golden <jpg@macsyma.com>
Organization: Macsyma Inc.
Reply-To: jpg@macsyma.com
Newsgroups: sci.math.symbolic