Skip to content

Commit

Permalink
More grammar and doc corrections
Browse files Browse the repository at this point in the history
Squelch some some lint messages in numbers.py
  • Loading branch information
rocky committed Aug 8, 2024
1 parent a172437 commit 767e6f5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
25 changes: 12 additions & 13 deletions mathics/builtin/atomic/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

# Note: docstring is not flowed in documentation. To avoid line breaks
# in docstrings apparing in the printed output, use \ before the line
# in docstrings appearing in the printed output, use \ before the line
# break.

"""
Expand Down Expand Up @@ -90,7 +90,6 @@ def convert_repeating_decimal(numerator, denominator, base):
del tails[j]
tails.insert(0, head[i])
del head[i]
j = j - 1

# truncate all leading 0's
if all(elem == "0" for elem in head):
Expand Down Expand Up @@ -153,10 +152,10 @@ class Accuracy(Builtin):
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>
<i>Notice that the result could be slightly different from the result obtained \
in WMA, due to differences in the internal representation of the real numbers.</i>
Accuracy of a real number is estimated from its value and its precision:
'Accuracy' of a real number is estimated from its value and its precision:
>> Accuracy[3.1416`2]
= 1.50298
Expand Down Expand Up @@ -207,7 +206,7 @@ class Accuracy(Builtin):
summary_text = "find the accuracy of a number"

def eval(self, z, evaluation):
"Accuracy[z_]"
"""Accuracy[z_]"""
acc = eval_Accuracy(z)
if acc is None:
return SymbolInfinity
Expand Down Expand Up @@ -248,7 +247,7 @@ class IntegerExponent(Builtin):
summary_text = "number of trailing 0s in a given base"

def eval_two_arg_integers(self, n: Integer, b: Integer, evaluation):
"IntegerExponent[n_Integer, b_Integer]"
"""IntegerExponent[n_Integer, b_Integer]"""

py_n, py_b = n.value, b.value
py_n = abs(py_n)
Expand Down Expand Up @@ -335,7 +334,7 @@ class IntegerLength(Builtin):
summary_text = "total number of digits in any base"

def eval(self, n, b, evaluation):
"IntegerLength[n_, b_]"
"""IntegerLength[n_, b_]"""

n, b = n.get_int_value(), b.get_int_value()
if n is None or b is None:
Expand Down Expand Up @@ -471,7 +470,7 @@ def eval(self, n, evaluation):
return self.eval_with_base(n, from_python(10), evaluation)

def eval_with_base(self, n, b, evaluation, nr_elements=None, pos=None):
"%(name)s[n_?NumericQ, b_Integer]"
"""%(name)s[n_?NumericQ, b_Integer]"""

expr = Expression(SymbolRealDigits, n)
rational_no = (
Expand Down Expand Up @@ -585,7 +584,7 @@ def eval_with_base(self, n, b, evaluation, nr_elements=None, pos=None):
return ListExpression(list_expr, Integer(exp))

def eval_with_base_and_length(self, n, b, length, evaluation, pos=None):
"%(name)s[n_?NumericQ, b_Integer, length_]"
"""%(name)s[n_?NumericQ, b_Integer, length_]"""
elements = []
if pos is not None:
elements.append(from_python(pos))
Expand All @@ -599,7 +598,7 @@ def eval_with_base_and_length(self, n, b, length, evaluation, pos=None):
)

def eval_with_base_length_and_precision(self, n, b, length, p, evaluation):
"%(name)s[n_?NumericQ, b_Integer, length_, p_]"
"""%(name)s[n_?NumericQ, b_Integer, length_, p_]"""
if not isinstance(p, Integer):
evaluation.message(
"RealDigits", "intm", Expression(SymbolRealDigits, n, b, length, p)
Expand Down Expand Up @@ -773,7 +772,7 @@ class Precision(Builtin):
<i>Note that the result could be slightly different than the obtained \
in WMA, due to differences in the internal representation of the real numbers.</i>
The precision of an exact number, e.g. an Integer, is 'Infinity':
The precision of an exact number, e.g., an Integer, is 'Infinity':
>> Precision[1]
= Infinity
Expand Down Expand Up @@ -820,7 +819,7 @@ class Precision(Builtin):
summary_text = "find the precision of a number"

def eval(self, z, evaluation):
"Precision[z_]"
"""Precision[z_]"""
if isinstance(z, MachineReal):
return SymbolMachinePrecision

Expand Down
6 changes: 3 additions & 3 deletions mathics/doc/documentation/1-Manual.mdoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The programming language and built-in functions of \Mathics tries to match the \

See the <url>:installation instructions: https://mathics-development-guide.readthedocs.io/en/latest/installing/index.html</url> for the most recent instructions for installing from PyPI, or the source.

For implementation details, plrease refer to the <url>:Developers Guide:https://mathics-development-guide.readthedocs.io/en/latest/</url>.
For implementation details, please refer to the <url>:Developers Guide:https://mathics-development-guide.readthedocs.io/en/latest/</url>.

<section title="Why try to recreate Wolfram Language?">
\Mathematica is great, but it a couple of disadvantages.
Expand Down Expand Up @@ -82,7 +82,7 @@ While we always could use help, such as in Python programming, improving Documen
<ul>
<li>Ensure this document is complete and accurate. We could use help to ensure all of the Builtin functions described properly and fully, and that they have link to corresponding Wiki, Sympy, WMA and/or mpath links.
Make sure the builtin summaries and examples clear and useful.</li>
<li>We could use help in LaTeX styling, and going over this document to remove overful boxes and things of that nature. We could also use help and our use of Asymptote. The are some graphics primitives such as for polyhedra that haven't been implemented. Similar graphics options are sometimes missing in Asymptote that we have available in other graphics backends.</li>
<li>We could use help in LaTeX styling, and going over this document to remove overfull boxes and things of that nature. We could also use help and our use of Asymptote. The are some graphics primitives such as for polyhedra that haven't been implemented. Similar graphics options are sometimes missing in Asymptote that we have available in other graphics backends.</li>

<li>add another graphics backend: it could be a javascript library like jsfiddle</li>

Expand Down Expand Up @@ -226,7 +226,7 @@ The result of the previous query to \Mathics can be accessed by '%':

<section title="Precision and Accuracy">

\Mathics handles relative and absolute uncertanties in numerical quantities. The <em>precision</em> or relative accuracy, is set by adding a RawBackquote character ('`') and the number of digits of precision in the mantissa. For example:
\Mathics handles relative and absolute uncertainty in numerical quantities. The <em>precision</em> or relative accuracy, is set by adding a RawBackquote character ('`') and the number of digits of precision in the mantissa. For example:

>> 3.1416`3
= 3.14
Expand Down

0 comments on commit 767e6f5

Please sign in to comment.