~maddevelopers/mg5amcnlo/2.9.4

« back to all changes in this revision

Viewing changes to tests/loop_smgrav/function_library.py

pass to v2.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This file is part of the UFO.
 
2
#
 
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.
 
8
#
 
9
#
 
10
 
 
11
__date__ = "22 July 2010"
 
12
__author__ = "claude.duhr@durham.ac.uk"
 
13
 
 
14
import cmath
 
15
from object_library import all_functions, Function
 
16
 
 
17
#
 
18
# shortcuts for functions from cmath
 
19
#
 
20
 
 
21
complexconjugate = Function(name = 'complexconjugate',
 
22
                            arguments = ('z',),
 
23
                            expression = 'z.conjugate()')
 
24
 
 
25
 
 
26
re = Function(name = 're',
 
27
              arguments = ('z',),
 
28
              expression = 'z.real')
 
29
 
 
30
im = Function(name = 'im',
 
31
              arguments = ('z',),
 
32
              expression = 'z.imag')
 
33
 
 
34
# Auxiliary functions for NLO
 
35
 
 
36
cond = Function(name = 'cond',
 
37
                arguments = ('condition','ExprTrue','ExprFalse'),
 
38
                expression = '(ExprTrue if condition==0.0 else ExprFalse)')
 
39
 
 
40
reglog = Function(name = 'reglog',
 
41
                arguments = ('z'),
 
42
                expression = '(0.0 if z==0.0 else cmath.log(z))')
 
43
 
 
44
# New functions (trigonometric)
 
45
 
 
46
sec = Function(name = 'sec',
 
47
             arguments = ('z',),
 
48
             expression = '1./cmath.cos(z)')
 
49
 
 
50
asec = Function(name = 'asec',
 
51
             arguments = ('z',),
 
52
             expression = 'cmath.acos(1./z)')
 
53
 
 
54
csc = Function(name = 'csc',
 
55
             arguments = ('z',),
 
56
             expression = '1./cmath.sin(z)')
 
57
 
 
58
acsc = Function(name = 'acsc',
 
59
             arguments = ('z',),
 
60
             expression = 'cmath.asin(1./z)')
 
61
 
 
62
 
 
63
 
 
64