Skip to content

Commit e9aa048

Browse files
committed
Go over summaries
1 parent 5a044f8 commit e9aa048

File tree

9 files changed

+58
-60
lines changed

9 files changed

+58
-60
lines changed

mathics/builtin/arithfns/basic.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class CubeRoot(Builtin):
9494
),
9595
}
9696

97-
summary_text = "cube root"
97+
summary_text = "compute cube root of a number"
9898

9999
def eval(self, n, evaluation):
100100
"CubeRoot[n_Complex]"
@@ -166,7 +166,7 @@ class Divide(InfixOperator):
166166
),
167167
}
168168

169-
summary_text = "divide"
169+
summary_text = "divide a number"
170170

171171

172172
class Minus(PrefixOperator):
@@ -209,7 +209,7 @@ class Minus(PrefixOperator):
209209
"Minus[x_]": "Times[-1, x]",
210210
}
211211

212-
summary_text = "arithmetic negate"
212+
summary_text = "perform an arithmetic negation on a number"
213213

214214
def eval_int(self, x: Integer, evaluation):
215215
"Minus[x_Integer]"
@@ -277,7 +277,7 @@ class Plus(InfixOperator, SympyFunction):
277277
None: "0",
278278
}
279279

280-
summary_text = "add"
280+
summary_text = "add a number"
281281

282282
# FIXME Note this is deprecated in 1.11
283283
# Remember to up sympy doc link when this is corrected
@@ -431,7 +431,7 @@ class Power(InfixOperator, MPMathFunction):
431431
"Power[x_]": "x",
432432
}
433433

434-
summary_text = "exponentiate"
434+
summary_text = "exponentiate a number"
435435

436436
# FIXME Note this is deprecated in 1.11
437437
# Remember to up sympy doc link when this is corrected
@@ -515,7 +515,7 @@ class Sqrt(SympyFunction):
515515
),
516516
}
517517

518-
summary_text = "square root"
518+
summary_text = "take the square root of a number"
519519

520520

521521
class Subtract(InfixOperator):
@@ -548,7 +548,7 @@ class Subtract(InfixOperator):
548548
"Subtract[x_, y_]": "Plus[x, Times[-1, y]]",
549549
}
550550

551-
summary_text = "subtract"
551+
summary_text = "subtract from a number"
552552

553553

554554
class Times(InfixOperator, SympyFunction):
@@ -614,7 +614,7 @@ class Times(InfixOperator, SympyFunction):
614614
# Remember to up sympy doc link when this is corrected
615615
sympy_name = "Mul"
616616

617-
summary_text = "multiply"
617+
summary_text = "multiply a number"
618618

619619
def format_times(self, items, evaluation, op="\u2062"):
620620
"Times[items__]"

mathics/builtin/assignments/assign_binaryop.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class AddTo(InfixOperator, InplaceInfixOperator):
6464

6565
operator_symbol = SymbolPlus
6666
return_before_value: bool = True
67-
summary_text = "add a value and assigns that returning the new value"
67+
summary_text = "add a value and update; return the updated value"
6868

6969
def eval(self, expr, increment, evaluation: Evaluation):
7070
"""%(name)s[expr_, increment_]"""
@@ -123,7 +123,7 @@ class Decrement(InplaceInfixOperator, InfixOperator, PostfixOperator):
123123

124124
returns_updated_value = False
125125
summary_text = (
126-
"decreases the value by one and assigns that returning the original value"
126+
"decreases a value by one and assign the value; return the original value"
127127
)
128128

129129

@@ -150,7 +150,7 @@ class DivideBy(InplaceInfixOperator, InfixOperator):
150150
rules = {
151151
"x_ /= dx_": "x = x / dx",
152152
}
153-
summary_text = "divide a value and assigns that returning the new value"
153+
summary_text = "divide by a value and update; return the new value"
154154

155155

156156
class Increment(InplaceInfixOperator, InfixOperator, PostfixOperator):
@@ -206,9 +206,7 @@ class Increment(InplaceInfixOperator, InfixOperator, PostfixOperator):
206206
increment_symbol = Integer1
207207
operator_symbol = SymbolPlus
208208
returns_updated_value: bool = False
209-
summary_text = (
210-
"increases the value by one and assigns that returning the original value"
211-
)
209+
summary_text = "increases the value by one and update; return the original value"
212210

