a neat idea, easy to do in Maxima, perhaps. Numerical derivatives
- Subject: a neat idea, easy to do in Maxima, perhaps. Numerical derivatives
- From: Joshua Stults
- Date: Sat, 5 Dec 2009 11:33:01 -0500
This is an increasingly popular method for doing sensitivity analysis of
complex computational physics codes. I was playing around with it and did a
little 'grid convergence' study showing that in fact it is second order
accurate and avoids subtractive cancellation:
http://j-stults.blogspot.com/2008/12/complex-step-subtractive-cancellation.html
You can extend the idea to higher derivatives / orders. Those don't enjoy
the same benefit of arbitrarily high accuracy by avoiding subtractive
cancellation, but they do increase the accuracy with fewer additional
function evaluations.
Another good short write-up is Squire and Trapp 1998:
http://www.math.uu.se/~warwick/summer04/material/reading/week2/complexDerivative.pdf
I even wrote a little Maxima batch file that calculates the expressions (for
use in fortran) for arbitrary derivatives using a mixture of real and
complex steps:
http://j-stults.blogspot.com/2008/12/asymmetric-complex-step.html
Neat stuff.
On Fri, Dec 4, 2009 at 11:54 PM, Richard Fateman <fateman at cs.berkeley.edu>wrote:
> *Accurate numerical derivatives in MATLAB*
>
> *Source*
> ACM Transactions on Mathematical Software (TOMS) archive<http://portal.acm.org/toc.cfm?id=J782&type=periodical&coll=portal&dl=ACM&CFID=525354554&CFTOKEN=525354554>
> Volume 33 , Issue 4 (August 2007) table of contents<http://portal.acm.org/toc.cfm?id=1268776&type=issue&coll=portal&dl=ACM&CFID=525354554&CFTOKEN=525354554>
> Article No. 26
> Year of Publication: 2007
> ISSN:0098-3500
> *Author *
> L. F. Shampine<http://portal.acm.org/author_page.cfm?id=81100197580&coll=portal&dl=ACM&trk=0&CFID=525354554&CFTOKEN=525354554> Southern
> Methodist University, Dallas, TX
> *Publisher*
> ACM <http://www.acm.org/publications> New York, NY, USA
>
> The basic observation is that if you can evaluate a function accurately at
> a complex point, you have a way of getting very very accurate numerical
> values of its derivative.
>
> Observe that Im( f(x+i*h)) /h = f'(x)- h^3/6*f'''(x) + ....
>
> solve for f'(x).
>
> Much better than finite differences. Read the paper if you want more
> interesting observations.
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
--
Joshua Stults
Website: http://j-stults.blogspot.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 7154 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20091205/4c7769b5/attachment.gif