From: Tobias Leicht Date: Thu, 27 Mar 2008 15:31:30 +0000 (+0000) Subject: In the automatic differentiation example: initialize values of independent variables... X-Git-Tag: v8.0.0~9238 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=391dc66fe71b89151fac478244334c3c1ac970b5;p=dealii.git In the automatic differentiation example: initialize values of independent variables before declaring them as such. git-svn-id: https://svn.dealii.org/trunk@15936 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-33/doc/intro.dox b/deal.II/examples/step-33/doc/intro.dox index 596c6de571..316b73c0ee 100644 --- a/deal.II/examples/step-33/doc/intro.dox +++ b/deal.II/examples/step-33/doc/intro.dox @@ -124,6 +124,7 @@ used: @code #include +#include typedef Sacado::Fad::DFad fad_double; @@ -131,15 +132,15 @@ main() { fad_double a,b,c; + a = 1; b = 2; + a.diff(0,2); // Set a to be dof 0, in a 2-dof system. b.diff(1,2); // Set b to be dof 1, in a 2-dof system. - a = 1; b = 2; - c = 2*a+cos(a*b); - double *derivs = c.fastAccessDx(0); // Access derivatives + double *derivs = &c.fastAccessDx(0); // Access derivatives std::cout << "dc/da = " << derivs[0] << ", dc/db=" << derivs[1] << std::endl;