Open novacrazy opened 6 years ago
This "colloquial proof" Math@SE answer is quite convincing. It seems to provide an analogous answer and derivation to what Wolfram Alpha gives for the complex modulo. I'll further note that this paper, Fike et al. 2011, seems to imply in Part II that dual numbers are a type of complex number, and, more importantly, this paper, Rooney 1978, states that dual numbers are one of three types of complex numbers as well.
Therefore, I suppose that an implementation of the remainder and modulus of a dual number ought to be similar to that of an ordinary complex number.
Would you like to add this before the next release?
Sure can do. I can start working on it in about twelve hours.
On Thu, Jun 28, 2018, 07:18 Aaron Trent notifications@github.com wrote:
Would you like to add this before the next release?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/novacrazy/dual_num/issues/3#issuecomment-401031564, or mute the thread https://github.com/notifications/unsubscribe-auth/AEma6OV5NHFYMDZ0LE3DKDr_HvU3rxkYks5uBNe8gaJpZM4UrMNg .
In Rust's implementation of Complex numbers, the remainder is defined as an attempt to find the closest Gaussian integers of that complex number. As what seems like a short cut, it is defined for all types T: Clone + Num
, regardless of whether they are integers or rationals. (I'll note that there is an "extension" of Gaussian integers to Gaussian rationals, but at first glance, it still does require (a, b) to be integers, i.e. Gaussian rationals are limited to the subset of Gaussian integers. Note that I have asked for clarification of the implementation on num-complex
.)
Also note that, as linked above, there is a mathematical notion of a modulus for dual numbers, but this is a modulus in the definition of a norm of number represented by two parts, not as the modulus corresponding to the quotient definition.
As I am unsure about the mathematical validity of the remainder operation of dual numbers, I will stall on this implementation for now. I therefore think that we ought to publish version 0.2.0
as is without the implementation of the remainder operation. We can always update the crate when we find a good mathematical proof that the remainder is valid for dual numbers.
I have never been able to find a valid implementation of
Rem
for dual numbers, if an implementation even exists.If anyone has any knowledge on this it would be greatly appreciated!