
In this section, we deal with only with the FirstOrderType2R case.


  \begin{equation}
    \begin{array}{l}
      \label{eq:full-toto1-ter}
      M x_{k+1} = M x_{k} +h \theta f(x_{k+1},t_{k+1}) +h(1-\theta)f(x_{k},t_{k}) + h r_{k+\gamma} \\[2mm]
      y_{k+\gamma} =  h(t_{k+\gamma},x_{k+\gamma},\lambda _{k+\gamma}) \\[2mm]
      r_{k+\gamma} = g(t_{k+\gamma},\lambda_{k+\gamma})\\[2mm]
    \end{array}
\end{equation}

 \paragraph{Newton's linearization of the first line of~(\ref{eq:full-toto1-ter})} The first line of the  problem~(\ref{eq:full-toto1-ter}) can be written under the form of a residue $\mathcal R$ depending only on $x_{k+1}$ and $r_{k+\gamma}$ such that 
\begin{equation}
  \label{eq:full-NL3}
  \mathcal R (x_{k+1},r _{k+\gamma}) =0
\end{equation}
with $$\mathcal R(x,r) = M(x - x_{k}) -h\theta f( x , t_{k+1}) - h(1-\theta)f(x_k,t_k) - h r. $$
The solution of this system of nonlinear equations is sought as a limit of the sequence $\{ x^{\alpha}_{k+1},r^{\alpha}_{k+\gamma} \}_{\alpha \in \NN}$ such that
 \begin{equation}
   \label{eq:full-NL7}
   \begin{cases}
     x^{0}_{k+1} = x_k \\ \\
     r^{0}_{k+\gamma} = (1-\gamma ) r_{k} + \gamma r^0_{k+1}  = r_k \\ \\     
     \mathcal R_L( x^{\alpha+1}_{k+1},r^{\alpha+1}_{k+\gamma}) = \mathcal
     R(x^{\alpha}_{k+1},r^{\alpha}_{k+\gamma})  + \left[ \nabla_{x} \mathcal
     R(x^{\alpha}_{k+1},r^{\alpha}_{k+\gamma})\right] (x^{\alpha+1}_{k+1}-x^{\alpha}_{k+1} ) + \\[2mm]
     \qquad\qquad\qquad\qquad\qquad\qquad\left[ \nabla_{r} \mathcal R(x^{\alpha}_{k+1},r^{\alpha}_{k+\gamma})\right] (r^{\alpha+1}_{k+\gamma} - r^{\alpha}_{k+\gamma} ) =0
 \end{cases}
\end{equation}
\begin{ndrva}
  What about $r^0_{k+\gamma}$ ?
\end{ndrva}

The residu free is also defined (useful for implementation only):
\[\mathcal R _{\free}(x) \stackrel{\Delta}{=}  M(x - x_{k}) -h\theta f( x , t_{k+1}) - h(1-\theta)f(x_k,t_k).\]
We get
\begin{equation}
  \mathcal R (x^{\alpha}_{k+1},r^{\alpha}_{k+\gamma}) = \fbox{$\mathcal R^{\alpha}_{k+1} \stackrel{\Delta}{=}  \mathcal R_{\free}(x^{\alpha}_{k+1} )  - h r^{\alpha}_{k+\gamma}$}\label{eq:full-rfree-1}
\end{equation}

\[  \mathcal R
_{\free}(x^{\alpha}_{k+1} )=\fbox{$ \mathcal R _{\free, k+1} ^{\alpha} \stackrel{\Delta}{=}  M(x^{\alpha}_{k+1} - x_{k}) -h\theta f( x^{\alpha}_{k+1} , t_{k+1}) - h(1-\theta)f(x_k,t_k)$}\]
 
The computation of the Jacobian of $\mathcal R$ with respect to $x$, denoted by $   W^{\alpha}_{k+1}$ leads to 
\begin{equation}
   \label{eq:full-NL9}
   \begin{array}{l}
    W^{\alpha}_{k+1} \stackrel{\Delta}{=} \nabla_{x} \mathcal R (x^{\alpha}_{k+1})= M - h  \theta \nabla_{x} f(  x^{\alpha}_{k+1}, t_{k+1} ).\\
 \end{array}
\end{equation}
At each time--step, we have to solve the following linearized problem,
\begin{equation}
   \label{eq:full-NL10}
    \mathcal R^{\alpha}_{k+1} + W^{\alpha}_{k+1} (x^{\alpha+1}_{k+1} -
    x^{\alpha}_{k+1}) - h  (r^{\alpha+1}_{k+\gamma} - r^{\alpha}_{k+\gamma} )  =0 ,
\end{equation}
By using (\ref{eq:full-rfree-1}), we get
\begin{equation}
  \label{eq:full-rfree-2}
  \mathcal R _{\free}(x^{\alpha}_{k+1})  - h  r^{\alpha+1}_{k+\gamma}   + W^{\alpha}_{k+1} (x^{\alpha+1}_{k+1} -
    x^{\alpha}_{k+1})  =0 
\end{equation}

%\fbox
{
  \begin{equation}
    \boxed{ x^{\alpha+1}_{k+1} = h(W^{\alpha}_{k+1})^{-1}r^{\alpha+1}_{\gamma+1} +x^\alpha_{\free}}
  \end{equation}
}
with :
\begin{equation}
  \boxed{x^\alpha_{\free}\stackrel{\Delta}{=}x^{\alpha}_{k+1}-(W^{\alpha}_{k+1})^{-1}\mathcal R_{\free,k+1}^{\alpha} \label{eq:full-rfree-12}}
\end{equation}

The matrix $W$ is clearly non singular for small $h$.

Note that the linearization is equivalent to the case (\ref{eq:rfree-2}) and (\ref{eq:rfree-12}) with $\gamma=1$ and replacing $r_{k+1}$ by $r_{k+\gamma}$.

 \paragraph{Newton's linearization of the second  line of~(\ref{eq:full-toto1-ter})}
The same operation is performed with the second equation of (\ref{eq:full-toto1-ter})
\begin{equation}
  \begin{array}{l}
    \mathcal R_y(x,y,\lambda)=y-h(t_{k+\gamma},\gamma x + (1-\gamma) x_k ,\lambda) =0\\ \\
  \end{array}
\end{equation}
which is linearized as
\begin{equation}
  \label{eq:full-NL9}
  \begin{array}{l}
    \mathcal R_{Ly}(x^{\alpha+1}_{k+1},y^{\alpha+1}_{k+\gamma},\lambda^{\alpha+1}_{k+\gamma}) = \mathcal
    R_{y}(x^{\alpha}_{k+1},y^{\alpha}_{k+\gamma},\lambda^{\alpha}_{k+\gamma}) +
    (y^{\alpha+1}_{k+\gamma}-y^{\alpha}_{k+\gamma})- \\[2mm] \qquad  \qquad \qquad \qquad  \qquad \qquad
    \gamma C^{\alpha}_{k+1}(x^{\alpha+1}_{k+1}-x^{\alpha}_{k+1}) - D^{\alpha}_{k+\gamma}(\lambda^{\alpha+1}_{k+\gamma}-\lambda^{\alpha}_{k+\gamma})=0
  \end{array}
\end{equation}

This leads to the following linear equation
\begin{equation}
  \boxed{y^{\alpha+1}_{k+\gamma} =  y^{\alpha}_{k+\gamma}
  -\mathcal R^{\alpha}_{y,k+1}+ \\
  \gamma C^{\alpha}_{k+1}(x^{\alpha+1}_{k+1}-x^{\alpha}_{k+1}) +
  D^{\alpha}_{k+\gamma}(\lambda^{\alpha+1}_{k+\gamma}-\lambda^{\alpha}_{k+\gamma})}. \label{eq:full-NL11y}
\end{equation}
with,
\begin{equation}
     \begin{array}{l}
  C^{\alpha}_{k+\gamma} = \nabla_xh(t_{k+1}, x^{\alpha}_{k+\gamma},\lambda^{\alpha}_{k+\gamma} ) \\ \\
  D^{\alpha}_{k+\gamma} = \nabla_{\lambda}h(t_{k+1}, x^{\alpha}_{k+\gamma},\lambda^{\alpha}_{k+\gamma})
 \end{array}
\end{equation}
and
\begin{equation}\fbox{$
\mathcal R^{\alpha}_{yk+1} \stackrel{\Delta}{=} y^{\alpha}_{k+\gamma} - h(x^{\alpha}_{k+\gamma},\lambda^{\alpha}_{k+\gamma})$}
 \end{equation}

Note that the linearization is equivalent to the case (\ref{eq:NL11y}) by replacing $\lambda_{k+1}$ by $\lambda_{k+\gamma}$ and $x_{k+1}$ by $x_{k+\gamma}$.

 \paragraph{Newton's linearization of the third  line of~(\ref{eq:full-toto1-ter})}
The same operation is performed with the third equation of (\ref{eq:full-toto1-ter})
\begin{equation}
  \begin{array}{l}
    \mathcal R_r(r,\lambda)=r-g(\lambda,t_{k+1}) =0\\ \\  \end{array}
\end{equation}
which is linearized as
\begin{equation}
  \label{eq:full-NL9}
  \begin{array}{l}
      \mathcal R_{L\lambda}(r^{\alpha+1}_{k+\gamma},\lambda^{\alpha+1}_{k+\gamma}) = \mathcal
      R_{r,k+\gamma}^{\alpha} + (r^{\alpha+1}_{k+\gamma} - r^{\alpha}_{k+\gamma}) - B^{\alpha}_{k+\gamma}(\lambda^{\alpha+1}_{k+\gamma} -
      \lambda^{\alpha}_{k+\gamma})=0
    \end{array}
  \end{equation}
\begin{equation}
  \label{eq:full-rrL}
  \begin{array}{l}
    \boxed{r^{\alpha+1}_{k+\gamma} = g(\lambda ^{\alpha}_{k+\gamma},t_{k+\gamma}) -B^{\alpha}_{k+\gamma}
      \lambda^{\alpha}_{k+\gamma} + B^{\alpha}_{k+\gamma} \lambda^{\alpha+1}_{k+\gamma}}       
  \end{array}
\end{equation}
with,
\begin{equation}
     \begin{array}{l}
  B^{\alpha}_{k+\gamma} = \nabla_{\lambda}g(\lambda ^{\alpha}_{k+\gamma},t_{k+\gamma})
 \end{array}
\end{equation}
and the  residue for $r$:
\begin{equation}
\boxed{\mathcal
      R_{rk+\gamma}^{\alpha} = r^{\alpha}_{k+\gamma} - g(\lambda ^{\alpha}_{k+\gamma},t_{k+\gamma})}
  \end{equation}
Note that the linearization is equivalent to the case (\ref{eq:rrL}) by replacing $\lambda_{k+1}$ by $\lambda_{k+\gamma}$ and $x_{k+1}$ by $x_{k+\gamma}$.

\paragraph{Reduction to a linear relation between  $x^{\alpha+1}_{k+1}$ and
$\lambda^{\alpha+1}_{k+\gamma}$}

Inserting (\ref{eq:full-rrL}) into~(\ref{eq:full-rfree-12}), we get the following linear relation between $x^{\alpha+1}_{k+1}$ and
$\lambda^{\alpha+1}_{k+1}$, 

\begin{equation}
   \begin{array}{l}
     x^{\alpha+1}_{k+1} = h(W^{\alpha}_{k+1} )^{-1}\left[g(\lambda^{\alpha}_{k+\gamma},t_{k+\gamma}) +
    B^{\alpha}_{k+\gamma} (\lambda^{\alpha+1}_{k+\gamma} - \lambda^{\alpha}_{k+\gamma}) \right ] +x^\alpha_{free}
\end{array}
\end{equation}
that is 
\begin{equation}
  \begin{array}{l}
\boxed{x^{\alpha+1}_{k+1}=x_p + h (W^{\alpha}_{k+1})^{-1}    B^{\alpha}_{k+\gamma} \lambda^{\alpha+1}_{k+\gamma}}
   \end{array}
  \label{eq:full-rfree-13}
\end{equation}
with 
\begin{equation}
  \boxed{x_p \stackrel{\Delta}{=}  h(W^{\alpha}_{k+1} )^{-1}\left[g(\lambda^{\alpha}_{k+\gamma},t_{k+\gamma}) -B^{\alpha}_{k+\gamma} (\lambda^{\alpha}_{k+\gamma}) \right ] +x^\alpha_{free}}
\end{equation}


\paragraph{Reduction to a linear relation between  $y^{\alpha+1}_{k+\gamma}$ and
$\lambda^{\alpha+1}_{k+\gamma}$}

Inserting (\ref{eq:full-rfree-13}) into (\ref{eq:full-NL11y}), we get the following linear relation between $y^{\alpha+1}_{k+1}$ and $\lambda^{\alpha+1}_{k+1}$, 
\begin{equation}
   \begin{array}{l}
 y^{\alpha+1}_{k+1} = y_p + \left[ h \gamma C^{\alpha}_{k+\gamma} ( W^{\alpha}_{k+1})^{-1}  B^{\alpha}_{k+1} + D^{\alpha}_{k+1} \right]\lambda^{\alpha+1}_{k+1}
   \end{array}
\end{equation}
with 
\begin{equation}
y_p = y^{\alpha}_{k+1} -\mathcal R^{\alpha}_{yk+1} + \gamma C^{\alpha}_{k+1}(x_q) - D^{\alpha}_{k+1} \lambda^{\alpha}_{k+1} 
\end{equation}
that is 
\begin{equation}\boxed{
y_p =  h(x^{\alpha}_{k+\gamma},\lambda^{\alpha}_{k+\gamma}) + \gamma C^{\alpha}_{k+1}(x_q) - D^{\alpha}_{k+1} \lambda^{\alpha}_{k+1} }
\end{equation}
\textcolor{red}{
  \begin{equation}
   \boxed{ x_q=(x_p -x^{\alpha}_{k+1})\label{eq:full-xqq}}
  \end{equation}
}


\paragraph{The linear case}
\begin{equation}
  \begin{array}{lcl}
    y_p &=&  h(x^{\alpha}_{k+\gamma},\lambda^{\alpha}_{k+\gamma}) + \gamma C^{\alpha}_{k+1}(x_q) - D^{\alpha}_{k+1} \lambda^{\alpha}_{k+1}\\
        &=&  C^{\alpha}_{k+1} x^{\alpha}_{k+\gamma} + D^{\alpha}_{k+1}\lambda^{\alpha}_{k+\gamma}  + \gamma C^{\alpha}_{k+1}(x_q) - D^{\alpha}_{k+1} \lambda^{\alpha}_{k+1} \\
        &=& C^{\alpha}_{k+1}  (x^{\alpha}_{k+\gamma} + \gamma x_p - \gamma x^{\alpha}_{k+1} ) \\
        &=& C^{\alpha}_{k+1}  ((1-\gamma) x_{k} + \gamma x_{free} ) \text {since } x_p =x_{free} 
\end{array}
\end{equation}




\paragraph{Implementation details}

For the moment (Feb. 2011), we set $x_q=(1-\gamma) x_{k} + \gamma x_{free} $ in the linear case.
The nonlinear case is not yet implemented since we need to
change the management of \texttt{ H_alpha} Relation to be able to compute the mid--point values.
% things that remain to  do
%
% \begin{itemize}
% \item implement the function \texttt{BlockVector  computeg(t,lambda)} and \texttt{SimpleVector computeh(t,x,lambda)} which takes into account the values of the argument and return and vector
% \item remove temporary computation in Relation of {\verb Xq, \verb g_alpha and \verb H_alpha }. This should be stored somewhere else. (in the  node of the graph)
% \end{itemize}








\clearpage


%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "DevNotes"
%%% End: 
