\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
abs_normal_fun¶
View page sourceCreate An Abs-normal Representation of a Function¶
Syntax¶
abs_normal_fun
( g , a )f¶
The object f has prototype
const ADFun
< Base >& f
It represents a function \(f : \B{R}^n \rightarrow \B{R}^m\). We assume that the only non-smooth terms in the representation are absolute value functions and use \(s \in \B{Z}_+\) to represent the number of these terms.
n¶
We use n to denote the dimension of the domain space for f .
m¶
We use m to denote the dimension of the range space for f .
s¶
We use s to denote the number of absolute value terms in f .
a¶
The object a has prototype
ADFun
< Base > a
The initial function representation in a is lost. Upon return it represents the result of the absolute terms \(a : \B{R}^n \rightarrow \B{R}^s\); see \(a(x)\) defined below. Note that a is constructed by copying f and then changing the dependent variables. There may be many calculations in this representation that are not necessary and can be removed using
a .
optimize
()
This optimization is not done automatically by abs_normal_fun
because it may take a significant amount of time.
zeta¶
Let \(\zeta_0 ( x )\) denote the argument for the first absolute value term in \(f(x)\), \(\zeta_1 ( x , |\zeta_0 (x)| )\) for the second term, and so on.
a(x)¶
For \(i = 0 , \ldots , {s-1}\) define
This defines \(a : \B{R}^n \rightarrow \B{R}^s\).
g¶
The object g has prototype
ADFun
< Base > g
The initial function representation in g is lost. Upon return it represents the smooth function \(g : \B{R}^{n + s} \rightarrow \B{R}^{m + s}\) is defined by
were \(y(x, u)\) and \(z(x, u)\) are defined below.
z(x, u)¶
Define the smooth function \(z : \B{R}^{n + s} \rightarrow \B{R}^s\) by
Note that the partial of \(z_i\) with respect to \(u_j\) is zero for \(j \geq i\).
y(x, u)¶
There is a smooth function \(y : \B{R}^{n + s} \rightarrow \B{R}^m\) such that \(y( x , u ) = f(x)\) whenever \(u = a(x)\).
Affine Approximation¶
We define the affine approximations
It follows that
Abs-normal Approximation¶
Approximating a(x)¶
The function \(a(x)\) is not smooth, but it is equal to \(| z(x, u) |\) when \(u = a(x)\). Furthermore
The partial of \(z_i\) with respect to \(u_j\) is zero for \(j \geq i\). It follows that
Considering the case \(i = 0\) we define
It follows that
In general, we define \(a_i [ \hat{x} ]\) using \(a_j [ \hat{x} ]\) for \(j < i\) as follows:
It follows that
Note that in the case where \(z(x, u)\) and \(y(x, u)\) are affine,
Approximating f(x)¶
Correspondence to Literature¶
Using the notation \(Z = \partial_x z(\hat{x}, \hat{u})\), \(L = \partial_u z(\hat{x}, \hat{u})\), \(J = \partial_x y(\hat{x}, \hat{u})\), \(Y = \partial_u y(\hat{x}, \hat{u})\), the approximation for \(z\) and \(y\) are
Moving the terms with \(\hat{x}\) together, we have
Using the notation \(c = z ( \hat{x}, \hat{u} ) - Z \hat{x} - L \hat{u}\), \(b = y ( \hat{x}, \hat{u} ) - J \hat{x} - Y \hat{u}\), we have
Considering the affine case, where the approximations are exact, and choosing \(u = a(x) = |z(x, u)|\), we obtain
This is Equation (2) of the Reference .
Example¶
The file abs_get_started.cpp contains an example and test using this operation. The section example_abs_normal has a links to all the abs normal examples.