www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



digitalmars.D.bugs - Docs: std.math.conj wrong

↑ ↓ ← Daniel Keep <daniel.keep.lists gmail.com> writes:
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/
Apr 08 2007
↑ ↓ → Don Clugston <dac nospam.com.au> writes:
Daniel Keep wrote:
 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
 

Apr 11 2007