Skip to content

Commit

Permalink
Another pass over the latex/mathml doc tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Feb 3, 2025
1 parent aa326a4 commit a9672e2
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 29 deletions.
20 changes: 10 additions & 10 deletions mathics/builtin/atomic/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Accuracy(Builtin):
Notice that the value is not exactly equal to the obtained in WMA: \
This is due to the different way in which 'Precision' is handled in SymPy.
Accuracy for exact atoms is $Infinity$:
Accuracy for exact atoms is 'Infinity':
>> Accuracy[1]
= Infinity
>> Accuracy[A]
Expand Down Expand Up @@ -170,7 +170,7 @@ class IntegerExponent(Builtin):
"IntegerExponent[n_]": "IntegerExponent[n, 10]",
}

summary_text = "number of trailing 0s in a given base"
summary_text = "get number of trailing 0s in a given base"

def eval_two_arg_integers(self, n: Integer, b: Integer, evaluation: Evaluation):
"""IntegerExponent[n_Integer, b_Integer]"""
Expand Down Expand Up @@ -257,7 +257,7 @@ class IntegerLength(Builtin):
"IntegerLength[n_]": "IntegerLength[n, 10]",
}

summary_text = "total number of digits in any base"
summary_text = "get total number of digits in any base"

def eval(self, n, b, evaluation):
"""IntegerLength[n_, b_]"""
Expand Down Expand Up @@ -340,18 +340,18 @@ class RealDigits(Builtin):
<dl>
<dt>'RealDigits'[$n$]
<dd>returns the decimal representation of the real number $n$ as list \
<dd>returns the decimal representation for the real number $n$ as list \
of digits, together with the number of digits that are to the left of \
the decimal point.
<dt>'RealDigits'[$n$, $b$]
<dd>returns a list of base_$b$ representation of the real number $n$.
<dd>returns a list of the "digits" in base-b representation for the real number $n$.
<dt>'RealDigits'[$n$, $b$, $len$]
<dd>returns a list of $len$ digits.
<dt>'RealDigits'[$n$, $b$, $len$, $p$]
<dd>return $len$ digits starting with the coefficient of $b$^$p$
<dd>return $len$ digits starting with the coefficient of $b^p$.
</dl>
Return the list of digits and exponent:
Expand Down Expand Up @@ -391,7 +391,7 @@ class RealDigits(Builtin):
"intm": "Machine-sized integer expected at position 4 in `1`.",
}

summary_text = "digits of a real number"
summary_text = "get digits of a real number"

def eval_complex(self, n, var, evaluation):
"%(name)s[n_Complex, var___]"
Expand Down Expand Up @@ -611,7 +611,7 @@ class MaxPrecision(Predefined):
"$MaxPrecision": "Infinity",
}

summary_text = "settable global maximum precision bound"
summary_text = "settable global maximum precision bound variable"


class MachineEpsilon_(Predefined):
Expand All @@ -636,7 +636,7 @@ class MachineEpsilon_(Predefined):
_is_numeric = True
name = "$MachineEpsilon"

summary_text = "the difference between 1.0 and the next-nearest number representable as a machine-precision number"
summary_text = "get the difference between 1.0 and the next-nearest number representable as a machine-precision number"

def evaluate(self, evaluation):
return MachineReal(MACHINE_EPSILON)
Expand All @@ -658,7 +658,7 @@ class MachinePrecision_(Predefined):
name = "$MachinePrecision"

