fix complex_test.v
parent
208f17a73a
commit
432e074b4e
|
@ -125,15 +125,15 @@ fn test_complex_angle(){
|
||||||
// Test is based on and verified from practice examples of Khan Academy
|
// Test is based on and verified from practice examples of Khan Academy
|
||||||
// https://www.khanacademy.org/math/precalculus/imaginary-and-complex-numbers
|
// https://www.khanacademy.org/math/precalculus/imaginary-and-complex-numbers
|
||||||
mut c := cmplx.complex(1, 0)
|
mut c := cmplx.complex(1, 0)
|
||||||
assert (c.angle() * 180 / math.Pi).eq(0)
|
assert (c.angle() * 180 / math.pi).eq(0)
|
||||||
c = cmplx.complex(1, 1)
|
c = cmplx.complex(1, 1)
|
||||||
assert (c.angle() * 180 / math.Pi).eq(45)
|
assert (c.angle() * 180 / math.pi).eq(45)
|
||||||
c = cmplx.complex(0, 1)
|
c = cmplx.complex(0, 1)
|
||||||
assert (c.angle() * 180 / math.Pi).eq(90)
|
assert (c.angle() * 180 / math.pi).eq(90)
|
||||||
c = cmplx.complex(-1, 1)
|
c = cmplx.complex(-1, 1)
|
||||||
assert (c.angle() * 180 / math.Pi).eq(135)
|
assert (c.angle() * 180 / math.pi).eq(135)
|
||||||
c = cmplx.complex(-1, -1)
|
c = cmplx.complex(-1, -1)
|
||||||
assert (c.angle() * 180 / math.Pi).eq(-135)
|
assert (c.angle() * 180 / math.pi).eq(-135)
|
||||||
mut cc := c.conjugate()
|
mut cc := c.conjugate()
|
||||||
assert (cc.angle() + c.angle()).eq(0)
|
assert (cc.angle() + c.angle()).eq(0)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue