In: Advanced Math
[Note that, in this example, the mesh sizes in x and y are identical (h); strictly speaking, this need not be true. In some applications, we may need more resolution along the x- or y-axis; we could then use separate mesh sizes hx and hy.]
By definition, the partial derivative of a function f ( x , y ) with respect to x is
∂ f ∂ x = L i m h ⟶ 0 f ( x i + h , y j ) − f ( x i , y j ) h
and the partial derivative with respect to y is
∂ f /∂ y = L i m h ⟶ 0 f ( x i , y j + h ) − f ( x i , y j )/ h
If we applied these formulas to our grid values, we would get the finite difference expressions
∂ f /d x ( x i , y j ) ≅ f ( x i + 1 , y j ) − f ( x i , y j )/ h
Note: To avoid round-off error, retain at least six decimal places in all of your calculations.
Estimated partial derivatives using finite difference formulas: |
||||
h |
finite difference approx. to ∂ f/ ∂ x |
exact ∂ f/ ∂ x |
finite difference approx. to ∂ f/ ∂ y |
exact ∂ f/ ∂ y |
0.01 |
||||
0.001 |
||||
0.0001 |
Answer the following questions: