|
|
Subject:
What is the best algorithm to calculate a derivative in C++
Category: Computers Asked by: shaneb2000-ga List Price: $2.00 |
Posted:
20 Jun 2004 11:33 PDT
Expires: 20 Jul 2004 11:33 PDT Question ID: 363638 |
Im looking for a way to calculate a derivative in c++. An example of code would be usefull to. |
|
Subject:
Re: What is the best algorithm to calculate a derivative in C++
Answered By: livioflores-ga on 20 Jun 2004 12:53 PDT |
Hi shaneb2000!! Here is what I found: "A Guide to the Complex-Step Derivative Approximation" at University of Toronto Institute for Aerospace Studies - Multidisciplinary Design Optimization Laboratory website: 'The complex-step derivative approximation is a very convenient way of estimating derivatives numerically. It is a simple and accurate means of finding derivatives of a quantity calculated by an existing algorithm.' http://mdolab.utias.utoronto.ca/complex-step.html At this site see: "Complex-Step Derivative Approximation Official Guide: C++ Implementation": http://mdolab.utias.utoronto.ca/c++.html "Complex-Step Derivative Approximation Official Guide: C++ Template Example": http://mdolab.utias.utoronto.ca/c++template.html "THE CONNECTION BETWEEN THE COMPLEX-STEP DERIVATIVE APPROXIMATION AND ALGORITHMIC DIFFERENTIATION" by Joaquim R. R. A. Martins, Peter Sturdza and Juan J. Alonso: http://mdolab.utias.utoronto.ca/documents/Martins2001.pdf "Algorithmic Differentiation": http://mdolab.utias.utoronto.ca/aer1415/aer1415_ho8.pdf See also: "Differential Arithmetic Library": http://www.schmitteckert.com/boost/diffari/ See the Documentation page: http://www.schmitteckert.com/boost/diffari/diff_ari.html More references: "Differentiation": http://www.shodor.org/refdesk/Resources/Applications/Differentiation/index.php "Micah Yoder's SEUL Page": http://cran.mit.edu/~yoderm/ Search strategy: "calculate derivatives" algorithm c++ "calculate derivatives" c++ I hope this helps you. If you find something unclear or incomplete, please let me know using the clarification feature before rate this answer. Regards. livioflores-ga |
|
Subject:
Re: What is the best algorithm to calculate a derivative in C++
From: mathtalk-ga on 20 Jun 2004 15:21 PDT |
Methods for computing derivatives commonly fall into the symbolic or numeric category. By symbolic is meant some means of tying an input expression to a resulting differentiated expression, possibly with respect to one of several independent variables. By numeric methods are commonly meant difference quotients (based on the numerical evaluation of the input expression), for which the derivative would be a limit as some parameter (say h) tends to zero. The latter category is often used as a simple illustration of numerically ill-conditioned computations, for as the difference parameter h approaches zero, the resulting numerical evaluation of the difference quotient is prone to numerical inaccuracies dominated by round-off errors (from numerical evaluation of the input expression). Concern with this numerical inaccuracy (if it cannot be avoided by symbolic computation) leads to a rule of thumb for choosing parameter h so that its precision relative to the function's argument (the one with respect to which the differentiation is being done) is about half (in terms of digits of precision) of that available to the floating point arithmetic used. So we have a Goldilocks and the three bears situation. A value of h which is too large leads to a crude estimate of the derivative. A value of h which is too small leads to an estimate vulnerable to round-off errors. One seeks an intermediate value of h that is "just right" for the intended purpose. When higher-order derivatives (mixed or pure) are required, the issues of symbolic vs. numeric computation and numeric instability are ramified. But second-order derivatives are commonly required in optimization algorithms, at least in some approximated form. Discusssion of various strategies specific to this context can be found by searching on terms like "conjugate search", "quasi-Newton", and "BFGS". One such reference is: [Quasi-Newton (secant) methods] http://www-personal.engin.umich.edu/~mepelman/teaching/IOE511/section7.pdf Under mild continuity conditions the Hessian (matrix of second-order partial derivatives) is symmetric, and one aspect of this subject is the selection of approximation methods that preserve this symmetry. regards, mathtalk-ga |
Subject:
GNU Science Library
From: mmmurf-ga on 08 Jul 2004 09:11 PDT |
Have you tried looking in the GSL for some optimized functions that do this? |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |