Rascas
1 Numeric over symbolic
8.12

Rascas🔗ℹ

Laurent Orseau

 (require rascas) package: rascas

A Computer Algebra System for Racket.

Initially a port of dharmatech/mpl, but now incorporates lots of modifications.

Rascas is still unstable and some behaviours may change without warning, although normally only to make them more consistent.

1 Numeric over symbolic🔗ℹ

Rascas implements the numeric over symbolic principle:

If f is a symbolic expression with n free variables, then if for all valid numeric values of these n variables (that do not lead to +nan.0 or to an exception being raised) the expression reduces to a constant numeric value c, then Rascas may choose to eagerly reduce the expression f containing free variables to c.

For example, Rascas reduces (* 0 'x) to 0, because this is correct for all valid values for 'x, and if x is infinite the result would be +nan.0 (note that Racket actually considers (* 0 +inf.0) to be 0, but Rascas reduces this to +nan.0).

By contrast, Rascas does not reduce (* 0.0 'x) because if 'x is negative the result would be -0.0, which may lead to different values since for example (/ 1 -0.0) is -inf.0.

This principle of numeric over symbolic also means that the user must be careful about the order in which variables are substituted, and it is preferable to use concurrent-substitute so that the expression is reduced only after all variables are substituted with their value.