213211

214212
class PreDecrement(InplaceInfixOperator, PrefixOperator):
@@ -243,7 +241,7 @@ class PreDecrement(InplaceInfixOperator, PrefixOperator):
243241
increment_symbol = IntegerM1
244242
operator_symbol = SymbolPlus
245243
returns_updated_value: bool = True
246-
summary_text = "decrease the value by one and assigns that returning the new value"
244+
summary_text = "decrease the value by one and update; return the new value"
247245

248246

249247
class PreIncrement(InplaceInfixOperator, PrefixOperator):
@@ -296,7 +294,7 @@ class PreIncrement(InplaceInfixOperator, PrefixOperator):
296294
operator_symbol = SymbolPlus
297295
return_before_value: bool = False
298296

299-
summary_text = "increase the value by one and assigns that returning the new value"
297+
summary_text = "increase the value by one and updage; return the new value"
300298

301299

302300
class SubtractFrom(InfixOperator):
@@ -325,7 +323,7 @@ class SubtractFrom(InfixOperator):
325323
rules = {
326324
"x_ -= dx_": "x = x - dx",
327325
}
328-
summary_text = "subtract a value and assins that returning the new value"
326+
summary_text = "subtract a value and update; return the new value"
329327

330328

331329
class TimesBy(InfixOperator):
@@ -353,4 +351,4 @@ class TimesBy(InfixOperator):
353351
rules = {
354352
"x_ *= dx_": "x = x * dx",
355353
}
356-
summary_text = "multiply a value and assigns that returning the new value"
354+
summary_text = "multiply a value and update; return the new value"

mathics/builtin/directories/system_directories.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class RootDirectory(Predefined):
8989
"""
9090

9191
name = "$RootDirectory"
92-
summary_text = "system root directory"
92+
summary_text = "get system root directory"
9393

9494
def evaluate(self, evaluation):
9595
return String(SYS_ROOT_DIR)

mathics/builtin/files_io/filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class AbsoluteFileName(Builtin):
6060
"fstr": ("File specification x is not a string of one or more characters."),
6161
"nffil": "File not found during `1`.",
6262
}
63-
summary_text = "absolute path"
63+
summary_text = "get absolute file path"
6464

6565
def eval(self, name, evaluation):
6666
"AbsoluteFileName[name_]"

mathics/builtin/list/associations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Association(Builtin):
5252

5353
attributes = A_HOLD_ALL_COMPLETE | A_PROTECTED
5454

55-
summary_text = "an association between keys and values"
55+
summary_text = "make an association between keys and values"
5656

5757
def eval_makeboxes(self, rules, f, evaluation: Evaluation):
5858
"""MakeBoxes[<|rules___|>,

mathics/builtin/numbers/calculus.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,7 @@ class FindRoot(_BaseFinder):
902902
}
903903
messages = _BaseFinder.messages.copy()
904904
methods = {}
905-
summary_text = (
906-
"Looks for a root of an equation or a zero of a numerical expression."
907-
)
905+
summary_text = "look for a root of an equation or a zero of a numerical expression."
908906

909907
try:
910908
from mathics.eval.numbers.calculus.optimizers import (
@@ -1642,7 +1640,7 @@ class Root(SympyFunction):
16421640
"iidx": "Argument `1` at position 2 is out of bounds",
16431641
}
16441642

1645-
summary_text = "the i-th root of a polynomial."
1643+
summary_text = "compute the i-th root of a polynomial."
16461644
sympy_name = "CRootOf"
16471645

16481646
def eval(self, f, i, evaluation: Evaluation):
@@ -1699,29 +1697,31 @@ def to_sympy(self, expr, **kwargs):
16991697

