From 8b944a051a9b118edcd98309e5a2d651e8376b5c Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 28 Dec 2024 10:21:26 -0500 Subject: [PATCH] Add rule for ArcTan[ComplexInfinity] Fixes #510 --- mathics/builtin/numbers/trig.py | 1 + test/builtin/numbers/test_trig.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/mathics/builtin/numbers/trig.py b/mathics/builtin/numbers/trig.py index 8ea925163..21a25f8e1 100644 --- a/mathics/builtin/numbers/trig.py +++ b/mathics/builtin/numbers/trig.py @@ -557,6 +557,7 @@ class ArcTan(MPMathFunction): rules = { "ArcTan[0]": "0", "ArcTan[1]": "Pi/4", + "ArcTan[DirectedInfinity[]]": "Indeterminate", "ArcTan[Undefined]": "Undefined", "ArcTan[Undefined, x_]": "Undefined", "ArcTan[y_, Undefined]": "Undefined", diff --git a/test/builtin/numbers/test_trig.py b/test/builtin/numbers/test_trig.py index dbe01c2d4..22aec0da5 100644 --- a/test/builtin/numbers/test_trig.py +++ b/test/builtin/numbers/test_trig.py @@ -8,6 +8,7 @@ from test.helper import check_evaluation import pytest +from sympy.core.numbers import ComplexInfinity def test_ArcCos(): @@ -29,6 +30,12 @@ def test_ArcCos(): @pytest.mark.parametrize( ("str_expr", "msgs", "str_expected", "fail_msg"), [ + ( + "ArcTan[ComplexInfinity]", + None, + "Indeterminate", + "Rule added for Arctan[ComplexInfinity]", + ), ("ArcTan[-1, 1]", None, "3 Pi / 4", None), ("ArcTan[1, -1]", None, "-Pi / 4", None), ("ArcTan[-1, -1]", None, "-3 Pi / 4", None),