Processing math: 100%

ChemEng stuff followers

Numerical derivative of an analytical function - Google sheets

For this case I shall refer the reader to a previous post on the backgroung about derivatives. There you will find some basic details about what is being exposed here.


Let us estimate the first derivative of the smooth function,

f(x)=4x^4+8x^3-x+9

between x=0 and x=10. For this we shall use,

f'(x_i)=\frac{f\left(x_{i+1}\right)-f(x_i)}{|x_i-x_{i+1}|}     

Next, error or validation of the previous approximation can be easily checked since we already know that,

f'(x)=16x^3+24x^2-1

Some people talk about constant step:

h=|x_i-x_{i+1}| 

but this explicit way is better since it allows to account for not so smooth variations of f(x).

These calculations were already performed in the following Google Sheet:

Numerical derivative of a function 

where three different steps were used h=1, 0.5, 0.1. Notice, that the % error decreases with the step. Then, as you may notice error decreases with h.


Any questtion? Write in the comments and I shall try to help.

========

Ildebrando.

No comments:

Post a Comment

Most popular posts