Skip to content

Commit

Permalink
Merge pull request #481 from Mathics3/release-5.0.0
Browse files Browse the repository at this point in the history
Release 5.0.0
  • Loading branch information
rocky authored Jul 31, 2022
2 parents 1d23b1e + f4b8356 commit 7158986
Show file tree
Hide file tree
Showing 10 changed files with 728 additions and 654 deletions.
1,327 changes: 693 additions & 634 deletions CHANGES.rst

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions mathics/builtin/drawing/splines.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
# https://github.com/Tarheel-Formal-Methods/kaa
class BernsteinBasis(Builtin):
"""
<url>:Bernstein polynomial basis: https://en.wikipedia.org/wiki/Bernstein_polynomial</url> (<url>:SciPy: https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.BPoly.html</url> :WMA:
A Bernstein is a polynomial that is a linear combination of Bernstein basis polynomials.
With the advent of computer graphics, Bernstein polynomials, restricted to the interval [0, 1], became important in the form of Bézier curves.
'BernsteinBasis[d,n,x]' equals 'Binomial[d, n] x^n (1-x)^(d-n)' in the interval [0, 1] and zero elsewhere.
<dl>
<dt>'BernsteinBasis[$d$,$n$,$x$]'
<dd>returns the $n$th Bernstein basis of degree $d$ at $x$.
</dl>
A Bernstein polynomial <url>https://en.wikipedia.org/wiki/Bernstein_polynomial</url> is a polynomial that is a linear combination of Bernstein basis polynomials.
With the advent of computer graphics, Bernstein polynomials, restricted to the interval [0, 1], became important in the form of Bézier curves.
'BernsteinBasis[d,n,x]' equals 'Binomial[d, n] x^n (1-x)^(d-n)' in the interval [0, 1] and zero elsewhere.
>> BernsteinBasis[4, 3, 0.5]
= 0.25
"""
Expand Down
1 change: 0 additions & 1 deletion mathics/builtin/intfns/combinatorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class Binomial(_MPMathFunction):
class CatalanNumber(SympyFunction):
"""
<url>:Catalan Number: https://en.wikipedia.org/wiki/Catalan_number</url> (<url>:SymPy: https://docs.sympy.org/latest/modules/functions/combinatorial.html#sympy.functions.combinatorial.numbers.catalan</url>, <url>:WMA: https://reference.wolfram.com/language/ref/CatalanNumber.html</url>)
</ul>
<dl>
<dt>'CatalanNumber[$n$]'
Expand Down
3 changes: 1 addition & 2 deletions mathics/builtin/intfns/divlike.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ def apply(self, n: Integer, m: Integer, evaluation):

class ModularInverse(SympyFunction):
"""
Modular multiplicative inverse.
See <url>https://en.wikipedia.org/wiki/Modular_multiplicative_inverse</url>.
<url>:Modular multiplicative inverse: https://en.wikipedia.org/wiki/Modular_multiplicative_inverse</url> (<url>:SymPy: https://docs.sympy.org/latest/modules/core.html#sympy.core.numbers.mod_inverse</url>, <url>:WMA: https://reference.wolfram.com/language/ref/ModularInverse.html</url>)
<dl>
<dt>'ModularInverse[$k$, $n$]'
Expand Down
9 changes: 4 additions & 5 deletions mathics/builtin/numbers/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -1691,13 +1691,10 @@ def apply_multivariate_series(self, f, varspec, evaluation):
class SeriesData(Builtin):
"""
<dl>
<dt>'SeriesData[...]'
<dd>Represents a series expansion
<dt>'SeriesData[...]'
<dd>Represents a series expansion
</dl>
TODO:
- Implement sum, product and composition of series
Sum of two series:
>> Series[Cosh[x],{x,0,2}] + Series[Sinh[x],{x,0,3}]
= 1 + x + 1 / 2 x ^ 2 + O[x] ^ 3
Expand All @@ -1710,6 +1707,8 @@ class SeriesData(Builtin):
= -x + a x ^ 2 + O[x] ^ 3
"""

# TODO: Implement sum, product and composition of series

precedence = 1000
summary_text = "power series of a variable about a point"

