From: Preston P. <pr...@dw...> - 2004-01-26 11:33:48
|
I've been delving into the means by which functions' evaluation rules are specified. I expect to need to extend these rules if I add to the system, and it's also a core aspect that I should understand. Here's what I've found. In symbolic evaluation, Session.EV() calls Session.ELoop() repeatedly, and ELoop calls HObject.evaluate() on objects from the current expression. HFunction.evaluate() delegates the task to HSymbol.evaluateFunction(), since the symbol is what stores the information about the type of function. evaluateFunction can apply "up" or "down" rules, which actually cause changes. For instance, this is an applied "down" rule: D(Pow(t,5),t) becomes Multiply(5,Pow(t,4)) And this is where it gets awkward (apparently with reason). Rules for built-in objects are specified as long arrays of hard-coded longs and bytes, which are passed to Session.setRules() to be evaluated. It appears that this difficult-to-examine technique is used to decrease the time required to initialize the rules when they are loaded on the fly. (correct?) I'm curious as to how these arrays of numbers were generated. It seems as though they were constructed in a human-readable syntax, converted into this format with some tool, and then block-copied into the Java files in com.hartmath.loadable.*. Is that correct? If so: a) was the human-readable source syntax for these rules preserved? b) what tool performed the transformation? I would like it if we could get to the point where the original form of these rules were stored in CVS. (is it now?) Ideally, I would prefer that an automated system update the hard-coded arrays whenever the human-readable rules were modified, but that's probably more trouble than it's worth. I'd be happy with a test that confirms that the human-readable and hard-coded forms are consistent. If the original source of the rules has been lost, it may be possible to use the conversion tool to regenerate it. I'd be glad to work on that. I'd appreciate any confirmation, contradiction, or explanation of the things I've described above. Thanks. == Preston Pfarner pf...@us... |