# core/complex-1.0.0

Complex number value.

#### Description

Represents a complex number matching the following EBNF grammar

```dot           = "."
plus-or-minus = "+" | "-"
digit         = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
sign          = "" | plus-or-minus
suffix        = "J" | "j" | "I" | "i"
inf           = "inf" | "INF"
nan           = "nan" | "NAN"
number        = digits | dot digits | digits dot digits
sci-suffix    = "e" | "E"
scientific    = number sci-suffix sign digits
real          = sign number | sign scientific
imag          = number suffix | scientific suffix
complex       = real | sign imag | real plus-or-minus imag
```

Though `J`, `j`, `I` and `i` must be supported on reading, it is recommended to use `i` on writing.

For historical reasons, it is necessary to accept as valid complex numbers that are surrounded by parenthesis.

### Schema Definitions ¶

string
No length restriction
Must match the following pattern:
```^(((((([+-]?(([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN)))))|([+-]?(([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+)))|([+-]?(((([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[iIjJ])|((([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+[iIjJ])))|((([+-]?(([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN)))))|([+-]?(([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+))[+-](((([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[iIjJ])|((([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+[iIjJ])))))|(\((((([+-]?(([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN)))))|([+-]?(([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+)))|([+-]?(((([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[iIjJ])|((([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+[iIjJ])))|((([+-]?(([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN)))))|([+-]?(([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+))[+-](((([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[iIjJ])|((([0-9]+)|(\.[0-9]+)|([0-9]+\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+[iIjJ]))))\)))\$
```

### Examples ¶

1 real, -1 imaginary:

```!core/complex-1.0.0 1-1j
```

0 real, 1 imaginary:

```!core/complex-1.0.0 1J
```

-1 real, 0 imaginary:

```!core/complex-1.0.0 -1
```

### Original Schema ¶

```%YAML 1.1
---
\$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/core/complex-1.0.0"
title: Complex number value.
description: |
Represents a complex number matching the following EBNF grammar

```
dot           = "."
plus-or-minus = "+" | "-"
digit         = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
sign          = "" | plus-or-minus
suffix        = "J" | "j" | "I" | "i"
inf           = "inf" | "INF"
nan           = "nan" | "NAN"
number        = digits | dot digits | digits dot digits
sci-suffix    = "e" | "E"
scientific    = number sci-suffix sign digits
real          = sign number | sign scientific
imag          = number suffix | scientific suffix
complex       = real | sign imag | real plus-or-minus imag
```

Though `J`, `j`, `I` and `i` must be supported on reading, it is
recommended to use `i` on writing.

For historical reasons, it is necessary to accept as valid complex numbers
that are surrounded by parenthesis.

examples:
-
- 1 real, -1 imaginary
- "!core/complex-1.0.0 1-1j"
-
- 0 real, 1 imaginary
- "!core/complex-1.0.0 1J"
-
- -1 real, 0 imaginary
- "!core/complex-1.0.0 -1"

tag: "tag:stsci.edu:asdf/core/complex-1.0.0"
type: string
# This regex was automatically generated from a description of a grammar
pattern: "^(((((([+-]?(([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN)))))|([+-]?(([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+)))|([+-]?(((([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[iIjJ])|((([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+[iIjJ])))|((([+-]?(([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN)))))|([+-]?(([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+))[+-](((([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[iIjJ])|((([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+[iIjJ])))))|(\\((((([+-]?(([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN)))))|([+-]?(([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+)))|([+-]?(((([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[iIjJ])|((([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+[iIjJ])))|((([+-]?(([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN)))))|([+-]?(([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+))[+-](((([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[iIjJ])|((([0-9]+)|(\\.[0-9]+)|([0-9]+\\.[0-9]+)|(((inf)|(INF)))|(((nan)|(NAN))))[eE][+-]?[0-9]+[iIjJ]))))\\)))\$"
...
```