From: Robert D. <rob...@us...> - 2007-07-18 13:52:44
|
Update of /cvsroot/maxima/maxima/share/contrib/ezunits In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1842/share/contrib/ezunits Modified Files: ezunits.mac Log Message: Work around for tellsimpafter strangeness: when a ` expression does not match any rule, the arguments are not simplified. That caused many test cases in rtestezunits to fail, because now the expected result is only simplified, not evaluated. So throw in a rule for ` which only causes the arguments to be simplified; seems to fix the problem. Index: ezunits.mac =================================================================== RCS file: /cvsroot/maxima/maxima/share/contrib/ezunits/ezunits.mac,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ezunits.mac 17 Jul 2007 13:42:52 -0000 1.4 +++ ezunits.mac 18 Jul 2007 13:52:38 -0000 1.5 @@ -62,7 +62,8 @@ d(e%) := dimension (units (e%)); -matchdeclare (aa%, true, +matchdeclare + ([aa%, bb%], true, cc%, constantp, ccn0%, constantp_not0, ccn1%, constantp_not1, @@ -76,6 +77,15 @@ tellsimpafter (nd% * uu%, multiply_with_units (nd%, uu%)); tellsimpafter (nd% + uu%, add_with_units (nd%, uu%)); +/* The first ` rule here is a work-around for the behavior of the function + * automatically generated by tellsimpafter: in a pure simplification + * environment (i.e. no evaluation, e.g. expected result in test scripts) + * the arguments are never simplified if they do not match any rule. + * That is unlike simplification in general, in which the arguments are + * simplified even if there is no rule for the operator and the arguments together. + */ +tellsimpafter (aa% ` bb%, ?resimplify (aa%) ` ?resimplify (bb%)); + tellsimpafter (aa% ` (xx% + ccn0%), (aa% - ccn0%)`xx%); tellsimpafter (aa% ` mm%, (constant_factors(mm%) * aa%) ` everything_else(mm%)); tellsimpafter (aa% ` cc%, aa%*cc%); |