object-oriented programming from math import expsinpi def ( )return exp(- )*sin( *pi*xdfdx derivative(fprint(dfdx( )howevernumerous other formulas can be used for numerical differentiationfor instance ( hf (xo( ) (xf ( ho( ) (xh ( hf ( ho( ) ( ( hf ( ( hf ( ho( ) ( ( hf ( ( hf ( hf ( ( hf ( ho( ) ( hf ( hf (xf ( ho( (xh (xwe can easily make module that offers multiple formulasas followsclass forward def __init__(selffh= - )self fself fh def __call__(selfx)fh self fself return ( ( +hf( ))/ class central def __init__(selffh= - )self fself fh def __call__(selfx)fh self fself return ( ( +hf( - ))/( *hclass central def __init__(selffh= - )self fself fh def __call__(selfx)fh self fself return ( / )*( ( +hf( - )/( *