Skip to content

Commit 7755cb9

Browse files
authored
Note more of the many changes (#1310)
More edits in `CHANGES.rst`. Go over functions up to PolygonalNumber
1 parent e60d2c6 commit 7755cb9

File tree

4 files changed

+70
-35
lines changed

4 files changed

+70
-35
lines changed

CHANGES.rst

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

4+
8.0.0
5+
-----
6+
47
This release is to get out some of the major changes that have gone on
58
already in advance of redoing Boxing and Formatting.
69

@@ -20,33 +23,41 @@ And in the ``Mathics3-Trepan`` repository:
2023
* ``Debugger[]``, and
2124
* ``TraceActivate[]``
2225

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.
26+
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..
27+
28+
This debuggign code is very much alpha quality, but it greatly
29+
improves the ability to debug problems in loading existing packages
30+
written from Mathematica. So packages ``BoolEval`` and ``CleanSlate``
31+
were added to the repostiory.
2732

2833
Also as a result of the improved ability to debug Mathics3, we now
2934
provide a version of Rubi 4.17 using git submodules . To use this you
3035
will need a patched version of ``stopit``. Aravindh Krishnamoorthy
31-
led the initial port of Rubi.
36+
led the initial port of `Rubi <https://github.com/Mathics3/Mathics3-Rubi>`_.
3237

3338
David A. Roberts worked on ensuring Mathics3 runs on pyodide and
3439
contributed a number of new Built-in Functions that are found in `The
35-
On-Line Encyclopedia of Integer Sequences (OEIS) <https://oeis.org/>`_
40+
On-Line Encyclopedia of Integer Sequences (OEIS) <https://oeis.org/>`_.
3641

3742

3843
New Builtins
3944
++++++++++++
4045

4146
* ``Between``
42-
* ``Breakpoint`` - forces a Python ``breakpoint()``
47+
* ``Breakpoint`` - (not WMA; forces a Python ``breakpoint()``
4348
* ``CheckAbort``
4449
* ``FileNameDrop``
4550
* ``FormatValues``
46-
* ``SetEnvironment``
51+
* ``ListStepPlot``
52+
* ``MapApply``
53+
* ``PythonCProfileEvaluation`` (not WMA; interface to Python cProfile)
54+
* ``RealValuedNumberQ``
4755
* ``SequenceForm``
56+
* ``SetEnvironment``
4857
* ``Stack``
58+
* ``SyntaxQ``
4959
* ``Trace``
60+
* ``UnitStep``
5061

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

@@ -77,8 +88,6 @@ By `@davidar <https://github.com/davidar>`_:
7788
``mathics`` command line
7889
++++++++++++++++++++++++
7990

80-
* ``--post-mortem`` option added which will go into the `trepan3k debugger <https https://pypi.org/project/trepan3k/>`_ on an unrecoverable error.
81-
8291
WMA Compatibility
8392
-----------------
8493

@@ -89,8 +98,10 @@ WMA Compatibility
8998
Internals
9099
---------
91100

92-
* Operator information has been gone over and is picked up from JSON
93-
tables produced from the Mathics Scanner project.
101+
* More of the on-OO evaluation code that forms what might be an
102+
instruction evaluator has been moved out of module
103+
``mathics.builtins`` put in ``mathics.eval``. This includes code for
104+
plotting, and making boxes.
94105

95106
Performance
96107
-----------
@@ -111,7 +122,7 @@ API incompatibility
111122
To specify associated format in ``format_`` methods the
112123
docstring, the list of format must be wrapped in parenthesis, like
113124
``(InputForm,): Definitions[...]`` instead of just ``InputForm: Definitions[...]``.
114-
125+
* 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 change. Here, we read this information in and use that instead of previously hard-coded values.
115126

116127

117128
Bugs
@@ -132,7 +143,7 @@ Mathics3 Packages
132143
Mathics3 Modules
133144
++++++++++++++++
134145

135-
* Added preliminary Mathics3 debugger ("pymathics.trepan")
146+
* Added preliminary `Mathics3 debugger `Mathics3-Trepan <https://github.com/Mathics3/mathics3-trepan>`_.
136147

137148
Python Package Updates
138149
+++++++++++++++++++++++

mathics/builtin/atomic/numbers.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,26 +301,37 @@ class NumberDigit(Builtin):
301301
https://reference.wolfram.com/language/ref/NumberDigit.html</url>
302302
303303
<dl>
304+
<dt>'NumberDigit[$x$, $n$]'
305+
<dd>returns the digit coefficient of 10^$n$ for the real-valued number $x$.
306+
304307
<dt>'NumberDigit[$x$, $n$, $b$]'
305-
<dd>returns the coefficient of $b^n$ in the base-$b$ representation of $x$.
308+
<dd>returns the coefficient of $b$^$n$ in the base-$b$ representation of $x$.
306309
</dl>
307310
308-
>> NumberDigit[123456, 2]
309-
= 4
310-
>> NumberDigit[12.3456, -1]
311+
Get the 10^2 digit of a 210.345:
312+
>> NumberDigit[210.345, 2]
313+
= 2
314+
315+
Get the 10^-1 digit of a 210.345:
316+
>> NumberDigit[210.345, -1]
311317
= 3
312318
319+
>> BaseForm[N[Pi], 2]
320+
= 11.00100100001111110_2
321+
322+
Get the 2^0 bit of the Pi:
323+
= 1
313324
"""
314325

315326
attributes = A_PROTECTED | A_READ_PROTECTED
316327

317-
summary_text = "digits of a real number"
318-
319328
rules = {
320329
"NumberDigit[x_, n_Integer]": "NumberDigit[x, n, 10]",
321330
"NumberDigit[x_, n_Integer, b_Integer]": "RealDigits[x, b, 1, n][[1]][[1]]",
322331
}
323332

333+
summary_text = "get digits of a real number"
334+
324335

325336
class RealDigits(Builtin):
326337
"""
@@ -776,7 +787,7 @@ class Precision(Builtin):
776787

777788
summary_text = "find the precision of a number"
778789

779-
def eval(self, z, evaluation):
790+
def eval(self, z, evaluation: Evaluation):
780791
"""Precision[z_]"""
781792
if isinstance(z, MachineReal):
782793
return SymbolMachinePrecision

mathics/builtin/intfns/combinatorial.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,23 +387,39 @@ class PolygonalNumber(Builtin):
387387
:Polygonal number: https://en.wikipedia.org/wiki/Polygonal_number</url> (<url>
388388
:WMA: https://reference.wolfram.com/language/ref/PolygonalNumber.html</url>)
389389
<dl>
390+
<dt>'PolygonalNumber[$n$]'
391+
<dd>gives the $n$th triangular number.
392+
390393
<dt>'PolygonalNumber[$r$, $n$]'
391394
<dd>gives the $n$th $r$-gonal number.
392395
</dl>
393396
394397
>> Table[PolygonalNumber[n], {n, 10}]
395398
= {1, 3, 6, 10, 15, 21, 28, 36, 45, 55}
396-
>> Table[PolygonalNumber[r, 10], {r, 3, 10}]
397-
= {55, 100, 145, 190, 235, 280, 325, 370}
399+
400+
The sum of two consecutive Polygonal numbers is the square of the larger number:
401+
>> Table[PolygonalNumber[n-1] + PolygonalNumber[n], {n, 10}]
402+
= {1, 4, 9, 16, 25, 36, 49, 64, 81, 100}
403+
404+
'PolygonalNumber'[$r$, $n$] can be interpreted as the number of points arranged in the form of $n$-1 polygons of $r$ sides.
405+
406+
List the tenth $r-gonal number of regular polygons from 3 to 8:
407+
>> Table[PolygonalNumber[r, 10], {r, 3, 8}]
408+
= {55, 100, 145, 190, 235, 280}
409+
410+
See also <url>
411+
:Binomial:
412+
doc/reference-of-built-in-symbols/integer-functions/combinatorial-functions/binomial/</url>, and <url>
413+
:RegularPolygon:
414+
doc/reference-of-built-in-symbols/drawing-graphics/regularpolygon/</url>.
398415
"""
399416

400417
attributes = A_LISTABLE | A_NUMERIC_FUNCTION | A_PROTECTED | A_READ_PROTECTED
401-
summary_text = "polygonal number"
402-
403418
rules = {
404419
"PolygonalNumber[n_Integer]": "PolygonalNumber[3, n]",
405420
"PolygonalNumber[r_Integer, n_Integer]": "(1/2) n (n (r - 2) - r + 4)",
406421
}
422+
summary_text = "get polygonal number"
407423

408424

409425
class RogersTanimotoDissimilarity(_BooleanDissimilarity):

mathics/builtin/intfns/recurrence.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,13 @@ class StirlingS1(Builtin):
138138
"""
139139
<url>
140140
:Stirling numbers of first kind:
141-
https://en.wikipedia.org/wiki/Stirling_numbers_of_the_first_kind</url> \
142-
(<url>
141+
https://en.wikipedia.org/wiki/Stirling_numbers_of_the_first_kind</url> (<url>
143142
:WMA link:
144143
https://reference.wolfram.com/language/ref/StirlingS1.html</url>)
145144
146145
<dl>
147146
<dt>'StirlingS1[$n$, $m$]'
148-
<dd>gives the Stirling number of the first kind $ _n^m$.
147+
<dd>gives the Stirling number of the first kind.
149148
</dl>
150149
151150
Integer mathematical function, suitable for both symbolic and numerical manipulation.
@@ -173,18 +172,16 @@ class StirlingS2(Builtin):
173172
"""
174173
<url>
175174
:Stirling numbers of second kind:
176-
https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind</url> \
177-
(<url>
178-
:WMA link
179-
:https://reference.wolfram.com/language/ref/StirlingS2.html</url>)
175+
https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind</url> (<url>
176+
:WMA link:
177+
https://reference.wolfram.com/language/ref/StirlingS2.html</url>)
180178
181179
<dl>
182180
<dt>'StirlingS2[$n$, $m$]'
183-
<dd>gives the Stirling number of the second kind _n^m.
181+
<dd>gives the Stirling number of the second kind. Returns the number of ways \
182+
of partitioning a set of $n$ elements into $m$ non empty subsets.
184183
</dl>
185184
186-
returns the number of ways of partitioning a set of $n$ elements into $m$ \
187-
non empty subsets.
188185
189186
>> Table[StirlingS2[10, m], {m, 10}]
190187
= {1, 511, 9330, 34105, 42525, 22827, 5880, 750, 45, 1}

0 commit comments

Comments
 (0)