Releases: Mathics3/mathics-core
7.0.0
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
andRealSign
RealValuedNumberQ
Documentation
Many formatting issues with the PDF file have been addressed. In particular, the spacing of section numbers in chapter and section table of contents has been increased. The margin space around builtin definitions has a 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 off 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 negativedi
PR #951- Improved support for
DirectedInfinity
andIndeterminate
. Graphics
andGraphics3D
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
andeval_sign
extracted fromAbs
andSign
and added tomathics.eval.arithmetic
.- Maximum number of digits allowed in a string set to 7000 and can be adjusted using environment variable
MATHICS_MAX_STR_DIGITS
on Python versions that don't adjust automatically (like pyston). - Real number comparisons implemented is based 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 works 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 withpickle
.- Improved support for
Quantity
expressions, including conversions, formatting and arithmetic operations. Background
option forGraphics
andGraphics3D
is operative again.- Numeric comparisons against expressions involving
String
s; Issue #797) Switch[]
involvingInfinity
. Issue #956Outer[]
onSparseArray
. Issue #939ArrayQ[]
detectsSparseArray
PR #947BoxExpressionError
exceptions handled Issue. PR #970Derivative
evaluation ofTrue
,False
andList[]
corrected. PR #971, #973Combinatorica
package fixes. PR #974Exit[]
not working. PR #998BaseForm
is now listed as 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 import order.
We need this so that we can support in the future lazy loading of builtin modules.
Package updates
- Python 3.11 is now supported
- Sympy 1.12 is now supported
6.0.4
6.0.3
OpenSUSE Tumbleweed
Change testing to facilitate openSUSE Tumbleweed distribution which uses Sympy 1.12. See Issue #881.
6.0.1
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 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 attribute this even earlier than this. These changes speed up doctest running time by about 7% under Pyston.
Combinatorica version upgraded from 0.9 (circa 1992) to 0.91 (circa 1995) which closer matches the published book.
Random Builtin function documentation gone over to conform to current documentation style.
Too late for Valentines Day
A fair bit of code refactoring has gone on so that we might be able to scale the code, get it to be more performant, and more in line with other interpreters. There is greater use of Symbols as opposed to strings.
The builtin Functions have been organized into grouping akin to what is found in WMA. This is not just for documentation purposes, but it better modularizes the code and keep the modules smaller while suggesting where functions below as we scale.
Image Routines have been gone over and fixed. Basically we use Pillow imaging routines and as opposed to home-grown image code.
A number of Built-in functions that were implemented were not accessible for various reasons.
Mathics3 Modules are better integrated into the documentation. Existing Mathics3 modules pymathics.graph
and pymathics.natlang
have had a major overhaul, although more is needed. And will continue after the 6.0.0 release
We have gradually been rolling in more Python type annotations and current Python practices such as using isort
, black
and flake8
.
Evaluation methods of built-in functions start eval_
not apply_
.
API
- New function
mathics.system_info.python_implementation()
shows the Python Implementation, e.g. CPython, PyPy, Pyston that is running Python. This is included in the informationmathics.system_info.mathics_system__system_info()
returns and is used in$PythonImplementation
- A list of optional software can be found in
mathics.optional_software
. Versions of that software are included inmathics.version_info
.
Package update
- SymPy 1.11.1 accepted
- Numpy 1.24.0 accepted
New Builtins
$BoxForms
$OutputForms
$PrintForms
$PythonImplementation
Accuracy
ClebschGordan
Curl
(2-D and 3-D vector forms only)DiscretePlot
Kurtosis
ListLogPlot
LogPlot
$MaxMachineNumber
$MinMachineNumber
NumberLinePlot
PauliMatrix
Remove
SetOptions
SixJSymbol
Skewness
ThreeJSymbol
Documentation
- All Builtins have links to WMA pages.
- "Accuracy and Precision" section added to the Tutorial portion.
- "Attribute Definitions" section reinstated.
- "Expression Structure" split out as a guide section (was "Structure of Expressions").
- "Exponential Functional" split out from "Trigonometry Functions"
- "Functional Programming" section split out.
- "Image Manipulation" has been split off from Graphics and Drawingand turned into a guide section.
- Image examples now appear in the LaTeX and therfore the PDF doc
- "Logic and Boolean Algebra" section reinstated.
- "Forms of Input and Output" is its own guide section.
- More URL links to Wiki pages added; more internal cross links added.
- "Units and Quantities" section reinstated.
- The Mathics3 Modules are now included in LaTeX and therefore the PDF doc.
Internals
boxes_to_
methods are now optional forBoxElement
subclasses. Most of the code is now moved to themathics.format
submodule, and implemented in a more scalable way.from_mpmath
conversion supports a new parameteracc
to set the accuracy of the number.mathics.builtin.inout
was split in several modules (inout
,messages
,layout
,makeboxes
) in order to improve the documentation.mathics.eval
was create to have code that might be put in an instruction interpreter. The opcodes-like functions starteval_
, other functions are helper functions for those.- Operator name to Unicode or ASCII comes from Mathics scanner character tables.
- Builtin instance methods that start
eval
are considered rule matching and function application; the use of the nameapply
is deprecated, wheneval
is intended. - Modularize and improve the way in which
Builtin
classes are selected to have an associatedDefinition
. _SetOperator.assign_elementary
was renamed_SetOperator.assign
. All the special cases are not handled by the_SetOperator.special_cases
dict.isort
run over all Python files. More type annotations and docstrings on functions added.- caching on immutable atoms like,
String
,Integer
,Real
, etc. was improved; the__hash__()
function was sped up. There is asmall speedup overall from this at the expense of increased memory. - more type annotations added to functions, especially builtin functions
- Numerical constants used along the code was renamed using caps, according to the Python's convention.
Bugs
0
with a given precision (like in0`3
) is now parsed as0
, an integer number.- Reading certain GIFs now work again
Random[]
works now.RandomSample
with one list argument now returns a random ordering of the list items. Previously it would return just one item.- Origin placement corrected on
ListPlot
andLinePlot
. - Fix long-standing bugs in Image handling
- Some scikit image routines line
EdgeDetect
were getting omitted due to overly stringent PyPI requirements - Units and Quantities were sometimes failing. Also they were omitted from documentation.
- Better handling of
Infinite
quantities. - Improved
Precision
andAccuracy
compatibility with WMA. In particular,Precision[0.]
andAccuracy[0.]
- Accuracy in numbers using the notation
n.nnn``acc
now is properly handled. - numeric precision in mpmath was not reset after operations that changed these. This cause huges slowdowns after an operation that set the mpmath precison high. This was the source of several-minute slowdowns in testing.
- GIF87a (```MadTeaParty.gif`` or ExampleData) image loading fixed
- Replace non-free Leena image with a a freely distributable image. Issue #728
PyPI Package requirements
Mathics3 aims at a more richer set of functionality.
Therefore NumPy and Pillow (9.10 or later) are required Python packages where they had been optional before. In truth, probably running Mathics without one or both probably did not work well if it worked at all; we had not been testing setups that did not have NumPy.
Enhancements
- Vector restriction on
Norm[]
removed. "Frobinius" p-form allowed. - Better handling of comparisons with finite precision numbers.
- Improved implementation for
Precision
. - Infix operators, like
->
render with their Unicode symbol when$CharacterEncoding
is not "ASCII".
*Grid
compatibility with WMA was improved. Now it supports non-uniform list of lists and lists with general elements. - Support for BigEndian Big TIFF
5.0.2
Get ready for release 5.0.1
Overview
Mostly a release to fix a Python packaging problem.
format
anddo_format
methods were removed from the interface of
BaseElement
, becoming non-member functions.- The class
BoxElement
was introduced as a base for boxing elements.
New Builtin
- 'Inverse Gudermannian'.
Documentation
Hyperbolic functions were split off form trigonometry and exponential functions. More url links were added.
Bugs
*r Creating a complex number from Infinity no longer crashes and returns 'I * Infinity'
Just when you though you had forgotten Mathics3
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
- Euler's
Beta
function. Bernoulli
.CatalanNumber
(Integer arguments only).CompositeQ
.Diagonal
. Issue #115.Divisible
.EllipticE
EllipticF
EllipticK
EllipticPi
EulerPhi
$Echo
. Issue #42.FindRoot
was improved for supporting numerical derivatives Issue
#67, as well as the use of scipy libraries when are available.FindRoot
(for thenewton
method) partially supports
EvaluationMonitor
andStepMonitor
options.FindMinimum
andFindMaximum
now have a minimal implementation
for 1D problems and the use of scipy libraries when are available.LogGamma
.ModularInverse
.NumericFunction
.Projection
.- Partial support for Graphics option
Opacity
. SeriesData
operations was improved.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.
- Pass option
TraditionalForm
Enhancements
D
acts overIntegrate
andNIntegrate
. Issue #130.SameQ
(===
) handles chaining, e.g.a == b == c
or
SameQ[a, b, c]
.Simplify
handles expressions of the formSimplify[0^a]
Issue
#167.Simplify
andFullSimplify
support optional parameters
Assumptions
andComplexityFunction
.UnsameQ
(=!=
) handles chaining, e.g.a =!= b =!= c
or
UnsameQ[a, b, c]
.- 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. Share[]
performs an explicit call to the Python garbage collection
and returns the amount of memory free.- Improve the compatibility of
TeXForm
andMathMLForm
outputs with
WMA. MathML tags around numbers appear as "<mn>" tags instead of
"<mtext>", except in the case ofInputForm
expressions. In
TeXForm some quotes around strings have been removed to conform to
WMA. It is not clear whether this is the correct behavior. - Allow
scipy
andskimage
to be optional. In particular: revise
Nintegrate[]
to useMethod="Internal"
when scipy isn't
available. - 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. - Improved support for
Series
Issue #46. Cylinder
rendering is implemented in Asymptote.
Documentation
- "Testing Expressions" section added.
- "Representation of Numbers" section added.
- "Descriptive Statistics" section added and "Moments" folded into
that. - Many More URL references.
<url>
now supports link text. - Referecne Chapter and Sections are now in alphabetical order
- Two-column mode was removed in most sections so the printed PDF
looks nicer. - Printed Error message output in test examples is in typewriter font
and doesn't drop inter-word spaces.
Internals
- 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". - Lots of predefined
Symbol
s have been added. Many appear in the
modulemathics.core.systemsymbols
. - Attributes are now stored in a bitset instead of a tuple of string.
This speeds up attributes read, and RAM usage, . Symbol.is_numeric
andExpression.is_numeric
now uses the
attributeDefinition.is_numeric
to determine the returned value.NIntegrate
internal algorithms and interfaces toscipy
were
moved tomathics.algorithm.integrators
and
mathics.builtin.scipy_utils.integrators
respectively.N[Integrate[...]]
now is evaluated asNIntegrate[...]
- Definitions for symbols
CurrentContext
andContextPath[]
are
mirrored in themathics.core.definitions.Definitions
object for
faster access. FullForm[List[...]]
is shown as{...}
according to the WL
standard.Expression.is_numeric()
accepts anEvaluation
object as a
parameter; the definitions attribute of that is used.SameQ
first checks the type, then theid
, and then names in
symbols.- 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. mathics.core.patterns.AtomPattern
specializes the comparison
depending of theAtom
type.- 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. 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.- A bug was fixed relating to the order in which
mathics.core.definitions
stores the rules InstanceableBuiltin
->BuiltinElement
BoxConstruction
->BoxExpression
- the method
Element.is_true()
was removed in favor of
is SymbolTrue
N[_,_,Method->method]
was reworked. Issue #137.- The methods
boxes_to_*
were moved toBoxExpression
. - remove
flatten_*
from theAtom
interface. Definition
has a new propertyis_numeric
.
Speed improvements:
- Creating two
Symbol
objects with the same name will give the same
object. This avoids unnecessary string comparisons, and calls to
ensure_context
. - Attributes are now stored in a bitset instead of a tuple of strings.
- 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. eval_N
was add to speed up the then often-used built-in function
N
.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.List
evaluation is customized. There is a newListExpression
class which has a more streamlinedevaluate()
method. More of this
kind of thing will followBaseExpression.get_head
avoids building a symbol saving two
function calls.
Package update
- SymPy 1.10.1
Compatibility
-
ScriptCommandLine
now returns, as the first element, the name of
the script file (when available), for compatibility with WMA. Issue
#132. -
Expression.numerify
improved in a way to obtain a behavior closer
to WMA. -
NumericQ
lhs expressions are now handled as a special case in assignment. For exampleNumericQ[a]=True
tells the interpreter thata
must be considered -
a numeric quantity, so
NumericQ[Sin[a]]
evaluates toTrue
.
Bugs
First
,Rest
andLast
now handle invalid arguments.Set*
: fixed issue #128.SameQ
: comparison with MachinePrecision only needs to be exact
within the last bit Issue #148.- Fix a bug in
Simplify
that produced expressions of the form
ConditionalExpression[_,{True}]
. - Fix bug in
Clear
andClearAll
(#194). - Fix base 10 formatting for infix
Times
. Issue #266. - Partial fix of
FillSimplify
- Streams used in MathicsOpen are now freed and their file descriptors
now released. Issue #326. - Some temporary files that were created are now removed from the
filesystem. Issue #309. - There were a number of small changes/fixes involving
NIntegrate
and its Method options.Nintegrate
tests have been expanded. - Fix a bug in handling arguments of pythonized expressions, that are
produced byCompile
when the llvmlite compiler fails. N
now handles arbitrary precision numbers when the number of
digits is not specified.- [N[Indeterminate]]{.title-ref} now produces
[Indeterminate]{.title-ref} instead a
[PrecisionReal(nan)]{.title-ref}. - Fix crash in
NestWhile
when supplyingAll
as the fourth
argument. - Fix the comparison between
Image
and other expressions. - Fix an issue that prevented that [Collect]{.title-ref} handles
properly polynomials on expressions (issue #285). - Fix a bug in formatting expressions of the form
(-1)^a
without the
parenthesis (issue #332). - Fix a but in failure in the order in which
mathics.core.definitions
stores the rules. - Numeric overflows now do not affect the full evaluation, but inste...