I began with this definition of the derivative
,
which resulted in: Limit[ #, h -> 0] & /@ { (f[x + h, y] - f[x, y])/ h.
But, I want to calculate the derivative at a point with the definition
.
One aim is to increase the accuracy of the calculation by using a set of set of $x$_{ $i$} (a numerical grid), where the spacing (the distance from one grid point to the next) is $?x$. For example, $?x$ = 0.001, a grid of 10,000 points ( $i$ = 1, . . . , 10000) would span a spatial range of 10 units in $x$.
I'm thinking one of these forms would be ideal for $x$_{ $i$} ...
x_{i} = i?x
x_{i} = (i ? i_{m}) ?x
x_{i} = i?x ? x_{m},
but I'm not sure which is best.
Ultimately, I want to take a function $f$ of two variables, for example
f[x_, n_] := - Sum [Sin[j x] /j, {j, 1, n}],
at the grid points $x$_{ $i$}, and run through the grid, applying the derivative at a point equation (involving two neighbors for each derivative point). Then, after having the first derivative on the entire grid, calculate the second derivative on the grid, involving two first-derivative neighbors. Finally, I want to see the beautiful results on a plot.
I'm sure there will be a do loop, couple arrays, and ListPlot function involved. I'm just not sure how to do all this, as I've just started with Mathematica.
We have any good solutions?