Arithmetic/Complex: Difference between revisions
Content added Content deleted
(→{{header|OCaml}}: link) |
m (→{{header|J}}: Add lang tags) |
||
Line 830: | Line 830: | ||
=={{header|J}}== |
=={{header|J}}== |
||
Complex numbers are a native numeric data type in J. Although the examples shown here are performed on scalars, all numeric operations naturally apply to arrays of complex numbers. |
Complex numbers are a native numeric data type in J. Although the examples shown here are performed on scalars, all numeric operations naturally apply to arrays of complex numbers. |
||
x=: 1j1 |
<lang j> x=: 1j1 |
||
y=: 3.14159j1.2 |
|||
x+y |
|||
4.14159j2.2 |
|||
x*y |
|||
1.94159j4.34159 |
|||
%x |
|||
0.5j_0.5 |
|||
-x |
|||
_1j_1 |
|||
</lang> |
|||
=={{header|Java}}== |
=={{header|Java}}== |