lines 7-37 of file: example/general/pow_nan.cpp

{xrst_begin pow_nan.cpp}

pow: Nan in Result of Pow Function: Example and Test
####################################################

Purpose
*******
The :ref:`pow(x, y)<pow-name>` function will work when :math:`x < 0` and
:math:`y`  is a parameter. It will often generate nan or infinity when
:math:`x < 0` and one tries to compute a derivatives
(even if :math:`y` is a positive integer).
This is because the derivative of the log is :math:`1 / x`
and the power function uses the representation

.. math::

   \R{pow}(x, y) = \exp [ y \cdot \log(x) ]

Problem
*******
There is a problem with this representation when :math:`y` is a parameter
and :math:`x = 0`. For example,
when :math:`x = 0` and :math:`y = 1`, it returns zero for the derivative,
but the actual derivative w.r.t :math:`x` is one.

{xrst_literal
   // BEGIN C++
   // END C++
}

{xrst_end pow_nan.cpp}
