Finite difference derivative approximations.

class openmdao.approximation_schemes.finite_difference.FDForm

Bases: tuple


x.__contains__(y) <==> y in x


x.__getitem__(y) <==> x[y]


x.__init__(...) initializes x; see help(type(x)) for signature

__iter__() <==> iter(x)

Alias for field number 1

count(value) → integer -- return number of occurrences of value

Alias for field number 2


Alias for field number 0

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

class openmdao.approximation_schemes.finite_difference.FiniteDifference[source]

Bases: openmdao.approximation_schemes.approximation_scheme.ApproximationScheme

Approximation scheme using finite differences to estimate derivatives.

For example, using the ‘forward’ form with a step size of ‘h’ will approximate the derivative in the following way:

\[f'(x) = \frac{f(x+h) - f(x)}{h} + O(h).\]

Initialize the ApproximationScheme.

add_approximation(abs_key, kwargs)[source]

Use this approximation scheme to approximate the derivative d(of)/d(wrt).


abs_key : tuple(str,str)

Absolute name pairing of (of, wrt) for the derivative.

kwargs : dict

Additional keyword arguments, to be interpreted by sub-classes.

compute_approximations(system, jac=None, deriv_type='partial')[source]

Execute the system to compute the approximate sub-Jacobians.


system : System

System on which the execution is run.

jac : None or dict-like

If None, update system with the approximated sub-Jacobians. Otherwise, store the approximations in the given dict-like object.

deriv_type : str

One of ‘total’ or ‘partial’, indicating if total or partial derivatives are being approximated.