Python: a_double Binary Operators With AD Result: Example and Test
defa_double_ad_binary_xam() :
## load the Cppad Swig libraryimport py_cppad
## initialize return variable
ok = True
# ---------------------------------------------------------------------
two = py_cppad.a_double(2.0)
three = py_cppad.a_double(3.0)
#
five = two + three
six = two * three
neg_one = two - three
two_thirds = two / three
#
ok = ok and five.value() == 5.0
ok = ok and six.value() == 6.0
ok = ok and neg_one.value() == -1.0
ok = ok and 0.5 < two_thirds.value()
ok = ok and two_thirds.value() < 1.0
ok = ok and five < six
#return( ok )
#