Skip to content

Dual type for representing dual numbers and performing dual algebra #2898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

papamarkou
Copy link
Contributor

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 the Complex and Rational types.

The base/dual.jl file has been written in an attempt to conform with base/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.

@pao
Copy link
Member

pao commented Apr 20, 2013

This will need tests whether it gets incorporated into base or ends up living as a package. I'm not sure what kind of edge cases dual numbers get you (I'm unfamiliar with them) but see #2845 for where the complex tests are going.

@papamarkou
Copy link
Contributor Author

Thanks a lot for the advice and the useful link, I will try to generate similar tests. You and the rest of dev team certainly can advice me if it should go in base or in a package.

@StefanKarpinski
Copy link
Member

This is very cool. It should, however, definitely be a package rather than going in base Julia. Complex numbers a standard everyday thing that people learn about in grade school and which get used all the time (we couldn't have FFTs in Base without complex numbers, for example). On the other hand, I had previously never heard of dual numbers. To head off the inevitable naming bikeshed, may I suggest calling the package DualNumbers.jl rather than just Dual.jl, which would be rather ambiguous.

@papamarkou
Copy link
Contributor Author

Yes Stefan, I will call it DualNumbers as you suggested. It is true that dual numbers are not as widely spread as complex ones.

@bsxfan
Copy link

bsxfan commented Apr 22, 2013

I have added a long comment about my own experiences in MATLAB with dual numbers and other automatic differentiation soltuions here: JuliaDiff/ForwardDiff.jl#1 (comment)

@papamarkou
Copy link
Contributor Author

Thank you very much bsxfan, this is very helpful. I followed up with your post. Any further sharing of your experience with AD is much appreciated. Please feel free to contribute, either in terms of coding or in terms of sharing your experience, whichever suits you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants