## SymPy – 18 – calcolo infinitesimale – 4 Continuo da qui, copio qui.

Ho avuto un po’ di problemi legati alla versione non aggiornata; chissà se ora è OK 😊
L’aggiornamento l’ho effettuato via Anaconda, seguendo le indicazioni qui.

Inoltre riconsidero anche l’uso della Sympy Live Shell: è lenta e torno a IPython 😊

Differenze finite
So far we have looked at expressions with analytic derivatives and primitive functions respectively. But what if we want to have an expression to estimate a derivative of a curve for which we lack a closed form representation, or for which we don’t know the functional values for yet. One approach would be to use a finite difference approach.

The simplest way the differentiate using finite differences is to use the `differentiate_finite` function: If we want to expand the intermediate derivative we may pass the flag `evaluate=True`: This form however does not respect the product rule.

If you already have a `Derivative` instance, you can use the `as_finite_difference` method to generate approximations of the derivative to arbitrary order: here the first order derivative was approximated around `x` using a minimum number of points (2 for 1st order derivative) evaluated equidistantly using a step-size of 1. We can use arbitrary steps (possibly containing symbolic expressions): If you are just interested in evaluating the weights, you can do so manually: note that we only need the last element in the last sublist returned from `finite_diff_weights`. The reason for this is that the function also generates weights for lower derivatives and using fewer points (see the documentation of `finite_diff_weights` for more details).

If using `finite_diff_weights` directly looks complicated, and the `as_finite_difference` method of Derivative instances is not flexible enough, you can use `apply_finite_diff` which takes order, `x`_list, `y`_list and `x0 as parameters:`  Posta un commento o usa questo indirizzo per il trackback.