Expand Down
6 changes: 5 additions & 1 deletion mathics/doc/common_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,10 +1177,14 @@ def latex(
`output` is not used here but passed along to the bottom-most
level in getting expected test results.
"""
if self.is_reference:
chapter_fn = sorted_chapters
else:
chapter_fn = lambda x: x
result = "\n\n\\part{%s}\n\n" % escape_latex(self.title) + (
"\n\n".join(
chapter.latex(doc_data, quiet, filter_sections=filter_sections)
for chapter in sorted_chapters(self.chapters)
for chapter in chapter_fn(self.chapters)
if not filter_chapters or chapter.title in filter_chapters
)
)
Expand Down
9 changes: 6 additions & 3 deletions mathics/doc/documentation/1-Manual.mdoc
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,9 @@ Here, 'N' is applied to 'x' before the actual matching, simply yielding 'x'. Wit
>> {1, 2} /. x_Integer :> N[x]
= {1., 2.}

While 'ReplaceAll' and 'ReplaceRepeated' simply take the first possible match into account, 'ReplaceList' returns a list of all possible matches. This can be used to get all subsequences of a list, for instance:
'ReplaceAll' and 'ReplaceRepeated' take the first possible match.
However 'ReplaceList' returns a list of all possible matches.
This can be used to get all subsequences of a list, for instance:

>> ReplaceList[{a, b, c}, {___, x__, ___} -> {x}]
= {{a}, {a, b}, {a, b, c}, {b}, {b, c}, {c}}
Expand Down Expand Up @@ -1162,7 +1164,8 @@ We can still see the original form by using 'InputForm':
We want to combine 'Dice' objects using the '+' operator:
>> Dice[a___] + Dice[b___] ^:= Dice[Sequence @@ {a, b}]

The '^:=' ('UpSetDelayed') tells \Mathics to associate this rule with 'Dice' instead of 'Plus', which is protected---we would have to unprotect it first:
The '^:=' ('UpSetDelayed') tells \Mathics to associate this rule with 'Dice' instead of 'Plus'.
'Plus' is protected---we would have to unprotect it first:
>> Dice[a___] + Dice[b___] := Dice[Sequence @@ {a, b}]
: Tag Plus in Dice[a___] + Dice[b___] is Protected.
= $Failed
Expand Down Expand Up @@ -1295,7 +1298,7 @@ There are some keyboard commands you can use in the Django-based Web interface o

Of special note is the last item on the list: right-click to open the MathJax menu. Under "Math Setting"/"Zoom Trigger", if the zoom trigger is set to a value other then "No Zoom", then when that trigger is applied on MathML formatted output, the MathML formula pop up a window for the formula. The window can show the formula larger. Also, this is a way to see output that is too large to fit on the display since the window allows for scrolling.

Keyboard commands behavior depends the browser used, the operating system, desktop settings, and customization. We hook into the desktop "Open the current document" and "Save the current document" functions that many desktops provide. For example see: <url>https://help.ubuntu.com/community/KeyboardShortcuts#Finding_keyboard_shortcuts</url>
Keyboard commands behavior depends the browser used, the operating system, desktop settings, and customization. We hook into the desktop "Open the current document" and "Save the current document" functions that many desktops provide. For example see: <url>:Finding keyboard shortcuts: https://help.ubuntu.com/community/KeyboardShortcuts#Finding_keyboard_shortcuts</url>

Often, these shortcut keyboard command are only recognized when a text field has focus; otherwise,the browser might do some browser-specific actions, like setting a bookmark etc.

Expand Down
2 changes: 1 addition & 1 deletion mathics/doc/tex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ all doc texdoc: mathics.pdf

#: Create internal Document Data from .mdoc and Python builtin module docstrings
doc-data $(DOC_TEX_DATA_PCL):
(cd ../.. && $(PYTHON) docpipeline.py --output --keep-going --want-sorting)
(cd ../.. && $(PYTHON) docpipeline.py --output --keep-going --want-sorting) && ./sed-hack.sh

#: Build mathics PDF
mathics.pdf: mathics.tex documentation.tex logo-text-nodrop.pdf logo-heptatom.pdf version-info.tex $(DOC_TEX_DATA_PCL)
Expand Down
11 changes: 11 additions & 0 deletions mathics/doc/tex/sed-hack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Brute force convert Unicode characters in LaTeX that it can't handle
cp documentation.tex{,-before-sed}
sed -i -e s/π/\\\\pi/ documentation.tex
sed -i -e s/“/\`\`/ documentation.tex
sed -i -e s/”/''/ documentation.tex
sed -i -e s/”/''/ documentation.tex
sed -i -e s/′/\'/ documentation.tex
sed -i -e s/μ/$\\\\mu$/ documentation.tex
sed -i -e s/–/--/ documentation.tex
sed -i -e s/Φ/$\\\\Phi$/ documentation.tex
2 changes: 1 addition & 1 deletion mathics/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# well as importing into Python. That's why there is no
# space around "=" below.
# fmt: off
__version__="5.0.0.dev0" # noqa
__version__="5.0.0" # noqa

0 comments on commit 7158986

Please sign in to comment.