17001698
class RootSum(SympyFunction):
17011699
"""
1702-
<url>:WMA link: https://reference.wolfram.com/language/ref/RootSum.html</url>
1703-
1704-
<dl>
1705-
<dt>'RootSum[$f$, $form$]'
1706-
<dd>sums $form$[$x$] for all roots of the polynomial $f$[$x$].
1707-
</dl>
1708-
1709-
>> Integrate[1/(x^5 + 11 x + 1), {x, 1, 3}]
1710-
= RootSum[-1 - 212960 #1 ^ 3 - 9680 #1 ^ 2 - 165 #1 + 41232181 #1 ^ 5&, (Log[3749971 - 3512322106304 #1 ^ 4 + 453522741 #1 + 16326568676 #1 ^ 2 + 79825502416 #1 ^ 3] - 4 Log[5]) #1&] - RootSum[-1 - 212960 #1 ^ 3 - 9680 #1 ^ 2 - 165 #1 + 41232181 #1 ^ 5&, (Log[3748721 - 3512322106304 #1 ^ 4 + 453522741 #1 + 16326568676 #1 ^ 2 + 79825502416 #1 ^ 3] - 4 Log[5]) #1&]
1711-
>> N[%, 50]
1712-
= 0.051278805184286949884270940103072421286139857550894
1713-
1714-
>> RootSum[#^5 - 11 # + 1 &, (#^2 - 1)/(#^3 - 2 # + c) &]
1715-
= (538 - 88 c + 396 c ^ 2 + 5 c ^ 3 - 5 c ^ 4) / (97 - 529 c - 53 c ^ 2 + 88 c ^ 3 + c ^ 5)
1716-
1717-
>> RootSum[#^5 - 3 # - 7 &, Sin] //N//Chop
1718-
= 0.292188
1719-
1720-
Use 'Normal' to expand 'RootSum':
1721-
>> RootSum[1+#+#^2+#^3+#^4 &, Log[x + #] &]
1722-
= RootSum[1 + #1 ^ 2 + #1 ^ 3 + #1 ^ 4 + #1&, Log[x + #1]&]
1723-
>> %//Normal
1724-
= Log[-1 / 4 - Sqrt[5] / 4 - I Sqrt[5 / 8 - Sqrt[5] / 8] + x] + Log[-1 / 4 - Sqrt[5] / 4 + I Sqrt[5 / 8 - Sqrt[5] / 8] + x] + Log[-1 / 4 - I Sqrt[5 / 8 + Sqrt[5] / 8] + Sqrt[5] / 4 + x] + Log[-1 / 4 + I Sqrt[5 / 8 + Sqrt[5] / 8] + Sqrt[5] / 4 + x]
1700+
<url>:WMA link: https://reference.wolfram.com/language/ref/RootSum.html</url>
1701+
1702+
<dl>
1703+
<dt>'RootSum[$f$, $form$]'
1704+
<dd>sums $form$[$x$] for all roots of the polynomial $f$[$x$].
1705+
</dl>
1706+
1707+
Integrating a rational function of any order:
1708+
>> Integrate[1/(x^5 + 11 x + 1), {x, 1, 3}]
1709+
= RootSum[-1 - 212960 #1 ^ 3 - 9680 #1 ^ 2 - 165 #1 + 41232181 #1 ^ 5&, (Log[3749971 - 3512322106304 #1 ^ 4 + 453522741 #1 + 16326568676 #1 ^ 2 + 79825502416 #1 ^ 3] - 4 Log[5]) #1&] - RootSum[-1 - 212960 #1 ^ 3 - 9680 #1 ^ 2 - 165 #1 + 41232181 #1 ^ 5&, (Log[3748721 - 3512322106304 #1 ^ 4 + 453522741 #1 + 16326568676 #1 ^ 2 + 79825502416 #1 ^ 3] - 4 Log[5]) #1&]
1710+
>> N[%, 50]
1711+
= 0.051278805184286949884270940103072421286139857550894
1712+
1713+
Simplification of 'RootSum' expression
1714+
>> RootSum[#^5 - 11 # + 1 &, (#^2 - 1)/(#^3 - 2 # + c) &]
1715+
= (538 - 88 c + 396 c ^ 2 + 5 c ^ 3 - 5 c ^ 4) / (97 - 529 c - 53 c ^ 2 + 88 c ^ 3 + c ^ 5)
1716+
1717+
>> RootSum[#^5 - 3 # - 7 &, Sin] //N//Chop
1718+
= 0.292188
1719+
1720+
Use 'Normal' to expand 'RootSum':
1721+
>> RootSum[1+#+#^2+#^3+#^4 &, Log[x + #] &]
1722+
= RootSum[1 + #1 ^ 2 + #1 ^ 3 + #1 ^ 4 + #1&, Log[x + #1]&]
1723+
>> %//Normal
1724+
= Log[-1 / 4 - Sqrt[5] / 4 - I Sqrt[5 / 8 - Sqrt[5] / 8] + x] + Log[-1 / 4 - Sqrt[5] / 4 + I Sqrt[5 / 8 - Sqrt[5] / 8] + x] + Log[-1 / 4 - I Sqrt[5 / 8 + Sqrt[5] / 8] + Sqrt[5] / 4 + x] + Log[-1 / 4 + I Sqrt[5 / 8 + Sqrt[5] / 8] + Sqrt[5] / 4 + x]
17251725
"""
17261726

