Help / Phrases / 8. E. Complex Numbers
< Help
Jump to navigation
Jump to search
>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Phrases
8E. Complex Numbers
m0=: cnj=: + | Conjugate |
m1=: mag=: | | Magnitude |
m2=:[: %: +*] | " |
m3=: rai=: +. | Real and imaginary parts |
m4=: maa=: *. | Magnitude and angle |
m5=: irai=: rai^:_1 | Inverse rai |
m6=: imaa=: maa^:_1 | Inverse maa |
m7=: rou=: [:^ 0j2p1&% * i. | Roots of unity |
m8=: rpg=: +.@rou | Regular polygon |
m9=: zero=: (* 1e_14 < |)&.+. | Zero either part of y smaller than 1e_14 |
d10=: zd=: (] * 10&^@-@[ < |@])&.(a:`+.) | Zero either part of y less than 10^-x in magnitude |
d11=: zr=: ] * 10&^@-@[ < |@] | Zero any real y less than 10^-x in magnitude |
m12=: zi=:({.,{:*1e_6<%~/@:|)&.+. | Zero imaginary if relatively small |
m13=: (1e_10&$:) : (j./"1@((] * (<:|)) +.)) | Clean y |
The verb zero may be used to zero either part of y that is smaller than 1e_14:
a=: 9.82576e_16j_6.61816e_16 _4.06678e_16j_0.418592 1.63561j_3.51244e_17 zero a 0 0j_0.418592 1.63561
The verb zi may be used to zero any imaginary part that is relatively small compared to the corresponding real part. For example:
(] ,: zi) a=:3+j.10^-2*i. 5 3j1 3j0.01 3j0.0001 3j1e_6 3j1e_8 3j1 3j0.01 3j0.0001 3 3 zi a 3j1 3j0.01 3j0.0001 3 3
Complex numbers can be scaled by multiplication by a real number, and shifted and rotated by addition and multiplication by complex numbers. For example:
]a=: rou 3 Third roots of unity 1 _0.5j0.866025 _0.5j_0.866025 |a Lie on the unit circle 1 1 1 1ad30 Complex of mag 1 and angle of 30 degrees 0.866025j0.5 6&zr@rai&.> (] ; 3j4&+ ; 1ad30&* ; 2ad60&*) a +---------------------------------------------------+ | 1 0| 4 4| 0.866025 0.5| 1 1.73205| | 0.5 0.866025|2.5 4.86603|_0.866025 0.5|_2 0| |_0.5 0.866025|2.5 3.13397| 0 _1| 1 _1.73205| +---------------------------------------------------+ Coordinates Shift by 3,4 Rotate by Rotate by of triangle 30 degrees 60 degrees