On Thu, 2002-08-08 at 14:19, willisb@unk.edu wrote:
>
> Awhile back, Justin Smith asked if Maxima had a function
> for testing the equality of expressions by comparing
> numerical values at random points. Richard Fateman told him
> that (http://www.math.utexas.edu/pipermail/maxima/2002/002435.html)
> there was such a function, but that "he would probably do better
> with just ratsimp(expr1-expr2)." Here's proof:
>
>
> (C1) zeroequiv(x-abs(x),x);
> (D1) TRUE
>
> /* Let's see how many "random" points are checked. */
> (C2) :lisp(trace random);
> Warning: RANDOM is being redefined.
> (RANDOM)
> (C2) zeroequiv(x-abs(x),x);
> 1> (RANDOM 1000)
> <1 (RANDOM 885)
> (D2) TRUE
>
> /* Yikes! zeroequiv tests at only one point. The documentation
> warns against using zeroequiv on non-smooth functions. Let's
> try it on a function that has a continuous first derivative on
> the reals. */
>
> (C3) zeroequiv(x*abs(x) - x^2,x);
> 1> (RANDOM 1000)
> <1 (RANDOM 938)
> (D3) TRUE
>
Very interesting! I would have thought it tested several random points,
rejecting those that make the function blow up.
Technically, something equivalent to 0 should never blow up (so
zeroequiv should return false), but it might be interesting to have a
"slightly sloppy" form of zeroequiv that regarded
(x-2)/(x-2) as equivalent to 1 (even though the former function is
undefined for x=2).
> In short, zeroequiv and its documentation could use some code
> Feng-Shui.
>
> Barton
>
--
______________________________________________________________________
Time blows wildly against my door | Justin R. Smith
Stirring discarded sorrows | Department of Mathematics and
Like dead leaves of summers past | Computer Science
Memories of forgotten lore | Drexel University
Making way for new tomorrows | Philadelphia, PA 19104
New hopes, new fears, |
and new ways that last | Office: (215) 895-1847
URL: http://vorpal.mcs.drexel.edu | Fax: (215) 895-1582