[CppAD] Automatic differentiation of tanh fails for some values

Srikrishnan Ramadurai srikrish at uw.edu
Tue Jul 12 13:37:52 EDT 2011


Hi,

I am trying to find the jacobian for a function that has a few tanh
functions in it . I've noticed that the differentiation of tanh function
fails for some arguments.

A test example  is y=tanh(c*x1)+x2

The Jacobian of y is obtained when c is small say 20, but fails with an
error when c is something like 100. This is using the driver function
Jacobian.

This is the error that I receive.

cppad-20110711 error from a known source:
y_p = f.Forward(p, x_p): has a nan in y_p for p = 0.
Error detected by false result for
    false

Is there something that I need to do to make the differentiation work? Any
help is appreciated.

The sample code in c++ is attached. The system is a intel core 2 quad
machine running on 64 bit ubuntu 10.04.

Thanks.

Regards
Srikrishnan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/cppad/attachments/20110712/27a2de3d/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cppadtest.cpp
Type: text/x-c++src
Size: 768 bytes
Desc: not available
Url : http://list.coin-or.org/pipermail/cppad/attachments/20110712/27a2de3d/attachment.bin 


More information about the CppAD mailing list