Skip to content
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

Argument of a Dual Number #42

Open
safiire opened this issue Oct 22, 2016 · 2 comments
Open

Argument of a Dual Number #42

safiire opened this issue Oct 22, 2016 · 2 comments

Comments

@safiire
Copy link

safiire commented Oct 22, 2016

The following method always seems to return 0 + 0ɛ for positive duals.

angle{T<:Real}(z::DualNumbers.Dual{T})
angle{T<:Real}(z::Dual{T}) = z ≥ 0 ? zero(z) : one(z)*π

This is a lot different than the definition of argument that I'm familiar with. In the generalized complex numbers, parameterized by p and q:
z = x + iy (x, y ∈ R) where i^2 =iq + p (q, p ∈ R)

(so i, ɛ, λ, whatever we call the imaginary unit)

Ignoring q and setting it to zero, and setting p = 0 we get the Dual numbers, p = 1 gives Double numbers, and p = -1 giving the regular Complex numbers. There is a general definition for angle or argument, magnitude or norm, and a very weird concept of unit circle, that is only actually what you would call a circle for p = -1.

unit-circles

So the unit "circle" is everywhere ||z|| = 1, which for duals is just at 1 and -1.

So for duals the argument is y / x. I will link to a paper, and just paste an image of the relevant part here.

argument

Here is a link to the paper this is from:
https://people.rit.edu/harkin/research/articles/generalized_complex_numbers.pdf

The paper also shows how to implement the sinp, cosp, and tanp trig functions for any value of p.

@dlfivefifty
Copy link
Collaborator

angle refers to the argument in the complex plane, and so the current definition is correct as the argument does not change if we perturb a real number by a small real ε perturbation. Two other examples:

angle(dual(im,im)) # returns π/2+0ε as the argument stays fixed
angle(dual(1,im)) # returns 0+ε as the argument changes

@dlfivefifty
Copy link
Collaborator

Your proposed angle could be implemented as a separate function DualNumbers.dualangle. Overriding Base.angle would be confusing in the context of complex numbers. This confusion is the reason that Base.real overrides were replaced with DualNumbers.realpart.

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

No branches or pull requests

2 participants