Dual type for representing dual numbers and performing dual algebra #2898
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dual numbers extend the real numbers, similar to complex numbers. They adjoin a new element du such that du_du=0, in a similar way that complex numbers adjoin the imaginary unit i with the property i_i=-1. Apart from their mathematical interest in algebraic and differential geometry (they are mainly interpreted as angles between lines), they also find applications in physics (the real part of a dual represents the bosonic direction, while the imaginary part represents the fermionic direction), in screw theory, in motor and spatial vector algebra, and in computer science due to its relation with the forward mode of automatic differentiation. Due to its links with theory and application, it may be useful for Julia to ship with the
Dual
type, as an addition to theComplex
andRational
types.The
base/dual.jl
file has been written in an attempt to conform withbase/complex.jl
.This is the first time I make an attempt to contribute to the core of Julia (as opposed to writing a package), so forgive me for any omissions or mistakes in case I haven't followed the protocol entirely correctly.