Author 
Message 
Rouben Rostamian science forum addict
Joined: 01 May 2005
Posts: 85

Posted: Fri Jul 14, 2006 3:36 pm Post subject:
Re: Numerical differentiation formulas?



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(i1)] / (2*h)
At the boundary nodes we have:
u'(0) = [4*u(1)  3*u(0)  u(2)] / (2*h);
u'(n) = [4*u(n1)  3*u(n)  u(n2)] / (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 


C6L1V@shaw.ca science forum Guru
Joined: 23 May 2005
Posts: 628

Posted: Wed Jul 12, 2006 8:26 pm Post subject:
Re: Numerical differentiation formulas?



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 forwarddifference 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(th)]/(2h).
For given h, the centraldifference 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 twicecontinuously
differentiable function X(t)). I guess you could use central
differences at t = h, 2h, ..., (N1)h, and a forward difference at t=
0. At t = Nh, you could use a backwarddifference formula of the form
dX(t)/dt = [X(t)  X(th)]/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 firstorder derivatives, you can do the above for
each independent variable separately, so, for example,
dX(t1,t2)/dt1 = [X(t1+h1,t2)  X(t1h1,t2)]/(2h1), etc.
If you want higherorder 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


Back to top 


1940LaSalle@gmail.com science forum beginner
Joined: 28 Apr 2006
Posts: 17

Posted: Wed Jul 12, 2006 8:01 pm Post subject:
Numerical differentiation formulas?



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 


Google


Back to top 



The time now is Sun Apr 21, 2019 1:00 am  All times are GMT

