# How to use the numdifftools.multicomplex.bicomplex function in numdifftools

## To help you get started, weâ€™ve selected a few numdifftools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

pbrod / numdifftools / numdifftools / nd_cstep.py View on Github
``````def _multicomplex2(f, fx, x, h, *args, **kwds):
z = bicomplex(x + 1j * h, h)
return f(z, *args, **kwds).imag12``````
pbrod / numdifftools / numdifftools / nd_cstep.py View on Github
``````def _multicomplex2(f, fx, x, h, *args, **kwargs):
'''Calculate Hessian with bicomplex-step derivative approximation
'''
n = len(x)
ee = np.diag(h)
hess = np.outer(h, h)
for i in range(n):
for j in range(i, n):
zph = bicomplex(x + 1j * ee[i, :], ee[j, :])
hess[i, j] = (f(zph, *args, **kwargs)).imag12 / hess[j, i]
hess[j, i] = hess[i, j]
return hess``````
pbrod / numdifftools / numdifftools / nd_cstep.py View on Github
``````def _multicomplex2(f, fx, x, h, *args, **kwds):
n = len(x)
increments = np.identity(n) * h
partials = [f(bicomplex(x + 1j * hi, hi), *args, **kwds).imag12
for hi in increments]
return np.array(partials)``````
pbrod / numdifftools / numdifftools / nd_cstep.py View on Github
``````def _multicomplex(f, fx, x, h, *args, **kwds):
n = len(x)
increments = np.identity(n) * 1j * h
partials = [f(bicomplex(x + hi, 0), *args, **kwds).imag
for hi in increments]
return np.array(partials).T``````
pbrod / numdifftools / numdifftools / nd_cstep.py View on Github
``````def _multicomplex(f, fx, x, h, *args, **kwds):
z = bicomplex(x + 1j * h, 0)
return f(z, *args, **kwds).imag``````

## numdifftools

Solves automatic numerical differentiation problems in one or more variables.

BSD-3-Clause