<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I forgot to mention in my previous post that the simplest approach
    is to program up an approximation for the log gamma function and
    then let CppAD do the rest.<br>
    <br>
    For example, see how the error function is approximated at<br>
    &nbsp;&nbsp;&nbsp;
    <a class="moz-txt-link-freetext" href="https://projects.coin-or.org/CppAD/browser/trunk/cppad/local/erf.hpp">https://projects.coin-or.org/CppAD/browser/trunk/cppad/local/erf.hpp</a><br>
    You would probably only need to implement the log gamma function for
    AD&lt;double&gt; arguments, instead of for an arbitrary base type as
    is done for the error function.<br>
    <br>
    There are two reasons you might want to take the user atomic
    function approach, as opposed to this simple approach. One is that
    you want to improve speed and reduce memory usage. The other is that
    you have routines written in double for the log gamma and its
    derivative and you do not wish to make an AD&lt;double&gt;
    implementation.<br>
    <br>
    On 01/02/2012 08:41 AM, Michael Braun wrote:
    <blockquote cite="mid:6F235582-E33F-4EA1-B25E-8ADCF96C71B2@mit.edu"
      type="cite">
      <pre wrap="">Hi.  I am started to look into using CppAD for some research projects, and I have a question about defining special functions.  As an example, I often use the log gamma (lgamma) function, and I know that its first derivative is a digamma function.  How can I tell CppAD this?  I see that there is a CPPAD_USER_ATOMIC macro, but this macro seems to want me to encode the specifics of the forward and reverse modes.  Since I am a mere end-user of AD, and not very familiar with the algorithmic details, I am hoping that there is an easier way to do this.

Thanks,

Michael Braun
braunm _at_ mit.edu






</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
CppAD mailing list
<a class="moz-txt-link-abbreviated" href="mailto:CppAD@list.coin-or.org">CppAD@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/cppad">http://list.coin-or.org/mailman/listinfo/cppad</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>