tag:blogger.com,1999:blog-9266717.post111301311022362939..comments2023-05-22T10:01:23.167-03:00Comments on Only Python: Computing derivatives using PythonAndré Robergehttp://www.blogger.com/profile/08131391818998844540noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-9266717.post-41864708726536667912009-11-16T17:08:13.224-04:002009-11-16T17:08:13.224-04:00You should be careful when using this formula sinc...You should be careful when using this formula since the limit of this formula might exist while the limit that defines the derivative might not. They are not the same thing although the "second-order centred difference" formula provides better numerical approximation.Unknownhttps://www.blogger.com/profile/06243006284160866652noreply@blogger.comtag:blogger.com,1999:blog-9266717.post-61345955179620574252009-04-20T20:56:00.000-03:002009-04-20T20:56:00.000-03:00Check this out (possibly a bit clearer for debuggi...Check this out (possibly a bit clearer for debugging):<br /><br />def D(f,h=1e-5):<br /> '''Return derivative of function f'''<br /> def df(x):<br /> return (f(x+h)-f(x))/h<br /> df.__name__ = f.__name__ + '_dx'<br /> return dfMatthew Strax-Haberhttps://www.blogger.com/profile/04803475420282258010noreply@blogger.comtag:blogger.com,1999:blog-9266717.post-1113501777871699062005-04-14T15:02:00.000-03:002005-04-14T15:02:00.000-03:00Directly from the time machine:http://mail.python....Directly from the time machine:<BR/><BR/><A HREF="http://mail.python.org/pipermail/edu-sig/2003-March/002757.html" REL="nofollow">http://mail.python.org/pipermail/edu-sig/2003-March/002757.html</A>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9266717.post-1113482558125541972005-04-14T09:42:00.000-03:002005-04-14T09:42:00.000-03:00Approximations of this form are called "finite dif...Approximations of this form are called "finite differences", of which there are many variations. The particular difference formula your employing is often called a "second-order centered difference", while the one your contrasting against is a "first-order forward difference." The "second-order" and "first-order" refer to the accuracy. Second-order means that the error in the approximation decreases with decreasing h proportional h*h, while first-order decreases only proportional to h.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9266717.post-1113481451615474922005-04-14T09:24:00.000-03:002005-04-14T09:24:00.000-03:00I do not know if this method has a name. It is so...I do not know if this method has a name. It is something I picked up more than 15 years ago. I tried to look it up in a few books but didn't find it anywhere.André Robergehttps://www.blogger.com/profile/08131391818998844540noreply@blogger.comtag:blogger.com,1999:blog-9266717.post-1113472577812413062005-04-14T06:56:00.000-03:002005-04-14T06:56:00.000-03:00Nice example. Care to add the name of the numerica...Nice example. Care to add the name of the numerical method used?Anonymousnoreply@blogger.com