Skip to content

Commit

Permalink
test: used a simple example where we can use de Moivre's theorem.
Browse files Browse the repository at this point in the history
  • Loading branch information
hemalvarambhia committed Jan 6, 2024
1 parent 1d5f065 commit 9b8c274
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Math-Tests-Complex/PMComplexNumberTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,15 @@ PMComplexNumberTest >> testRaisedTo [

{ #category : #'testing - mathematical functions' }
PMComplexNumberTest >> testRaisedToInteger [
| c c3 |
| c c3 z expected |
c := 5 - 6 i.
c3 := c * c * c.
self assert: (c raisedTo: 3) equals: c3.
self assert: (c raisedToInteger: -3) equals: c3 reciprocal.

z := (3 sqrt / 2) + (1/2) i.
"Here, we appeal to de Moivre's theorem to compute the expected answer"
expected := 0 + 1 i.
self assert: (z raisedTo: 3) closeTo: expected.
]

{ #category : #tests }
Expand Down

0 comments on commit 9b8c274

Please sign in to comment.