1
# This file is part of the UFO.
3
# This file contains definitions for functions that
4
# are extensions of the cmath library, and correspond
5
# either to functions that are in cmath, but inconvenient
6
# to access from there (e.g. z.conjugate()),
7
# or functions that are simply not defined.
11
__date__ = "22 July 2010"
12
__author__ = "claude.duhr@durham.ac.uk"
15
from object_library import all_functions, Function
18
# shortcuts for functions from cmath
21
complexconjugate = Function(name = 'complexconjugate',
23
expression = 'z.conjugate()')
26
re = Function(name = 're',
28
expression = 'z.real')
30
im = Function(name = 'im',
32
expression = 'z.imag')
34
# Auxiliary functions for NLO
36
cond = Function(name = 'cond',
37
arguments = ('condition','ExprTrue','ExprFalse'),
38
expression = '(ExprTrue if condition==0.0 else ExprFalse)')
40
reglog = Function(name = 'reglog',
42
expression = '(0.0 if z==0.0 else cmath.log(z))')
44
# New functions (trigonometric)
46
sec = Function(name = 'sec',
48
expression = '1./cmath.cos(z)')
50
asec = Function(name = 'asec',
52
expression = 'cmath.acos(1./z)')
54
csc = Function(name = 'csc',
56
expression = '1./cmath.sin(z)')
58
acsc = Function(name = 'acsc',
60
expression = 'cmath.asin(1./z)')