Search   Memberlist   Usergroups
 Page 1 of 1 [3 Posts]
Author Message
Rouben Rostamian

Joined: 01 May 2005
Posts: 85

Posted: Fri Jul 14, 2006 3:36 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)?

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
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 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

 Quote: Thanks.
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.

 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 Page 1 of 1 [3 Posts]
 The time now is Sun Apr 21, 2019 1:00 am | All times are GMT
 Jump to: Select a forum-------------------Forum index|___Science and Technology    |___Math    |   |___Research    |   |___num-analysis    |   |___Symbolic    |   |___Combinatorics    |   |___Probability    |   |   |___Prediction    |   |       |   |___Undergraduate    |   |___Recreational    |       |___Physics    |   |___Research    |   |___New Theories    |   |___Acoustics    |   |___Electromagnetics    |   |___Strings    |   |___Particle    |   |___Fusion    |   |___Relativity    |       |___Chem    |   |___Analytical    |   |___Electrochem    |   |   |___Battery    |   |       |   |___Coatings    |       |___Engineering        |___Control        |___Mechanics        |___Chemical

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