Skip to content

Commit a4d342f

Browse files
author
rb@dustyfeet.conf
committed
Go over Pi doc to make clearer numeric precision and numpy methdod
1 parent 871d77c commit a4d342f

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

mathics/builtin/numbers/constants.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ class Khinchin(MPMathConstant):
457457

458458

459459
class Pi(MPMathConstant, SympyConstant):
460-
"""
460+
u"""
461461
<dl>
462462
<dt>'Pi'</dt>
463463
<dd>is the constant \u03c0.
@@ -466,19 +466,18 @@ class Pi(MPMathConstant, SympyConstant):
466466
>> N[Pi]
467467
= 3.14159
468468
469-
Force using the value given from numpy to compute Pi.
470-
>> N[Pi, Method->"numpy"]
471-
= 3.14159
469+
Pi to a numeric precision of 20 digits:
470+
>> N[Pi, 20]
471+
= 3.1415926535897932385
472+
473+
Note that the above is not the same thing as the number of digits <i>after</i> the decimal point. This may differ from similar concepts from other mathematical libraries, including those which Mathics uses!
472474
473-
Force using the value given from sympy to compute Pi to 3 places,
474-
two places after the decimal point.
475+
Use numpy to compute Pi to 20 digits:
476+
>> N[Pi, 20, Method->"numpy"]
477+
= 3.1415...
475478
476-
Note that sympy is the default method.
477-
>> N[Pi, 3, Method->"sympy"]
478-
= 3.14
479+
"sympy" is the default method.
479480
480-
>> N[Pi, 50]
481-
= 3.1415926535897932384626433832795028841971693993751
482481
>> Attributes[Pi]
483482
= {Constant, Protected, ReadProtected}
484483
"""

0 commit comments

Comments
 (0)