Skip to content

Commit

Permalink
Merge branch 'master' into fix_797
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatera authored Aug 3, 2024
2 parents d3dbf17 + fb29d32 commit 5840467
Show file tree
Hide file tree
Showing 84 changed files with 2,991 additions and 2,535 deletions.
8 changes: 4 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Documentation
#. "Exponential Functional" split out from "Trigonometry Functions"
#. "Functional Programming" section split out.
#. "Image Manipulation" has been split off from Graphics and Drawing and turned into a guide section.
#. Image examples now appear in the LaTeX and therfore the PDF doc
#. Image examples now appear in the LaTeX and therefore 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.
Expand Down Expand Up @@ -184,7 +184,7 @@ Bugs
#. Better handling of ``Infinite`` quantities.
#. Improved ``Precision`` and ``Accuracy``compatibility with WMA. In particular, ``Precision[0.]`` and ``Accuracy[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.
#. numeric precision in mpmath was not reset after operations that changed these. This cause huges slowdowns after an operation that set the mpmath precision 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

Expand Down Expand Up @@ -1062,7 +1062,7 @@ New features (50+ builtins)
#. ``SubsetQ`` and ``Delete[]`` #688, #784,
#. ``Subsets`` #685
#. ``SystemTimeZone`` and correct ``TimeZone`` #924
#. ``System\`Byteordering`` and ``System\`Environemnt`` #859
#. ``System\`Byteordering`` and ``System\`Environment`` #859
#. ``$UseSansSerif`` #908
#. ``randchoice`` option for ``NoNumPyRandomEnv`` #820
#. Support for ``MATHICS_MAX_RECURSION_DEPTH``
Expand Down Expand Up @@ -1412,7 +1412,7 @@ New features
#. ``PolarPlot``
#. IPython style (coloured) input
#. ``VectorAnalysis`` Package
#. More special functions (Bessel functions and othogonal polynomials)
#. More special functions (Bessel functions and orthogonal polynomials)
#. More NumberTheory functions
#. ``Import``, ``Export``, ``Get``, ``Needs`` and other IO related functions
#. PyPy compatibility
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
identity and expression, level of experience, education, socioeconomic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PIP ?= pip3
BASH ?= bash
RM ?= rm
PYTEST_OPTIONS ?=
DOCTEST_OPTIONS ?=