17271727
summary_text = "sum polynomial roots"

mathics/builtin/numbers/integer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,12 @@ class FromDigits(Builtin):
227227
228228
<dl>
229229
<dt>'FromDigits[$l$]'
230-
<dd>returns the integer corresponding to the decimal representation given by $l$. $l$ can be a list of
231-
digits or a string.
230+
<dd>returns the integer corresponding to the decimal representation given by $l$. $l$ can \
231+
be a list of digits or a string.
232+
232233
<dt>'FromDigits[$l$, $b$]'
233-
<dd>returns the integer corresponding to the base $b$ representation given by $l$. $l$ can be a list of
234-
digits or a string.
234+
<dd>returns the integer corresponding to the base $b$ representation given by $l$. $l$ can \
235+
be a list of digits or a string.
235236
</dl>
236237
237238
>> FromDigits["123"]
@@ -258,10 +259,9 @@ class FromDigits(Builtin):
258259
= 0
259260
"""
260261

261-
summary_text = "integer from a list of digits"
262-
rules = {"FromDigits[l_]": "FromDigits[l, 10]"}
263-
264262
messages = {"nlst": "The input must be a string of digits or a list."}
263+
rules = {"FromDigits[l_]": "FromDigits[l, 10]"}
264+
summary_text = "get integer from a list of digits"
265265

266266
@staticmethod
267267
def _parse_string(s, b):

mathics/builtin/numeric.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class Abs(MPMathFunction):
114114
rules = {
115115
"Abs[Undefined]": "Undefined",
116116
}
117-
summary_text = "absolute value of a number"
117+
summary_text = "get absolute value of a number"
118118
sympy_name = "Abs"
119119

120120
def eval(self, x, evaluation: Evaluation):
@@ -578,7 +578,7 @@ class RealAbs(Builtin):
578578
"Integrate[RealAbs[x_],x_]": "1/2 x RealAbs[x]",
579579
"Integrate[RealAbs[u_],{u_,a_,b_}]": "1/2 b RealAbs[b]-1/2 a RealAbs[a]",
580580
}
581-
summary_text = "real absolute value"
581+
summary_text = "get absolute value of a real number"
582582

583583
def eval(self, x: Number, evaluation: Evaluation):
584584
"""RealAbs[x_]"""

mathics/builtin/system.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ class Machine(Predefined):
229229
= ...
230230
"""
231231

232-
summary_text = "the type of computer system over with Mathics is running"
233232
name = "$Machine"
233+
summary_text = "get the OS platform of the system running Mathics3"
234234

235235
def evaluate(self, evaluation: Evaluation) -> String:
236236
return String(sys.platform)
@@ -428,8 +428,8 @@ class ParentProcessID(Predefined):
428428
429429
"""
430430

431-
summary_text = "id of the process that invoked Mathics"
432431
name = "$ParentProcessID"
432+
summary_text = "get process id of the process that invoked Mathics3"
433433

434434
def evaluate(self, evaluation: Evaluation) -> Integer:
435435
return Integer(os.getppid())
@@ -449,8 +449,8 @@ class ProcessID(Predefined):
449449
= ...
450450
"""
451451

452-
summary_text = "id of the Mathics process"
453452
name = "$ProcessID"
453+
summary_text = "get process id of the Mathics process"
454454

455455
def evaluate(self, evaluation: Evaluation) -> Integer:
456456
return Integer(os.getpid())

0 commit comments

Comments
 (0)