Derivatives and integrals, trapezoidal rule
PMiKNoM seminars - class 2
Derivatives - analytical solutions
- Application of derivatives in materials engineering and chemical technology - examples.
Basic equations
Exercises
Calculate the derivatives of functions:
- `f(x) = \sqrt{x} + 5x^2 + 3x + 1`
- `f(x) = sin(x) \cdot ln(x)`
- `f(x) = ln(2x+1)`
- `f(x) = cos(-x^3 + 3x + 2)`
- `f(x) = {x^2 + 2x}/sin(x)`
Taylor equation and numerical derivatives
If function `f` is differentiable in range `(a,b)`, than for every point `x` in this range, the condition known as Taylor equation is fullfilled:
First left- and right-side derivative
We use the first order approximation, by neglecting all components of Taylor's polynomial, except the first one. The equation written for steps `h` i `-h`, takes the form:
After rearrangements:
First and second central derivative
We use the second order approximation, by neglecting all components of Taylor's polynomial, except the first two. The equation written for steps `h` i `-h`, takes the form:
After substracting the second equation from the first one, we obtain:
After adding the equations, we obtain:
Integrals - analytical solutions
- Application of integrals in materials engineering and chemical technology - examples.
Basic equations
Exercises
Calculate the following integrals:
- `\int(5x^4 - 3x^2 + 2/x + 1/{x^2}) dx = `
- `\int(sin x - 2e^{-x} + 4^x) dx = `
- `\int({2x^3 - 3^2 + 6x + 7}/{x^2}) dx = `
- `\int(3^x - x^{-1} + cosx + 2) dx = `
Integrals that cannot be solved analytically:
Integrals - numerical solutions
The integral `\int_a^b f(x)` is a surface area are under the plot of the `f(x)` functions with the limits `[a,b]`.
Graphical interpretation
Solution of an integral using the trapezoidal rule - the equations
The value of an integral is a sum of the surface area of the trapezes:
We develop the sum, while substitutting `x_0=a` and `x_n=b`; and move `h` in front of the brackets:
After grouping the components of the sum we receive the final equation:
Solution of integrals using trapezoidal rule - program algorithm:
- Define the itegrand function
- Declare the variables
- Read the values of variables `a`, `b` and `n` from the spreadsheet
- Calculate the integration step (the height of the trapeze)
- Assign zero to variable `s`
- Calculate the sum `s = \sum_{i=1}^{n-1}f(x_i)` - for loop
- Calculate the value of the integral (equation above)
- Display the calculated value (as MsgBox or into the spreadsheet)