# Difference between revisions of "Complex Numbers"

(added v.4 - fixed interlink) |
|||

Line 6: | Line 6: | ||

{{Example|If you enter the complex number 3 + 4i into the Input Bar, you get the point | {{Example|If you enter the complex number 3 + 4i into the Input Bar, you get the point | ||

(3, 4) in the Graphics View. This point’s coordinates are shown as 3 + 4i in the Algebra View.}} | (3, 4) in the Graphics View. This point’s coordinates are shown as 3 + 4i in the Algebra View.}} | ||

+ | {{Note|1=Complex numbers get displayed as points, whether they are named with upper or lower case letters.}} | ||

{{Note|You can display any point as a complex number in the [[Algebra View]]. Open the [[Properties Dialog]] for the point and select Complex Number from the list of Coordinates formats on tab Algebra.}} | {{Note|You can display any point as a complex number in the [[Algebra View]]. Open the [[Properties Dialog]] for the point and select Complex Number from the list of Coordinates formats on tab Algebra.}} | ||

## Revision as of 13:58, 26 July 2011

GeoGebra does not support complex numbers directly, but you may use points or vectors to simulate operations with complex numbers.

**Example:**If you enter the complex number 3 + 4i into the Input Bar, you get the point (3, 4) in the Graphics View. This point’s coordinates are shown as 3 + 4i in the Algebra View.

**Note:**Complex numbers get displayed as points, whether they are named with upper or lower case letters.

**Note:**You can display any point as a complex number in the Algebra View. Open the Properties Dialog for the point and select Complex Number from the list of Coordinates formats on tab Algebra.

If the variable i has not already been defined, it is recognized as the ordered pair i = (0, 1) or the complex number 0 + 1i. This also means, that you can use this variable i in order to type complex numbers into the Input Bar (e. g., q = 3 + 4i).

**Example:**Addition and subtraction:

- (2 + 1i) + (1 – 2i) gives you the complex number 3 – 1i.
- (2 + 1i) - (1 – 2i) gives you the complex number 1 + 3i.

**Example:**Multiplication and division:

- (2 + 1i) * (1 – 2i) gives you the complex number 4 – 3i.
- (2 + 1i) / (1 – 2i) gives you the complex number 0 + 1i.

**Note:**The usual multiplication (2, 1)*(1, -2) gives you the scalar product of the two vectors.

GeoGebra also recognizes expressions involving real and complex numbers.

**Example:**

- 3 + (4 + 5i) gives you the complex number 7 + 5i.
- 3 - (4 + 5i) gives you the complex number -1 - 5i.
- 3 / (0 + 1i) gives you the complex number 0 - 3i.
- 3 * (1 + 2i) gives you the complex number 3 + 6i.

## Comments

## Workaround: IsComplex[][edit]

Sometimes you may want to check if a number is treated as complex number in GeoGebra, as function such as `x()`

and `y()`

do not work with real numbers. As there is no such command as `IsComplex`

you currently have to employ a small trick to check if the number `a`

is complex: `complex = IsDefined[sqrt(a) + sqrt(-a)] ∧ (a ≠ 0)`

.

**Note:**Complex with imaginary part 0, like

`a = 2 + 0i`

, also pass this test. If you just want to check if the imaginary part of a complex number `a`

is not 0 you can use `y(a) != 0`

.