https://github.com/erikqqy/complexdiff.jl
Complex Step Differentiation in Julia
https://github.com/erikqqy/complexdiff.jl
complex-step-differentiation derivative high-performance-computing julia multi-complex
Last synced: about 1 year ago
JSON representation
Complex Step Differentiation in Julia
- Host: GitHub
- URL: https://github.com/erikqqy/complexdiff.jl
- Owner: ErikQQY
- License: mit
- Created: 2021-11-12T14:29:21.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-28T15:48:33.000Z (over 4 years ago)
- Last Synced: 2025-03-02T16:09:00.881Z (about 1 year ago)
- Topics: complex-step-differentiation, derivative, high-performance-computing, julia, multi-complex
- Language: Julia
- Homepage: https://ErikQQY.github.io/ComplexDiff.jl/dev
- Size: 131 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ComplexDiff.jl
[](https://ErikQQY.github.io/ComplexDiff.jl/stable)
[](https://ErikQQY.github.io/ComplexDiff.jl/dev)
[](https://github.com/ErikQQY/ComplexDiff.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/ErikQQY/ComplexDiff.jl)
ComplexDiff.jl fully utilize the complex step differentiation to compute accurate and high order derivative.
### Get start
```julia
pkg> add ComplexDiff
```
### High precision derivative computing
While there are [round-off error](https://en.wikipedia.org/wiki/Round-off_error) when we are using [finite difference](https://en.wikipedia.org/wiki/Finite_difference) to get derivative, by using Complex Step Differentiation, we can obtain extremely high precision derivative.
```julia
julia> using ComplexDiff
julia> derivative(sin, 1, 1e-15)
0.5403023058681398
```
### Jacobian and Hessian
It is also very easy to compute Jacobian matrix and Hessian matrix using complex step differentiation:
```julia
julia> jacobian(sin, [1, 2, 3], 0.0000001)
3×3 Matrix{Float64}:
0.540302 0.0 0.0
0.0 -0.416147 0.0
0.0 0.0 -0.989992
```
## References
If you are also interested in Complex Step Differentiation, please see the following papers:
* [Computation of higher-order derivatives using the multi-complex step method](https://folk.ntnu.no/preisig/HAP_Specials/AdvancedSimulation_files/2014/AdvSim-2014__Verheule_Adrian_Complex_differenetiation.pdf)
* [Using Multicomplex Variables for Automatic Computation of High-Order](https://www.researchgate.net/publication/240637774_Using_Multicomplex_Variables_for_Automatic_Computation_of_High-Order_Derivatives)