FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Forum index » Science and Technology » Math
Numerical differentiation formulas?
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
1940LaSalle@gmail.com
science forum beginner


Joined: 28 Apr 2006
Posts: 17

PostPosted: Wed Jul 12, 2006 8:01 pm    Post subject: Numerical differentiation formulas? Reply with quote

Here's the situation: I have a series of data in a spreadsheet; the
independent variables are spaced equally. I need to determine the
first derivative at each of the values of the independent variable,
including the endpoints, within the spreadsheet, and would prefer to do
it automatically, rather than do a new regression for every case study.


Could someone please (1) recommend a numerical differentiation scheme,
and (2) mention the source with explicit formulas (ideally, formulas
suitable for spreadsheet use)?

Thanks.
Back to top
C6L1V@shaw.ca
science forum Guru


Joined: 23 May 2005
Posts: 628

PostPosted: Wed Jul 12, 2006 8:26 pm    Post subject: Re: Numerical differentiation formulas? Reply with quote

1940LaSalle@gmail.com wrote:
Quote:
Here's the situation: I have a series of data in a spreadsheet; the
independent variables are spaced equally. I need to determine the
first derivative at each of the values of the independent variable,
including the endpoints, within the spreadsheet, and would prefer to do
it automatically, rather than do a new regression for every case study.


Could someone please (1) recommend a numerical differentiation scheme,
and (2) mention the source with explicit formulas (ideally, formulas
suitable for spreadsheet use)?

For X(t), t = 0, h, 2h , ..., Nh, there are two standard approximations
to dX/dt: (1) the forward-difference formula
dX(t)/dt = approx = [X(t+h) - X(t)]/h;
and (2) the central difference formula
dX(t)/dt = approx = [X(t+h) - X(t-h)]/(2h).
For given h, the central-difference formula is one order more accurate:
the forward difference error is proportional to h, while the central
difference error is proportional to h^2 (assuming a twice-continuously
differentiable function X(t)). I guess you could use central
differences at t = h, 2h, ..., (N-1)h, and a forward difference at t=
0. At t = Nh, you could use a backward-difference formula of the form
dX(t)/dt = [X(t) - X(t-h)]/h,
whose accuracy is esentially the same as the forward difference.

Consult the "Numerical Recipes" website for more details (just do a
Google search on the keywords 'numerical recipes').

If all you want are first-order derivatives, you can do the above for
each independent variable separately, so, for example,
dX(t1,t2)/dt1 = [X(t1+h1,t2) - X(t1-h1,t2)]/(2h1), etc.
If you want higher-order derivatives like d^2 X(t1,t2)/dt1 dt2, there
are numerical schemes for those as well; consult the Numerical Recipes,
or any good book on numerical analysis.

R.G. Vickson
Adjunct Professor, University of Waterloo

Quote:

Thanks.
Back to top
Rouben Rostamian
science forum addict


Joined: 01 May 2005
Posts: 85

PostPosted: Fri Jul 14, 2006 3:36 pm    Post subject: Re: Numerical differentiation formulas? Reply with quote

In article <1152734471.748794.208100@s13g2000cwa.googlegroups.com>,
<1940LaSalle@gmail.com> wrote:
Quote:
Here's the situation: I have a series of data in a spreadsheet; the
independent variables are spaced equally. I need to determine the
first derivative at each of the values of the independent variable,
including the endpoints, within the spreadsheet, and would prefer to do
it automatically, rather than do a new regression for every case study.

Could someone please (1) recommend a numerical differentiation scheme,
and (2) mention the source with explicit formulas (ideally, formulas
suitable for spreadsheet use)?

Let h be the difference between two consecutive values of the
independent variable. Let's write u(i) for the value in cell
number i, where i goes from 0 to n (thus you have n+1 points).
Assume n>=2, that is, we have at least 3 data points.
Finally, let u' denote the (approximate) derivative of u.

Then at interior nodes we have:
u'(i) = [u(i+1) - u(i-1)] / (2*h)

At the boundary nodes we have:
u'(0) = [4*u(1) - 3*u(0) - u(2)] / (2*h);
u'(n) = -[4*u(n-1) - 3*u(n) - u(n-2)] / (2*h);

The error in each formula is of the order of h^2.

You can find these formulas in elementary textbooks
on numerical analysis.

--
Rouben Rostamian
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Sun Apr 21, 2019 12:09 am | All times are GMT
Forum index » Science and Technology » Math
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Help in identifying a numerical method Don11135 num-analysis 2 Thu Jul 20, 2006 8:56 pm
No new posts Recommendation for numerical differentiation formulas? 1940LaSalle@gmail.com num-analysis 6 Wed Jul 12, 2006 8:07 pm
No new posts integrand numerical singular near boundary Axel Vogt num-analysis 2 Wed Jul 12, 2006 6:13 pm
No new posts Numerical diagonalization by not using zgeev? MWimmer num-analysis 6 Tue Jul 11, 2006 11:11 am
No new posts Numerical Recipes in C - correlation method paul@paullee.com num-analysis 2 Thu Jul 06, 2006 1:51 pm

Copyright © 2004-2005 DeniX Solutions SRL
Other DeniX Solutions sites: Electronics forum |  Medicine forum |  Unix/Linux blog |  Unix/Linux documentation |  Unix/Linux forums  |  send newsletters
 


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0324s ][ Queries: 16 (0.0054s) ][ GZIP on - Debug on ]