April 08, 2007 Docs: std.math.conj wrong | ||||
---|---|---|---|---|
| ||||
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/
|
April 11, 2007 Re: Docs: std.math.conj wrong | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Keep | 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
>
This also applied to Tango -- it's now been fixed there.
|
Copyright © 1999-2021 by the D Language Foundation