Skip to content

Releases: Mathics3/mathics-core

10.0.1

07 May 10:30
f6a987e

Choose a tag to compare

Fix packaging to add some test YAML files.

Thanks, yet again, to @vic74p.

10.0.0

19 Apr 01:17

Choose a tag to compare

Some foundational work on overhauling plotting with NumPy vectors was started. Alas, work on it was not complete by release time, so this could not be finished. Expect a future release to have revamped graphics.

A major revision of Form handling and character encoding $CharacterEncoding was started with a focus on TeXForm, MathMLForm, and OutputForm.

Notes:

  1. There are numerous incompatible changes. Use with Mathics-scanner 10.0.0 or greater.
  2. We are in the process of renaming Mathics to Mathics3. You will notice a new Mathics3 logo in the documentation. Mathics was monolithic Python 2-ish code. Mathics3 has rewritten a number of major subcomponents and split off a number of subcomponents. There are still several that need to be revised or rewritten. The name change reflects this distinction between the two efforts, and emphasizes that Mathics3 uses modern Python 3 idioms. While right now the repository name and import refer to mathics, several repositories that use the Mathics3 core, or that Mathics3 uses, have been renamed. In particular, Mathics_Scanner is now Mathics3_Scanner.

New Builtins

  1. $Language variable
  2. ArcBox boxing function
  3. Csch function PR #1768
  4. JSON`Import`JSONImport
  5. RasterBox boxing function
  6. Format
  7. FormBox, and RoundBox boxing functions
  8. ShowSpecialCharacters option
  9. ShowStringCharacters option

Enhancements

  1. Many Builtin functions now report argument-mismatch errors
  2. Trig option added to Numerator and Denominator
  3. CharacterEncoding, and Path options added to Get
  4. PowerMod and Quotient handle the 3-argument form, roots of exponents (PowerMod), lists of exponents, and numbers other than Integers.
  5. N[integer, MachinePrecision] added
  6. PrintPrecision for N[integer] matches WMA; so does the largest mantissa before converting to MachinePrecision Integer (for display) matches WMA.
  7. BeginPackage with Needs parameter added. This should allow more packages to load properly
  8. Expand, and Apart work with relations
  9. #1596 Improve FullForm compatibility

Bugs Fixed

  1. PR #1755 Ensure date formats have a year in them. This is needed for future Python versions.
  2. PR #1762 Fix Rayleigh expansion rules to only match half-integer orders. (Chenxin Zhong)
  3. #1741 Implement MachinePrecision option for large numbers that fall outside of Python's built-in float mantissa
  4. #1740 N[3^200] in formats as PrecisionReal instead of MachinePrecision
  5. #1723 Plotting nested functions
  6. #1713 ? symbol and ?? symbol should be parsed as Information["symbol"] and Information["symbol"]
  7. #1699 Character sequences used for the string representation of boxes should be treated as single characters in string character-wise manipulation operations.
  8. #1692 Map does not automatically map a function over Association values (Li-Xiang-Ideal)
  9. #1639 Map does not automatically map a function over Association values
  10. #1622 Handling escape sequences inside string literals
  11. #1519 Order for Numerics, e.g. Order[1.0, 1] == -1, but is 0
  12. #1492 UpSet not giving a "Tag Integer is Protected." message
  13. #1487 FindMinimum, FindMaximum do not give approximate results when $IterationLimit has been exceeded and convergence fails
  14. #1481 $TraceBuiltins=False does not work after more than one $TraceBuiltins=True use.
  15. Reset evaluation.iteration_count on each new evaluation. This caused problems in long-running sessions, such as the Mathics3-django gallery examples.
  16. Binomial attributes corrected

Command-line Utilities

Command-line program mathics was renamed to mathics3; the old name will be available for a while. This apparently facilitates uv packaging.

Command-line program mathics3-codeparser-parse was added to show how expressions are parsed. This is roughly analogous to the CodeParse function of the CodeParser WMA package.

