Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
μολών λαβέ

Active Member

Joined: 27 Mar 2005
Posts: 569

Posted: 07 Jun 2010 08:59:09 am    Post subject:

Numerical differentiation is often a risky endeavor. Remembering that approximating a derivative is the same as dividing a near-zero quantity (usually obtained by subtracting near-equal quantities) by another near-zero quantity, this is (partly) the reason why numerical differentiation is never as easy as, say, numerical integration.

Notwithstanding this, here is a TI-BASIC routine to estimate the value of an O-th order derivative of a function at a specified X value.


:Input "F(X)=",Str0
:Str►Equ(Str0,Y₀):FnOff 0
:Input "ORDER: ",O
:If O<0 or fPart(O)
:Prompt X
:abs(X)E-2→H \\ E-2 == 10^(-2
:E-9→T \\ tolerance (increase for greater speed but less accuracy); E-9 == 10^(-9
:DelVar Y:H→U
:If not(E):Then
:DelVar K
:While K≤9 and Q
:If E:Then
:((Y₀(X+U)-S)-(S-Y₀(X-U)))/(2F)→C \\ yes, the parentheses are crucial
:DelVar V
:If I<J
:DelVar W
:If 0<I
:If P<J:M-J+P→M
:If K≥P:Then
:abs(Y-R)>Tabs(Y)→Q \\ convergence criterion
:DelVar ∟C
:DelVar ∟DF

The program prompts for the function, derivative order, and the point where the function's derivative is to be estimated. The program tries for maximum possible accuracy in the estimate, but (usually) higher-order derivatives are computed with a larger error than lower order ones, depending on the function and the neighborhood of the X value given. If the function given to it is pathological enough, it can give completely wrong answers, since the algorithm assumes smoothness (i.e. first few derivatives of the function should be continuous) of the function.

The algorithm is adapted from these papers.


Last edited by Guest on 09 Jun 2010 08:11:57 am; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours