Skip to content

Just when you though you had forgotten Mathics3

Compare
Choose a tag to compare
@rocky rocky released this 31 Jul 10:50
· 1290 commits to master since this release
7158986

Table of Contents

This release starts to address some of the performance problems and
terminology confusion that goes back to the very beginning. As a result,
this release is not API compatible with prior releases.

In conjunction with the performance improvement in this release, we
start refactoring some of the core classes and modules to start to get
this to look and act more like other interpreters, and to follow more
current Python practice.

More work will continue in subsequent releases.

New Builtins

  1. Euler's Beta function.
  2. Bernoulli.
  3. CatalanNumber (Integer arguments only).
  4. CompositeQ.
  5. Diagonal. Issue #115.
  6. Divisible.
  7. EllipticE
  8. EllipticF
  9. EllipticK
  10. EllipticPi
  11. EulerPhi
  12. $Echo. Issue #42.
  13. FindRoot was improved for supporting numerical derivatives Issue
    #67, as well as the use of scipy libraries when are available.
  14. FindRoot (for the newton method) partially supports
    EvaluationMonitor and StepMonitor options.
  15. FindMinimum and FindMaximum now have a minimal implementation
    for 1D problems and the use of scipy libraries when are available.
  16. LogGamma.
  17. ModularInverse.
  18. NumericFunction.
  19. Projection.
  20. Partial support for Graphics option Opacity.
  21. SeriesData operations was improved.
  22. TraceEvaluation[] shows expression name calls and return values of
    it argument.
    • Pass option ShowTimeBySteps, to show accumulated time before
      each step
    • The variable $TraceEvalution when set True will show all
      expression evaluations.
  23. TraditionalForm

Enhancements

  1. D acts over Integrate and NIntegrate. Issue #130.
  2. SameQ (===) handles chaining, e.g. a == b == c or
    SameQ[a, b, c].
  3. Simplify handles expressions of the form Simplify[0^a] Issue
    #167.
  4. Simplify and FullSimplify support optional parameters
    Assumptions and ComplexityFunction.
  5. UnsameQ (=!=) handles chaining, e.g. a =!= b =!= c or
    UnsameQ[a, b, c].
  6. Assignments to usage messages associated with Symbols is allowed
    as it is in WMA. With this and other changes, Combinatorica 2.0
    works as written.
  7. Share[] performs an explicit call to the Python garbage collection
    and returns the amount of memory free.
  8. Improve the compatibility of TeXForm and MathMLForm outputs with
    WMA. MathML tags around numbers appear as "<mn>" tags instead of
    "<mtext>", except in the case of InputForm expressions. In
    TeXForm some quotes around strings have been removed to conform to
    WMA. It is not clear whether this is the correct behavior.
  9. Allow scipy and skimage to be optional. In particular: revise
    Nintegrate[] to use Method="Internal" when scipy isn't
    available.
  10. Pyston up to versions from 2.2 to 2.3.4 are supported as are PyPy
    versions from 3.7-7.3.9.0 up 3.9-7.3.9. However those Python
    interpreters may have limitations and limitations on packages that
    they support.
  11. Improved support for Series Issue #46.
  12. Cylinder rendering is implemented in Asymptote.

Documentation

  1. "Testing Expressions" section added.
  2. "Representation of Numbers" section added.
  3. "Descriptive Statistics" section added and "Moments" folded into
    that.
  4. Many More URL references. <url> now supports link text.
  5. Referecne Chapter and Sections are now in alphabetical order
  6. Two-column mode was removed in most sections so the printed PDF
    looks nicer.
  7. Printed Error message output in test examples is in typewriter font
    and doesn't drop inter-word spaces.

Internals

  1. Inexplicably, what the rest of the world calls a "nodes" in a tree
    or or in WMA "elements" in a tree had been called a "leaves". We
    now use the proper term "element".
  2. Lots of predefined Symbols have been added. Many appear in the
    module mathics.core.systemsymbols.
  3. Attributes are now stored in a bitset instead of a tuple of string.
    This speeds up attributes read, and RAM usage, .
  4. Symbol.is_numeric and Expression.is_numeric now uses the
    attribute Definition.is_numeric to determine the returned value.
  5. NIntegrate internal algorithms and interfaces to scipy were
    moved to mathics.algorithm.integrators and
    mathics.builtin.scipy_utils.integrators respectively.
  6. N[Integrate[...]] now is evaluated as NIntegrate[...]
  7. Definitions for symbols CurrentContext and ContextPath[] are
    mirrored in the mathics.core.definitions.Definitions object for
    faster access.
  8. FullForm[List[...]] is shown as {...} according to the WL
    standard.
  9. Expression.is_numeric() accepts an Evaluation object as a
    parameter; the definitions attribute of that is used.
  10. SameQ first checks the type, then the id, and then names in
    symbols.
  11. In mathics.builtin.patterns.PatternTest, if the condition is one
    of the most used tests (NumberQ, NumericQ, StringQ, etc) the
    match method is overwritten to specialized versions that avoid
    function calls.
  12. mathics.core.patterns.AtomPattern specializes the comparison
    depending of the Atom type.
  13. To speed up development, you can set NO_CYTHON to skip Cythonizing
    Python modules. If you are using Pyston or PyPy, Cythonization slows
    things down.
  14. any andall calls were unrolled as loops in Cythonized modules:
    this avoids the overhead of a function call replacing it by a (C)
    for loop, which is faster.
  15. A bug was fixed relating to the order in which
    mathics.core.definitions stores the rules
  16. InstanceableBuiltin -> BuiltinElement
  17. BoxConstruction -> BoxExpression
  18. the method Element.is_true() was removed in favor of
    is SymbolTrue
  19. N[_,_,Method->method] was reworked. Issue #137.
  20. The methods boxes_to_* were moved to BoxExpression.
  21. remove flatten_* from the Atom interface.
  22. Definition has a new property is_numeric.