# Variable indicating Mathics3 Modules you have available on your system, in latex2doc option format
MATHICS3_MODULE_OPTION ?= --load-module pymathics.graph,pymathics.natlang
Expand Down Expand Up @@ -132,9 +133,9 @@ gstest:
doctest-data: mathics/builtin/*.py mathics/doc/documentation/*.mdoc mathics/doc/documentation/images/*
MATHICS_CHARACTER_ENCODING="UTF-8" $(PYTHON) mathics/docpipeline.py --output --keep-going $(MATHICS3_MODULE_OPTION)

#: Run tests that appear in docstring in the code.
#: Run tests that appear in docstring in the code. Use environment variable "DOCTEST_OPTIONS" for doctest options
doctest:
MATHICS_CHARACTER_ENCODING="ASCII" SANDBOX=$(SANDBOX) $(PYTHON) mathics/docpipeline.py $o
MATHICS_CHARACTER_ENCODING="ASCII" SANDBOX=$(SANDBOX) $(PYTHON) mathics/docpipeline.py $(DOCTEST_OPTIONS)

#: Make Mathics PDF manual via Asymptote and LaTeX
latexdoc texdoc doc:
Expand Down
8 changes: 4 additions & 4 deletions PAST.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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 buitin Functions have been organized into grouping akind to what is found in WMA.
The builtin Functions have been organized into grouping akind 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.

Expand All @@ -34,14 +34,14 @@ Boxing and Formatting
While some work on formatting is done has been made and the change in API reflects a little of this.
However a lot more work needs to be done.

Excecution Performance
Execution Performance
----------------------

This has improved a slight bit, but not because it has been a focus, but
rather because in going over the code organization, we are doing this
less dumb, e.g. using Symbols more where symbols are intended. Or
fixing bugs like resetting mpmath numeric precision on operations that
need to chnage it temporarily.
need to change it temporarily.

Simpler Things
--------------
Expand All @@ -50,6 +50,6 @@ A number of items here remain, but should not be thought as independent items, b
"Forms, Boxing and Formatting".

"Making StandardOutput of polynomials match WMA" is really are Forms, Boxing and Formatting issue;
"Working on Jupyter integrations" is also very dependant this.
"Working on Jupyter integrations" is also very dependent this.

So the next major refactor will be on Forms, Boxing and Formatting.
2 changes: 1 addition & 1 deletion examples/symbolic_logic/gries_schneider/GS1.m
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@
right-hand side of the rule now, while parsing the rule itself, only later,
after doing the pattern substitutions specified by the rule."
Remember, evaluation is really aggressive. When you write a rule withe "->",
Remember, evaluation is really aggressive. When you write a rule with a "->",
mathics will try to evaluate the right-hand side.
Sometimes, it doesn't matter which of the two you use. In the example
Expand Down
4 changes: 2 additions & 2 deletions examples/symbolic_logic/gries_schneider/GS2.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<< "../../test_driver.m"

(* Chaper 2, Boolean Expressions, page 25
(* Chapter 2, Boolean Expressions, page 25
Section 2.1, Syntax and evaluation of Boolean expression, page 25
___ _ ___ _
Expand Down Expand Up @@ -110,7 +110,7 @@ target f(a). The number of different ways to assign ||B|| values to ||A||
there are 2 ** 4 == sixteen different binary functions.
I start with inert "true" and "false" to avoid evaluation leaks, i.e., to
prevent mathics from reducing expessions that have active "True" and
prevent mathics from reducing expressions that have active "True" and
"False".
*************************************************************************** *)
Expand Down
2 changes: 1 addition & 1 deletion examples/symbolic_logic/gries_schneider/GS3.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*************************************************************************** *)

(* Chaper 3, Propositional Calculus, page 41 **********************************
(* Chapter 3, Propositional Calculus, page 41 **********************************
___ _ _ _ _
| _ \_ _ ___ _ __ ___ __(_) |_(_)___ _ _ __ _| |
| _/ '_/ _ \ '_ \/ _ (_-< | _| / _ \ ' \/ _` | |
Expand Down
4 changes: 2 additions & 2 deletions mathics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# version_info contains a list of Python packages
# and the versions infsalled or "Not installed"
# if the package is not installed and "No version information"
# if we can't get version infomation.
# if we can't get version information.
version_info: Dict[str, str] = {
"mathics": __version__,
"mpmath": mpmath.__version__,
Expand Down Expand Up @@ -58,7 +58,7 @@


license_string = """\
Copyright (C) 2011-2023 The Mathics Team.
Copyright (C) 2011-2024 The Mathics Team.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
Expand Down
6 changes: 3 additions & 3 deletions mathics/builtin/arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class Conjugate(MPMathFunction):
"""
<url>:Complex Conjugate:
https://en.wikipedia.org/wiki/Complex_conjugate</url> \
(<url>:WMA:https://reference.wolfram.com/language/ref/Conjugate.html</url>)
<url>:WMA link:https://reference.wolfram.com/language/ref/Conjugate.html</url>
<dl>
<dt>'Conjugate[$z$]'
Expand Down Expand Up @@ -507,7 +507,7 @@ def eval_directed_infinity(self, direction, evaluation: Evaluation):
else:
normalized_direction = direction / Abs(direction)
elif isinstance(ndir, Complex):
re, im = ndir.value
re, im = ndir.real, ndir.imag
if abs(re.value**2 + im.value**2 - 1.0) < 1.0e-9:
normalized_direction = direction
else:
Expand Down Expand Up @@ -539,7 +539,7 @@ def to_sympy(self, expr, **kwargs):
class Element(Builtin):
"""
<url>:Element of:https://en.wikipedia.org/wiki/Element_(mathematics)</url> \
(<url>:WMA:https://reference.wolfram.com/language/ref/Element.html</url>)
<url>:WMA link:https://reference.wolfram.com/language/ref/Element.html</url>
<dl>
<dt>'Element[$expr$, $domain$]'
Expand Down
4 changes: 2 additions & 2 deletions mathics/builtin/assignments/upvalues.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
UpValue-related assignments
An <i>UpValue<i> is a definition associated with a symbols that does not appear directly its head.
An <i>UpValue</i> is a definition associated with a symbols that does not appear directly its head.
See <url>
:Associating Definitions with Different Symbols:
Expand All @@ -17,7 +17,7 @@
# In Mathematica 5, this appears under "Types of Values".
class UpValues(Builtin):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/UpValues.html</url>
<url>:WMA link: https://reference.wolfram.com/language/ref/UpValues.html</url>
<dl>
<dt>'UpValues[$symbol$]'
<dd>gives the list of transformation rules corresponding to upvalues \
Expand Down
8 changes: 5 additions & 3 deletions mathics/builtin/atomic/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class Accuracy(Builtin):
<dd>examines the number of significant digits of $expr$ after the \
decimal point in the number x.
</dl>
<i>Notice that the result could be slightly different than the obtained \
in WMA, due to differencs in the internal representation of the real numbers.</i>
Expand Down Expand Up @@ -760,14 +761,15 @@ class Precision(Builtin):
"""
<url>
:Precision:
https://en.wikipedia.org/wiki/Accuracy_and_precision</url> (<url>
:WMA:
https://reference.wolfram.com/language/ref/Precision.html</url>)
https://en.wikipedia.org/wiki/Accuracy_and_precision</url> <url>
:WMA link:
https://reference.wolfram.com/language/ref/Precision.html</url>
<dl>
<dt>'Precision[$expr$]'
<dd>examines the number of significant digits of $expr$.
</dl>
<i>Note that the result could be slightly different than the obtained \
in WMA, due to differencs in the internal representation of the real numbers.</i>
Expand Down
31 changes: 20 additions & 11 deletions mathics/builtin/atomic/symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def _get_usage_string(symbol, evaluation, is_long_form: bool, htmlout=False):

class Context(Builtin):
r"""
<url>:WMA: https://reference.wolfram.com/language/ref/Context.html</url>
<url>:WMA link:
https://reference.wolfram.com/language/ref/Context.html</url>
<dl>
<dt>'Context[$symbol$]'
<dd>yields the name of the context where $symbol$ is defined in.
Expand Down Expand Up @@ -133,7 +134,8 @@ def eval(self, symbol, evaluation):

class Definition(Builtin):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/Definition.html</url>
<url>:WMA link:
https://reference.wolfram.com/language/ref/Definition.html</url>
<dl>
<dt>'Definition[$symbol$]'
<dd>prints as the definitions given for $symbol$.
Expand Down Expand Up @@ -352,14 +354,14 @@ def format_definition_input(self, symbol, evaluation):
# In Mathematica 5, this appears under "Types of Values".
class DownValues(Builtin):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/DownValues.html</url>
<url>:WMA link: https://reference.wolfram.com/language/ref/DownValues.html</url>
<dl>
<dt>'DownValues[$symbol$]'
<dd>gives the list of downvalues associated with $symbol$.
</dl>
'DownValues' uses 'HoldPattern' and 'RuleDelayed' to protect the \
downvalues from being evaluated. Moreover, it has attribute \
downvalues from being evaluated, and it has attribute \
'HoldAll' to get the specified symbol instead of its value.
>> f[x_] := x ^ 2
Expand Down Expand Up @@ -408,7 +410,8 @@ def eval(self, symbol, evaluation):

class Information(PrefixOperator):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/Information.html</url>
<url>:WMA link:
https://reference.wolfram.com/language/ref/Information.html</url>
<dl>
<dt>'Information[$symbol$]'
<dd>Prints information about a $symbol$
Expand Down Expand Up @@ -562,7 +565,8 @@ def format_definition_input(self, symbol, evaluation: Evaluation, options: dict)

class Names(Builtin):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/Names.html</url>
<url>:WMA link:
https://reference.wolfram.com/language/ref/Names.html</url>
<dl>
<dt>'Names["$pattern$"]'
<dd>returns the list of names matching $pattern$.
Expand Down Expand Up @@ -614,7 +618,8 @@ def eval(self, pattern, evaluation):
# In Mathematica 5, this appears under "Types of Values".
class OwnValues(Builtin):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/OwnValues.html</url>
<url>:WMA link:
https://reference.wolfram.com/language/ref/OwnValues.html</url>
<dl>
<dt>'OwnValues[$symbol$]'
<dd>gives the list of ownvalue associated with $symbol$.
Expand Down Expand Up @@ -647,7 +652,8 @@ def eval(self, symbol, evaluation):

class Symbol_(Builtin):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/Symbol.html</url>
<url>:WMA link:
https://reference.wolfram.com/language/ref/Symbol.html</url>
<dl>
<dt>'Symbol'
<dd>is the head of symbols.
Expand Down Expand Up @@ -686,7 +692,8 @@ def eval(self, string, evaluation):

class SymbolName(Builtin):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/SymbolName.html</url>
<url>:WMA link:
https://reference.wolfram.com/language/ref/SymbolName.html</url>
<dl>
<dt>'SymbolName[$s$]'
<dd>returns the name of the symbol $s$ (without any leading \
Expand All @@ -709,7 +716,8 @@ def eval(self, symbol, evaluation):

class SymbolQ(Test):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/SymbolName.html</url>
<url>:WMA link:
https://reference.wolfram.com/language/ref/SymbolName.html</url>
<dl>
<dt>'SymbolQ[$x$]'
<dd>is 'True' if $x$ is a symbol, or 'False' otherwise.
Expand All @@ -731,7 +739,8 @@ def test(self, expr) -> bool:

class ValueQ(Builtin):
"""
<url>:WMA: https://reference.wolfram.com/language/ref/ValueQ.html</url>
<url>:WMA link:
https://reference.wolfram.com/language/ref/ValueQ.html</url>
<dl>
<dt>'ValueQ[$expr$]'
<dd>returns 'True' if and only if $expr$ is defined.
Expand Down
4 changes: 2 additions & 2 deletions mathics/builtin/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
specify general properties of functions and symbols. This is \
independent of the parameters they take and the values they produce.
The builtin-attributes having a predefined meaning in \Mathics which \
The builtin-attributes having a predefined meaning in \\Mathics which \
are described below.
However in contrast to \Mathematica, you can set any symbol as an attribute.
However in contrast to \\Mathematica, you can set any symbol as an attribute.
"""

# This tells documentation how to sort this module
Expand Down
2 changes: 1 addition & 1 deletion mathics/builtin/box/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
Boxing modules.
Boxes are added in formatting \Mathics Expressions.
Expand Down
2 changes: 1 addition & 1 deletion mathics/builtin/colors/color_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def eval(self, input, colorspace, evaluation: Evaluation):
class ColorNegate(Builtin):
"""
Color Inversion (<url>
:WMA:
:WMA link:
https://reference.wolfram.com/language/ref/ColorNegate.html</url>)
<dl>
Expand Down
10 changes: 5 additions & 5 deletions mathics/builtin/files_io/importexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"""
Importing and Exporting
Many kinds data formats can be read into \Mathics. Variable <url>
Many kinds data formats can be read into \\Mathics. Variable <url>
:$ExportFormats:
/doc/reference-of-built-in-symbols/importing-and-exporting/$exportformats</url> \
/doc/reference-of-built-in-symbols/inputoutput-files-and-filesystem/importing-and-exporting/$exportformats</url> \
contains a list of file formats that are supported by <url>
:Export:
/doc/reference-of-built-in-symbols/importing-and-exporting/export</url>, \
/doc/reference-of-built-in-symbols/inputoutput-files-and-filesystem/importing-and-exporting/export</url>, \
while <url>
:$ImportFormats:
/doc/reference-of-built-in-symbols/importing-and-exporting/$importformats</url> \
/doc/reference-of-built-in-symbols/inputoutput-files-and-filesystem/importing-and-exporting/$importformats</url> \
does the corresponding thing for <url>
:Import:
/doc/reference-of-built-in-symbols/importing-and-exporting/import</url>.
/doc/reference-of-built-in-symbols/inputoutput-files-and-filesystem/importing-and-exporting/import</url>.
"""

import base64
Expand Down
Loading

0 comments on commit 5840467

Please sign in to comment.