summary_text = (
"the number of decimal digits of precision for machine-precision numbers"
"get the number of decimal digits of precision for machine-precision numbers"
)
_is_numeric = True
rules = {
Expand Down
4 changes: 2 additions & 2 deletions mathics/builtin/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Definition Attributes
While a definition like 'cube[$x_$] = $x$^3' gives a way to specify \
While a definition like 'cube[x_] = x^3' gives a way to specify \
<em>values</em> of a function, <em>attributes</em> allow a way to \
specify general properties of functions and symbols. This is \
independent of the parameters they take and the values they produce.
Expand Down Expand Up @@ -443,7 +443,7 @@ class OneIdentity(Predefined):
<dl>
<dt>'OneIdentity'
<dd>is an attribute assigned to a symbol, say $f$, indicating that '$f$[$x$]', $f$[$f$[$x$]], etc. are all \
<dd>is an attribute assigned to a symbol, say $f$, indicating that $f[x]$, $f[f[x]]$, etc. are all \
equivalent to $x$ in pattern matching.
</dl>
Expand Down
4 changes: 2 additions & 2 deletions mathics/builtin/datentime.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ class TimeConstrained(Builtin):
evaluation, the function will return '$Aborted' and the results will not affect
the state of the Mathics3 kernel.
## >> TimeConstrained[Pause[5]; a, 1]
## = $Aborted
Expand Down Expand Up @@ -1276,7 +1276,7 @@ class TimeRemaining(Builtin):
<dd>returns $failexpr$ if the time constraint is not met.
</dl>
If TimeConstrained is called out of a TimeConstrained expression, returns `Infinity`
If TimeConstrained is called out of a TimeConstrained expression, returns 'Infinity':
>> TimeRemaining[]
= Infinity
Expand Down
4 changes: 2 additions & 2 deletions mathics/builtin/distance/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BrayCurtisDistance(Builtin):
<dd>returns the Bray-Curtis distance between $u$ and $v$.
</dl>
The Bray-Curtis distance is equivalent to Total[Abs[u-v]]/Total[Abs[u+v]].
The Bray-Curtis distance is equivalent to 'Total[Abs[u-v]]/Total[Abs[u+v]]'.
>> BrayCurtisDistance[-7, 5]
= 6
Expand Down Expand Up @@ -154,7 +154,7 @@ class CosineDistance(Builtin):
<dd>returns the angular cosine distance between vectors $u$ and $v$.
</dl>
The cosine distance is equivalent to 1 - ($u$.Conjugate[$v$]) / ('Norm[$u$] Norm[$v$]').
The cosine distance is equivalent to $1 - (u.Conjugate[v]) / (Norm[u] Norm[v])$.
>> N[CosineDistance[{7, 9}, {71, 89}]]
= 0.0000759646
Expand Down
6 changes: 3 additions & 3 deletions mathics/builtin/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ class Disk(Builtin):
<dl>
<dt>'Disk'[{$c_x$, $c_y$}, $r$]
<dd>fills a circle with center '($c_x$, $c_y$)' and radius $r$.
<dd>fills a circle with center ($c_x$, $c_y$) and radius $r$.
<dt>'Disk'[{$c_x$, $c_y$}, {$r_x$, $r_y$}]
<dd>fills an ellipse.
Expand All @@ -1294,7 +1294,7 @@ class Disk(Builtin):
<dd>chooses radius 1.
<dt>'Disk[]'
<dd>chooses center '(0, 0)' and radius 1.
<dd>chooses center $(0, 0)$' and radius 1.
<dt>'Disk'[{$x$, $y$}, ..., {$t_1$, $t_2$}]
<dd>is a sector from angle $t_1$ to $t_2$.
Expand Down Expand Up @@ -1483,7 +1483,7 @@ class Text(Inset):
<dl>
<dt>'Text'["$text$", {$x$, $y$}]
<dd>draws $text$ centered on position '{$x$, $y$}'.
<dd>draws $text$ centered on position {$x$, $y$}.
</dl>
>> Graphics[{Text["First", {0, 0}], Text["Second", {1, 1}]}, Axes->True, PlotRange->{{-2, 2}, {-2, 2}}]
Expand Down
23 changes: 13 additions & 10 deletions mathics/builtin/statistics/orderstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,16 @@ class Quantile(Builtin):
<dt>'Quantile'[$list$, $q$]
<dd>returns the $q$th quantile of $list$.
<dt>'Quantile'[$list$, $q$, {{$a$,$b$}, {$c$,$d$}}]
<dt>'Quantile'[$list$, $q$, {{$a,b$}, {$c,d$}}]
<dd>uses the quantile definition specified by parameters $a$, $b$, $c$, $d$.
<dt>For a list of length $n$:
'Quantile[$list$, $q$, {{$a$,$b$}, {$c$,$d$}}]'
depends on $x$=$a$+($n$+$b$)$q$.
For a list of length $n$, 'Quantile'[$list$, $q$, {{$a ,b$}, {$c, d$}}] depends \
on $x=a+(n+b)q$.
If $x$ is an integer, the result is '$s$[[$x$]]', where $s$='Sort[list,Less]'.
If $x$ is an integer, the result is $s[[x]]$, where $s$='Sort[list,Less]'.
Otherwise, the result is:
's[[Floor[x]]]+(s[[Ceiling[x]]]-s[[Floor[x]]])(c+dFractionalPart[x])',
's[[Floor[x]]] + (s[[Ceiling[x]]] - s[[Floor[x]]])(c + d FractionalPart[x])',
with the indices taken to be 1 or n if they are out of range.
The default choice of parameters is '{{0,0},{1,0}}'.
Expand Down Expand Up @@ -378,15 +377,16 @@ class TakeLargest(_RankedTakeLargest):
<dd>returns the a sorted list of the $n$ largest items in $list$.
</dl>
List the largest two numbers of a list:
>> TakeLargest[{100, -1, 50, 10}, 2]
= {100, 50}
None, Null, Indeterminate and expressions with head Missing are ignored
None, Null, Indeterminate and expressions with head Missing are ignored \
by default:
>> TakeLargest[{-8, 150, Missing[abc]}, 2]
= {150, -8}
You may specify which items are ignored using the option ExcludedForms:
You may specify which items are ignored using the option 'ExcludedForms':
>> TakeLargest[{-8, 150, Missing[abc]}, 2, ExcludedForms -> {}]
= {Missing[abc], 150}
"""
Expand All @@ -408,10 +408,13 @@ class TakeSmallest(_RankedTakeSmallest):
<dd>returns the a sorted list of the $n$ smallest items in $list$.
</dl>
For details on how to use the ExcludedForms option, see TakeLargest[].
List the smallest two numbers of a list:
>> TakeSmallest[{100, -1, 50, 10}, 2]
= {-1, 10}
For details on how to use the 'ExcludedForms' option, see <url>
:TakeLargest:
/doc/reference-of-built-in-symbols/descriptive-statistics/order-statistics/takelargest/</url>.
"""

attributes = A_PROTECTED
Expand Down

0 comments on commit a9672e2

Please sign in to comment.