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

don't use imag() for second component? #2

Closed
mlubin opened this issue Dec 9, 2013 · 10 comments
Closed

don't use imag() for second component? #2

mlubin opened this issue Dec 9, 2013 · 10 comments

Comments

@mlubin
Copy link
Contributor

mlubin commented Dec 9, 2013

@johnmyleswhite suggested and I agree that it's awkward to use imag to access the second component of the dual number. What about epsilon?

@jwmerrill
Copy link

epsilon is the one I like the best from my list.

@papamarkou
Copy link
Contributor

I agree with the choice of epsilon, it seems a better name indeed. I made the relevant change, so I will now close this issue.

@johnmyleswhite
Copy link

Further to this: is conj standard terminology for using dual numbers?

@papamarkou
Copy link
Contributor

conj may cause some confusion considering that it brings in mind complex conjugate, but if it is standard terminology for dual numbers, then it won't be confusing to users. To me dual sounds a bit more traditional, but I am not sure which one is better. Do you suggest that we change dual to conj?

@mlubin
Copy link
Contributor Author

mlubin commented Dec 9, 2013

I'm a bit confused about conj, abs, abs2, and inv. One should be able to drop in a Dual number into any function that takes a number and have it compute the derivative. Most use cases of dual numbers will be in user functions that don't know what dual numbers are, so the specialized meaning of conj, abs, etc., doesn't seem right.

Consider two different cases:
f(x) = abs(x)
Here to properly compute the derivative of f we want abs(x) = (real(x) >= 0.0) ? x : -x (returns a Dual)
f(x) = abs(x) < 1.0 ? 2x : -x
Here we want the result of abs to be comparable with a float.

Probably the right solution is to have abs return a Dual and implement comparison operators for Dual with Number that compares the real term of the Dual.

@johnmyleswhite
Copy link

I agree with Miles: every generic function should mean the same thing for Dual Numbers as for real numbers.

@papamarkou
Copy link
Contributor

I agree too with Miles' suggestion, John.

@mlubin
Copy link
Contributor Author

mlubin commented Dec 10, 2013

I'll set up a pull request.

@mlubin mlubin mentioned this issue Dec 11, 2013
@goretkin
Copy link

goretkin commented Dec 5, 2014

The readme still talks about the "imaginary" part of Duals

while the imaginary part represents the fermionic direction

@mlubin
Copy link
Contributor Author

mlubin commented Dec 5, 2014

Updated, thanks @goretkin!

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

5 participants