Docs: std.math.conj wrong

Daniel Keep daniel.keep.lists at gmail.com
Sun Apr 8 02:08:28 PDT 2007


The documentation for std.math.conj states:

 `` Note that z * conj(z) = z.re^2 - z.im^2 is always a real number ''

This *should* say:

 `` Note that z * conj(z) = z.re^2 + z.im^2 is always a real number ''

Proof:

given
        z = x + iy
  conj(z) = x - iy

then
z*conj(z) = (x + iy)(x - iy)
          = x^2 - ixy + ixy - (i^2 y^2)  -- Two ixy's cancel out
          = x^2 - ((-1)y^2)  -- i^2 = (-1)
          = x^2 - (-y^2)
          = x^2 + y^2
            QED

As far as I can tell, this is purely a documentation issue, not a code one.

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/


More information about the Digitalmars-d-bugs mailing list