Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atan_2 changed to atan2 #196

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ufl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
- sqrt
- exp, ln, erf
- cos, sin, tan
- acos, asin, atan, atan_2
- acos, asin, atan, atan2
- cosh, sinh, tanh
- bessel_J, bessel_Y, bessel_I, bessel_K

Expand Down Expand Up @@ -320,7 +320,7 @@
from ufl.operators import (
rank, shape, conj, real, imag, outer, inner, dot, cross, perp,
det, inv, cofac, transpose, tr, diag, diag_vector, dev, skew, sym,
sqrt, exp, ln, erf, cos, sin, tan, acos, asin, atan, atan_2, cosh, sinh, tanh,
sqrt, exp, ln, erf, cos, sin, tan, acos, asin, atan, atan2, cosh, sinh, tanh,
bessel_J, bessel_Y, bessel_I, bessel_K, eq, ne, le, ge, lt, gt, And, Or, Not,
conditional, sign, max_value, min_value, variable, diff,
Dx, grad, div, curl, rot, nabla_grad, nabla_div, Dn, exterior_derivative,
Expand Down Expand Up @@ -385,7 +385,7 @@
'transpose', 'tr', 'diag', 'diag_vector', 'dev', 'skew', 'sym',
'sqrt', 'exp', 'ln', 'erf',
'cos', 'sin', 'tan',
'acos', 'asin', 'atan', 'atan_2',
'acos', 'asin', 'atan', 'atan2',
'cosh', 'sinh', 'tanh',
'bessel_J', 'bessel_Y', 'bessel_I', 'bessel_K',
'eq', 'ne', 'le', 'ge', 'lt', 'gt', 'And', 'Or', 'Not',
Expand Down
2 changes: 1 addition & 1 deletion ufl/algorithms/apply_derivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def atan(self, o, fp):
f, = o.ufl_operands
return fp / (1.0 + f**2)

def atan_2(self, o, fp, gp):
def atan2(self, o, fp, gp):
f, g = o.ufl_operands
return (g * fp - f * gp) / (f**2 + g**2)

Expand Down
2 changes: 1 addition & 1 deletion ufl/algorithms/estimate_degrees.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def power(self, v, a, b):
# negative integer, Coefficient, etc.
return self._add_degrees(v, a, 2)

def atan_2(self, v, a, b):
def atan2(self, v, a, b):
"""Using the heuristic
degree(atan2(const,const)) == 0
degree(atan2(a,b)) == max(degree(a),degree(b))+2
Expand Down
4 changes: 2 additions & 2 deletions ufl/mathfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,12 @@ def evaluate(self, x, mapping, component, index_values):
except TypeError:
raise ValueError('Atan2 does not support complex numbers.')
except ValueError:
warnings.warn('Value error in evaluation of function atan_2 with arguments %s, %s.' % (a, b))
warnings.warn('Value error in evaluation of function atan2 with arguments %s, %s.' % (a, b))
raise
return res

def __str__(self):
return "atan_2(%s,%s)" % (self.ufl_operands[0], self.ufl_operands[1])
return "atan2(%s,%s)" % (self.ufl_operands[0], self.ufl_operands[1])


@ufl_type()
Expand Down
4 changes: 2 additions & 2 deletions ufl/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,12 @@ def atan(f):
return _mathfunction(f, Atan)


def atan_2(f1, f2):
def atan2(f1, f2):
"UFL operator: Take the inverse tangent with two the arguments *f1* and *f2*."
f1 = as_ufl(f1)
f2 = as_ufl(f2)
if isinstance(f1, (ComplexValue, complex)) or isinstance(f2, (ComplexValue, complex)):
raise TypeError('atan_2 is incompatible with complex numbers.')
raise TypeError('atan2 is incompatible with complex numbers.')
r = Atan2(f1, f2)
if isinstance(r, (RealValue, Zero, int, float)):
return float(r)
Expand Down