Internals

  • A major revision and reorganization was begun to improve Form
    handling, leading to the new modules mathics.forms.format and
    mathics.forms.render. Existing render functions from
    mathics.format has been moved under mathics.form.render. (mmatera) Corrections were made to variables $PrintForms and $OutputForms. (mmatera)
  • Primitive datatype NumericArray, which is essentially a NumPy array, was added to support vector operations, such as plotting. (Bruce Lucas) In support of this, the module mathics.core.atoms was split up.
  • Internals for handling Graphics have been revised to be able to accept a more complete list.
  • Parsing now uses more data from YAML tables instead of hard-coding values inside code.
  • Revise representation for Complex Numbers; both the real and imaginary parts can now be arbitrary non-complex Real numbers. The precision, a derived value, is also saved.
  • Numerous internal changes were made to improve performance.
  • mpmath is used to store large integer mantissas in N[x_Integer].
  • Token names were changed to align better with the names reported in
    CodeParser`Tokenize. Note, however, Mathics3 parsing is a bit different from CodeParser`Parse.

Package updates

  1. Python 3.14 supported. Support for Python 3.10 dropped; it may still work, but is not supported.
  2. Sympy 1.14 supported
  3. llvm 18+ now supported

API incompatibility

  • Front ends must now issue an explicit call to import_and_load_builtins(). Previously, this was handled simply by
    import of MathicsSession. Loading modules loaded via import was unpredictable in how and when things got loaded. The change was made to address this and to be able to give more flexibility in loading.
  • Token names have changed to align better with CodeParser ' CodeTokenize.

Documentation

Go over documentation for PowerMod[], Denominator[], Numerator[], Limit, and ColorData, among other things.

