Skip to content

Commit d445368

Browse files
authored
Start noting broad changes (#1308)
Fold in some public comments on release changes. Another pass at new builtin function docstrings.
1 parent 2b8bcb8 commit d445368

File tree

5 files changed

+118
-34
lines changed

5 files changed

+118
-34
lines changed

CHANGES.rst

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
11
CHANGES
22
=======
33

4+
This release is to get out some of the major changes that have gone on
5+
already in advance of redoing Boxing and Formatting.
6+
7+
Operators are now controlled from a new operators YAML table from the
8+
``mathics-scanner`` repository. A pass was made over the Mathics parser
9+
to handle box operators more properly. More work is needed here.
10+
11+
We started adding more debugging capabilites:
12+
13+
* ``Breakpoint[]``
14+
* ``Stack[]``, and
15+
* ``Trace[]``
16+
17+
And in the ``Mathics3-Trepan`` repository:
18+
19+
* ``DebugActivate[]``
20+
* ``Debugger[]``, and
21+
* ``TraceActivate[]``
22+
23+
This code is very much alpha quality, but it greatly improves the
24+
ability to debug problems in loading existing packages written from
25+
Mathematica. So packages ``BoolEval`` and ``CleanSlate`` were added to
26+
the repostiory.
27+
28+
Also as a result of the improved ability to debug Mathics3, we now
29+
provide a version of Rubi 4.17 using git submodules . To use this you
30+
will need a patched version of ``stopit``. Aravindh Krishnamoorthy
31+
led the initial port of Rubi.
32+
33+
David A. Roberts worked on ensuring Mathics3 runs on pyodide and
34+
contributed a number of new Built-in Functions that are found in `The
35+
On-Line Encyclopedia of Integer Sequences (OEIS) <https://oeis.org/>`_
36+
437

538
New Builtins
639
++++++++++++
@@ -13,6 +46,7 @@ New Builtins
1346
* ``SetEnvironment``
1447
* ``SequenceForm``
1548
* ``Stack``
49+
* ``Trace``
1650

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

@@ -45,8 +79,8 @@ By `@davidar <https://github.com/davidar>`_:
4579

4680
* ``--post-mortem`` option added which will go into the `trepan3k debugger <https https://pypi.org/project/trepan3k/>`_ on an unrecoverable error.
4781

48-
Compatibility
49-
-------------
82+
WMA Compatibility
83+
-----------------
5084

5185
* ``GetEnvironment`` expanded to handle ``[]`` and ``{var1, var2,...}`` forms
5286
* The system ``packages`` directory has been renamed ``Packages`` to conformance with WMA.
@@ -57,13 +91,6 @@ Internals
5791

5892
* Operator information has been gone over and is picked up from JSON
5993
tables produced from the Mathics Scanner project.
60-
* Patterns in ``eval_`` and ``format_`` methods of builtin classes
61-
parses patterns in docstrings of the form
62-
``Symbol: Expr`` as ``Pattern[Symbol, Expr]``.
63-
To specify associated format in ``format_`` methods the
64-
docstring, the list of format must be wrapped in parenthesis, like
65-
``(InputForm,): Definitions[...]`` instead of just ``InputForm: Definitions[...]``.
66-
6794

6895
Performance
6996
-----------
@@ -78,6 +105,13 @@ API incompatibility
78105
* The signature of the ``Definition.__init__`` now receives a single dict parameter instead of the several `*values` parameters.
79106
* Rule positions in ``Definition.{get|set}_values`` now includes the word ``values``. For example ``pos="up"`` now is ``pos="upvalues"``.
80107
* ``Definitions.get_ownvalue`` now returns a ``BaseElement`` instead of a ``BaseRule`` object.
108+
* Patterns in ``eval_`` and ``format_`` methods of builtin classes
109+
parses patterns in docstrings of the form
110+
``Symbol: Expr`` as ``Pattern[Symbol, Expr]``.
111+
To specify associated format in ``format_`` methods the
112+
docstring, the list of format must be wrapped in parenthesis, like
113+
``(InputForm,): Definitions[...]`` instead of just ``InputForm: Definitions[...]``.
114+
81115

82116

83117
Bugs

README.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
Welcome to Mathics Core!
22
========================
33

4-
|Pypi Installs| |Latest Version| |Supported Python Versions|
4+
|PyPI Installs| |Latest Version| |Supported Python Versions|
55

66
|Packaging status|
77

88

99
Mathics3 is a general-purpose computer algebra system (CAS).
1010

11-
However this repository contains just the Python modules for WL Built-in functions, variables, core primitives, e.g. Symbol, a parser to create Expressions, and an evaluator to execute them.
11+
However this repository contains just the Mathics3 Kernel: Python
12+
modules for WL Built-in functions, variables, core primitives,
13+
e.g. Symbol, a parser to create Expressions, and an evaluator to
14+
execute them.
1215

13-
The home page for Mathics is https://mathics.org where you will find a list of screenshots and components making up the system.
16+
The home page for Mathics is https://mathics.org where you will find a
17+
list of screenshots and components making up the system.
1418

1519
Installing
1620
----------
@@ -22,15 +26,15 @@ See the `Installing Mathics3 <https://mathics-development-guide.readthedocs.io/e
2226
Running:
2327
--------
2428

25-
Mathics3, the core library comes with a very simple command-line program called ``mathics``::
29+
Mathics3 Kernel comes with a very simple command-line program called ``mathics``::
2630

2731
$ mathics
2832

29-
Mathics 5.0.3dev0
30-
on CPython 3.8.12 (heads/v2.3.4.1_release:4a6b4d3504, Jun 3 2022, 15:46:12)
31-
using SymPy 1.10.1, mpmath 1.2.1, numpy 1.23.1, cython 0.29.30
33+
Mathics 8.0.0
34+
on CPython 3.12.8 (main, Dec 9 2024, 11:38:23) [GCC 13.2.0]
35+
using SymPy 1.13.3, mpmath 1.3.0, numpy 1.26.4, cython Not installed
3236

33-
Copyright (C) 2011-2022 The Mathics Team.
37+
Copyright (C) 2011-2025 The Mathics3 Team.
3438
This program comes with ABSOLUTELY NO WARRANTY.
3539
This is free software, and you are welcome to redistribute it
3640
under certain conditions.
@@ -60,14 +64,12 @@ License
6064

6165
Mathics is released under the GNU General Public License Version 3 (GPL3).
6266

63-
.. |Travis| image:: https://secure.travis-ci.org/Mathics3/mathics-core.svg?branch=master
64-
.. _Travis: https://travis-ci.org/Mathics3/mathics-core
6567
.. _PyPI: https://pypi.org/project/Mathics/
6668
.. |mathicsscript| image:: https://github.com/Mathics3/mathicsscript/blob/master/screenshots/mathicsscript1.gif
6769
.. |mathicssserver| image:: https://mathics.org/images/mathicsserver.png
6870
.. |Latest Version| image:: https://badge.fury.io/py/Mathics3.svg
6971
:target: https://badge.fury.io/py/Mathics3
70-
.. |Pypi Installs| image:: https://pepy.tech/badge/Mathics3
72+
.. |PyPI Installs| image:: https://pepy.tech/badge/Mathics3
7173
.. |Supported Python Versions| image:: https://img.shields.io/pypi/pyversions/Mathics3.svg
7274
.. |Packaging status| image:: https://repology.org/badge/vertical-allrepos/mathics.svg
7375
:target: https://repology.org/project/mathics/versions

mathics/builtin/intfns/recurrence.py

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424

2525
class Fibonacci(MPMathFunction):
2626
"""
27-
<url>:WMA link:https://reference.wolfram.com/language/ref/Fibonacci.html</url>
27+
<url>
28+
:Fibonacci Sequence:
29+
https://en.wikipedia.org/wiki/Fibonacci_sequence</url>, <url>(
30+
:WMA link:https://reference.wolfram.com/language/ref/Fibonacci.html</url>)
2831
2932
<dl>
3033
<dt>'Fibonacci[$n$]'
@@ -43,6 +46,10 @@ class Fibonacci(MPMathFunction):
4346
= 280571172992510140037611932413038677189525
4447
>> Fibonacci[7, x]
4548
= 1 + 6 x ^ 2 + 5 x ^ 4 + x ^ 6
49+
50+
See also <url>
51+
:LinearRecurrence:
52+
/doc/reference-of-built-in-symbols/integer-functions/recurrence-and-sum-functions/linearrecurrence</url>.
4653
"""
4754

4855
nargs = {1}
@@ -84,17 +91,36 @@ class HarmonicNumber(MPMathFunction):
8491

8592
class LinearRecurrence(Builtin):
8693
"""
87-
<url>:WMA link:https://reference.wolfram.com/language/ref/LinearRecurrence.html</url>
94+
<url>:Linear recurrence with constant coefficients:
95+
https://en.wikipedia.org/wiki/Linear_recurrence_with_constant_coefficients</url>, <url>
96+
:WMA link:https://reference.wolfram.com/language/ref/LinearRecurrence.html</url>
8897
8998
<dl>
9099
<dt>'LinearRecurrence[$ker$, $init$, $n$]'
91-
<dd>computes $n$ terms of the linear recurrence with kernel $ker$ and initial values $init$
100+
<dd>computes $n$ terms of the linear recurrence with kernel $ker$ and initial values $init$.
101+
102+
<dt>'LinearRecurrence[$ker$, $init$, {$n$}]'
103+
<dd>computes the $n$th term.
104+
105+
<dt>'LinearRecurrence[$ker$, $init$, {$n_min$, $n_max$}]'
106+
<dd>computes $n$ terms of the linear recurrence with kernel $ker$ and initial values $init$.
92107
</dl>
93108
109+
Generate first 10 items of the Fibonacci Sequence, 'F'[0]=1, 'F'[1]=1:
94110
>> LinearRecurrence[{1, 1}, {1, 1}, 10]
95111
= {1, 1, 2, 3, 5, 8, 13, 21, 34, 55}
96-
>> LinearRecurrence[{1, 1}, {1, 1}, {5, 5}]
97-
= {5}
112+
113+
Extract the 3rd to 5th elements:
114+
>> LinearRecurrence[{1, 1}, {1, 1}, {3, 5}]
115+
= {2, 3, 5}
116+
117+
Now just the 6th element:
118+
>> LinearRecurrence[{1, 1}, {1, 1}, {6}]
119+
= 8
120+
121+
See also <url>
122+
:Fibonacci:
123+
/doc/reference-of-built-in-symbols/integer-functions/recurrence-and-sum-functions/fibonacci</url>.
98124
"""
99125

100126
attributes = A_PROTECTED | A_READ_PROTECTED

mathics/builtin/numbers/numbertheory.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,10 @@ def eval_with_b(self, n, b, evaluation: Evaluation):
674674
class MersennePrimeExponent(SympyFunction):
675675
"""
676676
<url>
677+
:Mersenne Prime:
678+
https://en.wikipedia.org/wiki/Mersenne_prime</url> exponent (<url>
677679
:SymPy: https://docs.sympy.org/latest/modules/ntheory.html#sympy.ntheory.factor_.mersenne_prime_exponent</url>, <url>
678-
:WMA: https://reference.wolfram.com/language/ref/MersennePrimeExponent.html</url>
680+
:WMA: https://reference.wolfram.com/language/ref/MersennePrimeExponent.html</url>)
679681
680682
<dl>
681683
<dt>'MersennePrimeExponent[$n$]'
@@ -705,12 +707,11 @@ class MoebiusMu(SympyFunction):
705707
706708
<dl>
707709
<dt>'MoebiusMu[$n$]'
708-
<dd>returns μ($n$)
710+
<dd>returns μ($n$).
709711
</dl>
710712
711713
>> Array[MoebiusMu, 10]
712714
= {1, -1, -1, 0, -1, 1, -1, 0, 0, 1}
713-
714715
"""
715716

716717
attributes = A_LISTABLE | A_PROTECTED

mathics/builtin/specialfns/expintegral.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,38 @@ class ExpIntegralEi(MPMathFunction):
5454

5555
class LambertW(Builtin):
5656
"""
57-
<url>:Lambert W-Function: https://mathworld.wolfram.com/LambertW-Function.html</url>
57+
<url>
58+
:Lambert <i>W</i> Function:
59+
https://en.wikipedia.org/wiki/Lambert_W_function</url>, <url>:MathWorld:
60+
https://mathworld.wolfram.com/LambertW-Function.html</url>
5861
5962
<dl>
63+
<dt>'LambertW[$k$]'
64+
<dd>alias for ProductLog[$z$].
65+
6066
<dt>'LambertW[$k$, $z$]'
6167
<dd>alias for ProductLog[$k$, $z$].
6268
</dl>
6369
6470
>> LambertW[k, z]
6571
= ProductLog[k, z]
72+
73+
>> Plot[LambertW[x], {x, -1/E, E}]
74+
= -Graphics-
75+
76+
See also <url>
77+
:ProductLog:
78+
/doc/reference-of-built-in-symbols/special-functions/exponential-integral-and-special-functions/productlog</url>.
6679
"""
6780

6881
attributes = A_LISTABLE | A_PROTECTED
69-
summary_text = "undocumented alias"
82+
mpmath_name = "lambertw"
7083
rules = {
7184
"LambertW[z_]": "ProductLog[z]",
7285
"LambertW[k_, z_]": "ProductLog[k, z]",
7386
}
87+
summary_text = "Lambert W function"
88+
sympy_name = "LambertW" # function called LambertW in SymPy
7489

7590

7691
class ProductLog(MPMathFunction):
@@ -79,7 +94,10 @@ class ProductLog(MPMathFunction):
7994
8095
<dl>
8196
<dt>'ProductLog[$z$]'
82-
<dd>returns the value of the Lambert W function at $z$.
97+
<dd>returns the principle solution for $w$ in $z$ == $wE$^$w$.
98+
99+
<dt>'ProductLog[$k$, $z$]'
100+
<dd>gives the $k$th solution.
83101
</dl>
84102
85103
The defining equation:
@@ -92,14 +110,15 @@ class ProductLog(MPMathFunction):
92110
>> ProductLog[E]
93111
= 1
94112
113+
>> ProductLog[-1.5]
114+
= -0.0327837 + 1.54964 I
115+
95116
The graph of 'ProductLog':
96117
>> Plot[ProductLog[x], {x, -1/E, E}]
97118
= -Graphics-
98119
"""
99120

100121
attributes = A_LISTABLE | A_PROTECTED | A_READ_PROTECTED
101-
summary_text = "Lambert's W function"
102-
sympy_name = "LambertW" # function called LambertW in SymPy
103122
mpmath_name = "lambertw"
104123

105124
rules = {
@@ -108,9 +127,11 @@ class ProductLog(MPMathFunction):
108127
"ProductLog[z_] * E ^ ProductLog[z_]": "z",
109128
"Derivative[1][ProductLog]": "ProductLog[#] / (# (ProductLog[#] + 1))&",
110129
}
130+
summary_text = "Lambert's W function"
131+
sympy_name = "LambertW" # function called LambertW in SymPy
111132

112133

113-
# TODO: Zernike polynomials not yet implemented in mpmath nor sympy
134+
# TODO: Zernike polynomials not yet implemented in mpmath nor SymPy
114135
#
115136
# class ZernikeR(MPMathFunction):
116137
# """

0 commit comments

Comments
 (0)