CppAD: A C++ Algorithmic Differentiation Package  20171217
Go to the documentation of this file.
3
4 /* --------------------------------------------------------------------------
6
8 the terms of the
9  Eclipse Public License Version 1.0.
10
11 A copy of this license is included in the COPYING file of this distribution.
13 -------------------------------------------------------------------------- */
14
15 /*
16 -------------------------------------------------------------------------------
18 \$spell
19  Op
21  const
22 \$\$
23
24 \$section AD Binary Arithmetic Operators\$\$
25 \$mindex + add plus - subtract minus * multiply times / divide\$\$
26
27
28
29
30
31
32
34 \$icode%z% = %x% %Op% %y%\$\$
35
37 Performs arithmetic operations where either \$icode x\$\$ or \$icode y\$\$
38 has type
41
43 The operator \$icode Op\$\$ is one of the following
44 \$table
45 \$bold Op\$\$ \$cnext \$bold Meaning\$\$ \$rnext
46 \$code +\$\$ \$cnext \$icode z\$\$ is \$icode x\$\$ plus \$icode y\$\$ \$rnext
47 \$code -\$\$ \$cnext \$icode z\$\$ is \$icode x\$\$ minus \$icode y\$\$ \$rnext
48 \$code *\$\$ \$cnext \$icode z\$\$ is \$icode x\$\$ times \$icode y\$\$ \$rnext
49 \$code /\$\$ \$cnext \$icode z\$\$ is \$icode x\$\$ divided by \$icode y\$\$
50 \$tend
51
53 The type \$icode Base\$\$ is determined by the operand that
55
57 The operand \$icode x\$\$ has the following prototype
58 \$codei%
59  const %Type% &%x%
60 %\$\$
61 where \$icode Type\$\$ is
64 \$icode Base\$\$, or
65 \$code double\$\$.
66
68 The operand \$icode y\$\$ has the following prototype
69 \$codei%
70  const %Type% &%y%
71 %\$\$
72 where \$icode Type\$\$ is
75 \$icode Base\$\$, or
76 \$code double\$\$.
77
78
80 The result \$icode z\$\$ has the following prototype
81 \$codei%
82  %Type% %z%
83 %\$\$
84 where \$icode Type\$\$ is
86
88 This is an \$cref/atomic/glossary/Operation/Atomic/\$\$
90 and hence it is part of the current
92 \$cref/operation sequence/glossary/Operation/Sequence/\$\$.
93
94 \$children%
96  example/general/sub.cpp%
97  example/general/mul.cpp%
98  example/general/div.cpp
99 %\$\$
100
102 The following files contain examples and tests of these functions.
103 Each test returns true if it succeeds and false otherwise.
104 \$table
106 \$rref sub.cpp\$\$
107 \$rref mul.cpp\$\$
108 \$rref div.cpp\$\$
109 \$tend
110
112 If \$latex f\$\$ and \$latex g\$\$ are
113 \$cref/Base functions/glossary/Base Function/\$\$
114
116 \$latex \[
117  \D{[ f(x) + g(x) ]}{x} = \D{f(x)}{x} + \D{g(x)}{x}
118 \] \$\$
119
121 \$latex \[
122  \D{[ f(x) - g(x) ]}{x} = \D{f(x)}{x} - \D{g(x)}{x}
123 \] \$\$
124
126 \$latex \[
127  \D{[ f(x) * g(x) ]}{x} = g(x) * \D{f(x)}{x} + f(x) * \D{g(x)}{x}
128 \] \$\$
129
131 \$latex \[
132  \D{[ f(x) / g(x) ]}{x} =
133  [1/g(x)] * \D{f(x)}{x} - [f(x)/g(x)^2] * \D{g(x)}{x}
134 \] \$\$
135
136 \$end
137 -----------------------------------------------------------------------------
138 */