9.0.0: Release 9.0 (#1483)

29 Aug 00:39
5aaf5e5

Choose a tag to compare

Added support for Python 3.13. Dropped support for Python 3.8 and 3.9.

Note: There are incompatible changes. Use with Mathics-scanner 2.0.0 or greater.

You may notice a speedup in performance, especially graphics performance, in this version. There is a speedup due to removing conversions from Mathics3 to Python and vice versa for literal data, which happens a lot in plotting graphics. Also, Python 3.13 is a bit faster than previous versions. Previously, rendering via asymptote was slow. This is no longer the situation.

Preliminary work to track locations has started. This is useful in debugging and error reporting, and is controlled via Boolean System variable $TrackLocations.

Boxing operators have been added. The full range of escape sequences is supported. A limited form of boxing escape \* that handles a single Boxing function has been added.

A basic interrupt handler was added that loosely follows wolframscript's interrupt handler. Interrupt commands "abort", "exit", "continue", "debugger", "show", and "inspect" are available; "trace" will be added later.

main.py has been moved to __main__.py following Python conventions for main routines. This makes python -m mathics work. GNU Readline history is enabled for mathics when it is available. It shares history files with mathicsscript.

The priority for rule selection when there are several matching a function call has been revised and more closely follows WMA behavior.

Assignment statements, e.g. SetDelayed, UpSetDelayed, or DownSetDelayed have been revised to isolate left-hand-side references from conditions and element attributes. As a result, more of the code in WMA and Mathics3 packages work.

$IterationLimit detects runaway rule expansion better.

Parameter count checking expanded to more Builtin functions.

New Builtins

  • $SessionID
  • $TrackLocations (not WMA)
  • BinaryReadList[] (needed to support importing gzip files)
  • Hypergeometric2F1

By Aravindh Krishnamoorthy (needed for better Rubi support):

  • Hypergeometric1F1[]
  • HypergeometricPFQ[]
  • MeijerG[]
  • HypergeometricU[]

Documentation

Go over docs for Beta[], Gamma[], Product[], and infix operators with no meaning.
Expand Transpose[] documentation.

Enhancements

  • Set-related code reworked for better WMA conformance. There is better WMA conformance in rule selection when several rules match.
  • mathics CLI options are more like wolframscript
  • The debugging interface has been improved. TraceEvaluation[] and TraceDebug[] filter and colorize output for Mathics3 constructs much better.
  • Single-dash long options like -help, -file are now accepted. Short option -f is associated with -file rather than --fullform; -F is is now used for
    FullForm. Option --read with alias -r is now -code and short option -c.
  • Boolean Options ShowRewrites and ShowEvaluation were added to TraceEvalation[]. These are for either rewrite rules or evaluation expressions. Presumably, you don't want to filter both.
  • We check argument counts on more Builtin Functions and give error messages (tags argb, argx, argr, argrx) for invalid parameter combinations.
  • $TraceBuiltins output uses standard Mathics3 I/O mechanisms rather than Python's builtin print. Therefore, it will be seen in more front-ends like Django or PyOxide.

Bugs Fixed

  • #1057 ListPlot[] error handling (and NestList[]) needs going over
  • #1213 Condition[] expressions as second element in RuleDelayed behaviour not compatible with WMA
  • #1187 Add Hypergeometric2F1 Builtin Function
  • #1198 Blanks in Set operations are not properly handled in tag positions.
  • #1245 Add "lpn" error message checking in _ListPlot
  • #1383 Support for hypergeometric functions
  • #1384 Option management tweaks
  • #1388 In WMA, Pochhammer[0,-2] returns 1/2
  • #1395 Match WMA for Gamma[1+x] and Product[...]
  • #1405 structure_cache in mathics.core.expression.structure is None but we try to set it in _is_neutral_symbol()
  • #1412 Transpose[] does not work on three-dimensional array
  • #1425 `Erroneous Protected message in SetDelayed
  • #1432 URL links with $ in them are getting messed up
  • #1461 "noopen" errors sometimes return $Failed
  • #1465 Crash in running Trace[Sin[Log[2.5, 7]]]
  • #1473 Doctest for Quantity, KnownUnitQ, and others fail when the documentation is generated
  • #1474 Document typo: "is a valid Association object" should be "is a valid Quantity object"
  • #1476 $IterationLimit is not limiting evalation expansion

WMA Compatibility

  • Hypergeometric functions have been revised to conform better to WMA behavior by expanding hypergeometric results.
  • $IterationLimit now defaults to 4096.
  • mathics command-line conform better to wolframscript options.
  • Rule selection of functions when multiple rules apply conforms to WMA more closely.
  • LHS reference selection conforms to WMA more closely.

Incompatible changes

Scanner API has changed. Options on mathics CLI have changed. See above for the changes.
Location of mathics in mathics.__main__, the more usual location, rather than mathics.main.

  • Mathics scanner exceptions of class TranslateError are incompatible
    with previous versions, and now store error parameters, "name", "tag", and
    "args".
  • The method get_sort_key() was replaced by two different properties:
    element_order, for canonical ordering of expressions, and
    pattern_precedence, used for ordering rules according to their precedence
    in the evaluation loop.
  • In both cases, the part of the sort key related to properties of the
    expressions and patterns are now stored as a magic number instead of
    a tuple.

8.0.1

08 Feb 14:22

Choose a tag to compare

Some work was made on the Mathics3 Kernel to work in Python 3.13.
The maximum version of numpy was increased to < 2.3 to allow marimo to work.

Bugs

Correct for a mismatch between ListExpression and a tuple in DispatchAtom.
This is needed for the PacletManager code to work better.

Compatibility

  • When the result of an evaluation is Symbol`Null, Mathics CLI now does not show an Out[...]= line, following the behavior of
    the WMA CLI.
  • Asymptote rendering of platonic solids added.

Internals

Document tagging code handles TeX math mode more completely. Image tags in PDF properly.

Documentation

  • Documentation has been gone over so that expressions are tagged in TeX. As a result, the user guide and reference manual render much nicer in the PDF and Django.
  • More links have been added. References to The Digital Library of Mathematical Functions https://dlmf.nist.gov/ have been added where appropriate.
  • Add mention of MathicsLive
  • Platonic solid rendered properly in PDF

8.0.0

26 Jan 20:37

Choose a tag to compare

This release is to get out some of the major changes that have gone on already in advance of redoing Boxing and Formatting.

Code now supports the emscripten platform, so this code can be installed in pyodide using micropip.install.

Operators are now controlled from a new operators YAML table from the mathics-scanner repository. A pass was made over the Mathics parser to handle box operators more properly. More work is needed here.

We started adding more debugging capabilities:

  • Breakpoint[]
  • Stack[], and
  • Trace[]

And in the Mathics3-Trepan repository:

  • DebugActivate[]
  • Debugger[], and
  • TraceActivate[]

Option --post-mortem was added, which goes into the trepan3k debugger on an unrecoverable error. This option is available on other front ends.

This debugging code is very much alpha quality, but it greatly improves the ability to debug problems in loading existing packages
written from Mathematica. So packages BoolEval and CleanSlate were added to the repository.

Also, as a result of the improved ability to debug Mathics3, we now provide a version of Rubi 4.17 using git submodules. To use this, you will need a patched version of stopit. Aravindh Krishnamoorthy led the initial port of Rubi.

David A. Roberts worked on ensuring Mathics3 runs on pyodide and contributed a number of new Built-in Functions that are found in The On-Line Encyclopedia of Integer Sequences (OEIS).

New Builtins

  • Between
  • Breakpoint - (not WMA; forces a Python breakpoint()
  • CheckAbort
  • FileNameDrop
  • FormatValues
  • ListStepPlot
  • MapApply
  • PythonCProfileEvaluation (not WMA; interface to Python cProfile)
  • RealValuedNumberQ
  • SequenceForm
  • SetEnvironment
  • Stack
  • SyntaxQ
  • Trace
  • UnitStep

By @davidar <https://github.com/davidar>_:

  • BellB
  • DivisorSigma
  • DivisorSum
  • EulerE
  • HypergeometricU
  • IntegerPart
  • IntegerPartitions
  • JacobiSymbol
  • KroneckerSymbol
  • LambertW
  • LinearRecurrence
  • LucasL
  • MersennePrimeExponent
  • MoebiusMu
  • NumberDigit
  • PolygonalNumber
  • PolyLog
  • PowersRepresentations
  • ReverseSort
  • RootSum
  • SeriesCoefficient
  • SquaresR
  • Subfactorial

Documentation

  • Unicode operators appear in Django documentation. In the PDF, AMSLaTeX is used.
  • Summaries of builtin functions have been improved and regularized

mathics command line

Option --post-mortem was added, which goes into the trepan3k debugger <https https://pypi.org/project/trepan3k/>_ on an
unrecoverable error. This option is available on other front-ends.

WMA Compatibility

  • GetEnvironment expanded to handle [] and {var1, var2,...} forms
  • The system packages directory has been renamed Packages to conformance with WMA.
  • $Path now includes a Packages directory under $HOME.
  • All of the 100 or so Unicode operators without a pre-defined meaning are now supported

Internals

  • More of the on-OO evaluation code that forms what might be an
    instruction evaluator has been moved out of the module
    mathics.builtins put in mathics.eval. This includes code for plotting and making boxes.
  • nested TimeConstraint[] works via external Python module stopit.
  • Pause[] is more interruptable
  • More code has been linted, more type errors removed, and docstrings added/improved

Performance

  • Blank* patterns without arguments are now singletons.

API incompatibility

  • Matcher now requires an additional evaluation parameter
  • Romberg removed as an NIntegrate[] method. It is deprecated in SciPy and is to be removed by SciPy 1.15.
  • The signature of the Definition.__init__ now receives a single dict parameter instead of the several *values parameters.
  • Rule positions in Definition.{get|set}_values now includes the word values. For example pos="up" now is pos="upvalues".
  • Definitions.get_ownvalue now returns a BaseElement instead of a BaseRule object.
  • Patterns in eval_ and format_ methods of builtin classes
    parses patterns in docstrings of the form
    Symbol: Expr as Pattern[Symbol, Expr].
    To specify the associated format in format_ methods, the
    docstring, the list of formats must be wrapped in parentheses, like
    (InputForm,): Definitions[...] instead of just InputForm: Definitions[...].
  • Character and Operator information that has been gone over in the Mathics Scanner project. The information in JSON tables, the keys, and values have thus changed. Here, we read this information in and use it instead of previously hard-coded values.

Bugs

Mathics3 Packages

  • Added BoolEval
  • Added CleanSlate
  • Combinatorica moved to a separate repository and v.9 was renamed to 0.9.1.
    More code v0.9.1 works. v2.0 was renamed v2.0.1, and some code now works.
  • Rubi version 4.17 (work in progress; algebraic integrations work)

Mathics3 Modules

Python Package Updates

  • Python 3.12 is now supported
  • SymPy 1.13 is now supported

7.0.0

09 Aug 17:11

Choose a tag to compare

Some work was done here in support of planned future improvements like lazy loading of builtin functions. A bit of effort was also spent to modernize Python code and style, add more type annotations, remove spelling errors, and use newer versions of important software like SymPy and Python itself.

New Builtins

  • $MaxLengthIntStringConversion
  • Elements
  • ComplexExpand (thanks to vitrun)
  • ConjugateTranspose
  • LeviCivitaTensor
  • RealAbs and RealSign
  • RealValuedNumberQ

Documentation

Many formatting issues with the PDF file have been addressed. In particular, the spacing of section numbers in the chapter and section table of contents has been increased. The margin space around builtin definitions has also been increased. Numerous spelling corrections to the document have been applied.

The code to run doctests and produce LaTeX documentation has been revised and refactored to allow incremental builtin update, and to DRY the code.

Section Head-Related Operations is a new section of "Expression Structure". The title of the PDF has changed from Mathics to Mathics3 and the introduction has been updated and revised.

Compatibility

  • *Plot does not show messages during the evaluation.
  • Range[] now handles a negative di PR #951
  • Improved support for DirectedInfinity and Indeterminate.
  • Graphics and Graphics3D, including wrong primitives and
    directives, are shown with a pink background. In the Mathics-Django interface, a tooltip error message is also shown.
  • Improving support for $CharacterEncoding. Now it is possible to
    change it from inside the session.

Internals ---

  • eval_abs and eval_sign extracted from Abs and Sign and added to mathics.eval.arithmetic.
  • Maximum number of digits allowed in a string set to 7000 and can be adjusted using the environment variable MATHICS_MAX_STR_DIGITS on Python versions that don't adjust automatically (like pyston).
  • Real number comparisons implemented are now in the internal implementation of RealSign.
  • For Python 3.11, the variable $MaxLengthIntStringConversion controls the maximum size of the literal conversion between large integers and Strings.
  • Older style non-appearing and non-pedagogical doctests have been converted to pytest
  • Built-in code is directed explicitly rather than implicitly. This facilitates the ability to lazy load builtins or "autoload" them via GNU Emacs autoload.
  • add mpmath lru cache
  • Some work was done to make it possible so that in the future, we can speed up initial loading and reduce the initial memory footprint

Bugs

  • Definitions is compatible with pickle.
  • Improved support for Quantity expressions, including conversions, formatting, and arithmetic operations.
  • Background option for Graphics and Graphics3D is operative again.
  • Numeric comparisons against expressions involving Strings; Issue #797)
  • Switch[] involving Infinity. Issue #956
  • Outer[] on SparseArray. Issue #939
  • ArrayQ[] detects SparseArray PR #947
  • BoxExpressionError exceptions handled. Issue PR #970
  • Derivative evaluation of True, False, and List[] corrected. PR #971, #973
  • Combinatorica package fixes. PR #974
  • Exit[] not working. PR #998
  • BaseForm is now listed in $OutputForms

API

We now require an explicit call to a new functionimport_and_load_builtins(). Previously, loading was implicit and
indeterminate as to when this occurred, as it was based on the import order.

We need this so that we can support in the future lazy loading of builtin modules.

Package updates

  1. Python 3.11 is now supported
  2. Sympy 1.12 is now supported

6.0.4

25 Nov 02:24

Choose a tag to compare

Fixed botched 6.0.3 release:

Correct type annotation in mathics.session.MathicsSession

See #934

6.0.3

18 Nov 16:40

Choose a tag to compare

Correct type annotation in mathics.session.MathicsSession

See #934

OpenSUSE Tumbleweed

23 Jul 21:13

Choose a tag to compare

Change testing to facilitate openSUSE Tumbleweed distribution which uses Sympy 1.12. See Issue #881.

6.0.1

05 Mar 10:19

Choose a tag to compare

Release to get Pillow 9.2 dependency added for Python 3.7+

Note that future releases in the 6.1 or 7.0 range will drop support for Python 3.6.

Some Pattern-matching code has been gone over to add type annotations and to start documenting its behavior and characteristics. Function
attributes are now examined and stored at the time of Pattern-object creation rather than at evaluation time. This better matches WMA behavior, which pulls out the attribute this even earlier than this. These changes reduce doctest runtime by about 7% under Pyston.

Combinatorica version upgraded from 0.9 (circa 1992) to 0.91 (circa 1995), which more closely matches the published book.

Random Builtin function documentation has been gone over to conform to the current documentation style.