Arithmetic/Complex: Difference between revisions

Content added Content deleted
(→‎{{header|TI-89 BASIC}}: fix example damaged by stripping TI Uni font)
Line 1,341: Line 1,341:
The choice of examples here is {{trans|Common Lisp}}.
The choice of examples here is {{trans|Common Lisp}}.


<lang ti89b>■ √(–1) 
<!--lang ti89b--><pre style="font-family: 'TI Uni';">■ √(–1) 
■ ^2 —1
■ ^2 —1
■  + 1 1 + 
■  + 1 1 + 
Line 1,349: Line 1,349:
■ 1/(2) —1 - 
■ 1/(2) —1 - 
■ real(1 + 2) 1
■ real(1 + 2) 1
■ imag(1 + 2) 2</lang>
■ imag(1 + 2) 2</pre>


Complex numbers can also be entered and displayed in polar form. (This example shows input in polar form while the complex display mode is rectangular and the angle mode is radians).
Complex numbers can also be entered and displayed in polar form. (This example shows input in polar form while the complex display mode is rectangular and the angle mode is radians).


<lang ti89b>■ (1∠π/4)
<!--lang ti89b--><pre style="font-family: 'TI Uni';">■ (1∠π/4)
√(2)/2 + √(2)/2*</lang>
√(2)/2 + √(2)/2*</pre>


Note that the parentheses around ∠ notation are required. It has a related use in vectors: (1∠π/4) is a complex number, [1,∠π/4] is a vector in two dimensions in polar notation, and [(1∠π/4)] is a complex number in a vector.
Note that the parentheses around ∠ notation are required. It has a related use in vectors: (1∠π/4) is a complex number, [1,∠π/4] is a vector in two dimensions in polar notation, and [(1∠π/4)] is a complex number in a vector.