Speed improvements:

  1. Creating two Symbol objects with the same name will give the same
    object. This avoids unnecessary string comparisons, and calls to
    ensure_context.
  2. Attributes are now stored in a bitset instead of a tuple of strings.
  3. The Definitions object has two properties: current_contex and
    context_path. This speeds up the lookup of symbols names. These
    properties store their values into the corresponding symbols in the
    builtin definitions.
  4. eval_N was add to speed up the then often-used built-in function
    N.
  5. Expression evaluation was gone over and improved. properties on
    the collection which can speed up evaluation, such as whether an
    expression is fully evaluated, is ordered, or is flat are collected.
  6. List evaluation is customized. There is a new ListExpression
    class which has a more streamlined evaluate() method. More of this
    kind of thing will follow
  7. BaseExpression.get_head avoids building a symbol saving two
    function calls.

Package update

  1. SymPy 1.10.1

Compatibility

  1. ScriptCommandLine now returns, as the first element, the name of
    the script file (when available), for compatibility with WMA. Issue
    #132.

  2. Expression.numerify improved in a way to obtain a behavior closer
    to WMA.

  3. NumericQ lhs expressions are now handled as a special case in assignment. For example NumericQ[a]=True tells the interpreter that a must be considered

  4. a numeric quantity, so NumericQ[Sin[a]] evaluates to True.

Bugs

  1. First, Rest and Last now handle invalid arguments.
  2. Set*: fixed issue #128.
  3. SameQ: comparison with MachinePrecision only needs to be exact
    within the last bit Issue #148.
  4. Fix a bug in Simplify that produced expressions of the form
    ConditionalExpression[_,{True}].
  5. Fix bug in Clear and ClearAll (#194).
  6. Fix base 10 formatting for infix Times. Issue #266.
  7. Partial fix of FillSimplify
  8. Streams used in MathicsOpen are now freed and their file descriptors
    now released. Issue #326.
  9. Some temporary files that were created are now removed from the
    filesystem. Issue #309.
  10. There were a number of small changes/fixes involving NIntegrate
    and its Method options. Nintegrate tests have been expanded.
  11. Fix a bug in handling arguments of pythonized expressions, that are
    produced by Compile when the llvmlite compiler fails.
  12. N now handles arbitrary precision numbers when the number of
    digits is not specified.
  13. [N[Indeterminate]]{.title-ref} now produces
    [Indeterminate]{.title-ref} instead a
    [PrecisionReal(nan)]{.title-ref}.
  14. Fix crash in NestWhile when supplying All as the fourth
    argument.
  15. Fix the comparison between Image and other expressions.
  16. Fix an issue that prevented that [Collect]{.title-ref} handles
    properly polynomials on expressions (issue #285).
  17. Fix a bug in formatting expressions of the form (-1)^a without the
    parenthesis (issue #332).
  18. Fix a but in failure in the order in which
    mathics.core.definitions stores the rules.
  19. Numeric overflows now do not affect the full evaluation, but instead
    just the element which produce it.
  20. Compatibility with the way expressions are ordered more closely
    follows WMA: Now expressions with fewer elements come first (issue
    #458).
  21. The order of the context name resolution (and $ContextPath) was
    switched; "System comes before "Global.

Incompatible changes

The following changes were motivated by a need to speed up the
interpreter.

  1. Expression arguments differ. The first parameter has to be a Symbol while the remaining arguments have to be some sort of BaseElement rather than something that can be convertedr to an element.

2 Properties for the collection of elements can be specified when they
are known. To get the old behavior, use to_expression

  1. Expressions which are lists are a new kind of class,
    ListExpression. As with expressions, the constructor requires
    valid elements, not something convertible to an element. Use
    to_mathics_list