Test case source code
I noticed that the attached simple test program fails
with a stack
overflow due to infinite recursion in the second EV() call.
Output:
Before D(Pow(x,1/2),x)
After D(Pow(x,1/2),x)
Before D(Pow(x,-1/2),x)
Exception in thread "main" java.lang.StackOverflowError
When I run it with some extra instrumentation (printing
rules that are
applied, from HRuleSet.testDownRules()), I see that it
appears to be
applying the rule
{x_IsNumber}:=Check(SignumCmp(x)<0,I*Pi-{-x})
to List(1/2), then List(-1/2), and then repeating.
I'll keep looking into this, to nail down exactly
what's happening.
Perhaps some rules don't interact well, or a rule
should be added.
This might also be related to the fact that the
function isn't defined
for x<0, or that the second function has a pole (goes
to infinity)
at x=0. However, even if the function behaves poorly,
we'll want it
to report that problem cleanly, so this is a bug.
As I said, I'm researching this one, but I'm also
reporting it as a
matter of proper practice.
Test case source code
Logged In: YES
user_id=49890
Preston, does this mean that you're working on Hartmath
now?
Logged In: YES
user_id=945156
Yes, I am working on HartMath some, but I've been idle for
the last couple of weeks because I was on vacation. It's
possible that it makes more sense to put effort into hmath
(hmath.org), a possible successor. *shrug*
On this bug, I've found that at some point in the process of
evaluating a derivative (even D(x,x)) the rules for Sin()
appear to be put into List(). I don't know how this is
happening, but it's definitely not good. This is obviously
wrong, and I haven't tracked it down yet.
For another example, if I evaluate List(Multiply(1/4,Pi)) on
its own, I get no simplification. If I do it after a
derivative has been evaluated, I get
List(Multiply(1/4,Pi))=1. Naturally, this would be true if
the "List" were "Sin", but somewhere in there the wrong
rules are being loaded. I have some more introspection to
add, and then it'll probably become clear (and be fixed).
While the dynamic on-the-fly loading of capabilities is nice
for latency (start-up speed) reasons, it can defer bugs like
this until some condition occurs, making them harder to find.
Logged In: YES
user_id=810238
I'm still interested in developing hartmath.
The project IMHO needs a rewrite from ground up to be used
in multi-threaded web-environments.
I did a first (very imcomplete) rewrite which is integrated
in a mathml blog/wiki:
http://www.hartlage.de:8080/hmath/space/math/calculus/Derivative
See CVS in Project:
http://www.sourceforge.net/projects/hmath
Log in to post a comment.