Skip to content

Commit

Permalink
Pi is a Numpy constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatera committed May 26, 2023
1 parent 8e7e774 commit 7b6f650
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
5 changes: 2 additions & 3 deletions mathics/builtin/numbers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,7 @@ def evaluate(self, evaluation: Evaluation) -> MachineReal:
return NUMERICAL_CONSTANTS[self.symbol]


class Pi(_MPMathConstant, _SympyConstant):
# class Pi(_MPMathConstant, _NumpyConstant, _SympyConstant):
class Pi(_MPMathConstant, _NumpyConstant, _SympyConstant):
"""
<url>
:Pi, \u03c0: https://en.wikipedia.org/wiki/Pi</url> (<url>
Expand Down Expand Up @@ -752,7 +751,7 @@ class Underflow(Builtin):


# Constants that are not numpy constants,
for cls in (Catalan, Degree, Glaisher, GoldenRatio, Khinchin, Pi):
for cls in (Catalan, Degree, Glaisher, GoldenRatio, Khinchin):
instance = cls(expression=False)
val = instance.get_constant()
NUMERICAL_CONSTANTS[instance.symbol] = MachineReal(val.value)
2 changes: 1 addition & 1 deletion mathics/eval/arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def test_positive_arithmetic_expr(expr: BaseElement) -> bool:
return False

head, elements = expr.get_head(), expr.elements
print("check specifics", expr)

if head is SymbolPlus:
positive_nonpositive_terms = {True: [], False: []}
for term in elements:
Expand Down
8 changes: 2 additions & 6 deletions mathics/eval/parts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from typing import List

from mathics.core.atoms import Integer, Integer1
from mathics.core.atoms import Integer
from mathics.core.convert.expression import make_expression
from mathics.core.element import BaseElement, BoxElementMixin
from mathics.core.exceptions import (
Expand All @@ -20,11 +20,7 @@
from mathics.core.list import ListExpression
from mathics.core.subexpression import SubExpression
from mathics.core.symbols import Atom, Symbol, SymbolList
from mathics.core.systemsymbols import (
SymbolDirectedInfinity,
SymbolInfinity,
SymbolNothing,
)
from mathics.core.systemsymbols import SymbolInfinity, SymbolNothing
from mathics.eval.patterns import Matcher


Expand Down

0 comments on commit 7b6f650

Please sign in to comment.