| Home | | | Quick start | | | Cookbook | | | All symbols | | | Analytical index | | | Namespaces | | | Syntax | | | Statements | | | CX | | | Frequency | | | Functions | | | Examples | | | Examples by command |
The CX. namespace adds scalar complex arithmetic without changing the Basic expression parser. Complex values live in a dedicated runtime table and are manipulated with explicit commands, which keeps existing scripts stable and avoids ambiguous syntax such as z = 3 + 4i.
CX.SET or CX.FROM_POLAR, operate with CX.ADD/CX.MUL/CX.CONJ, then bridge back to normal numeric variables with CX.RE, CX.IM, CX.ABS or CX.ARG.CX.CLEAR
CX.SET z, 3, 4
CX.CONJ zc, z
CX.MUL power, z, zc
CX.RE p, power
CX.ABS r, z
CX.ARG phi, z
PRINT "power=", p, " radius=", r, " phase=", phiCX.ABS result, z
Stores the modulus |z| in a normal numeric variable.
CX.ABS r, zCX.ADD dst, a, b
Computes dst = a + b for two scalar complex variables.
CX.ADDCX.ADD_REAL dst, z, x
Computes dst = z + x where x is a normal real expression.
CX.ADD_REALCX.ARG result, z
Stores the phase angle arg(z), in radians, in a normal numeric variable.
CX.ARG phi, zCX.CLEAR
Clears all scalar complex variables stored in the CX runtime table.
CX.CLEARCX.CONJ dst, z
Computes the complex conjugate of z.
CX.CONJ zc, z
CX.MUL power, z, zcCX.COPY dst, src
Copies a scalar complex variable.
CX.COPY z2, zCX.COS dst, z
Computes the complex cosine.
CX.COSCX.DELETE name
Deletes one scalar complex variable if it exists.
CX.DELETECX.DIV dst, a, b
Computes dst = a / b for two scalar complex variables. Division by a zero complex value is rejected.
CX.DIVCX.DIV_REAL dst, z, x
Computes dst = z / x where x is a normal real expression. Division by zero is rejected.
CX.DIV_REALCX.EXISTS name, result
Writes 1 to result when the named scalar complex variable exists, otherwise 0.
CX.EXISTS z, ok
ASSERT ok = 1CX.EXP dst, z
Computes the complex exponential exp(z).
CX.SET ipi, 0, 3.141592653589793
CX.EXP euler, ipiCX.FROM_POLAR dst, radius, angle
Creates a scalar complex variable from polar coordinates. The radius must be non-negative and the angle is in radians.
CX.FROM_POLAR z, 5, 0.927295218CX.FROM_RE_IM dst, re, im
Creates a scalar complex variable from rectangular coordinates. Alias-friendly companion of CX.SET.
CX.FROM_RE_IM z, 3, 4CX.IM result, z
Stores the imaginary part of z in a normal numeric variable.
CX.IM im, zCX.INV dst, z
Computes dst = 1/z. Division by a zero complex value is rejected.
CX.INVCX.LIST
Prints all scalar complex variables currently stored in the CX runtime table.
CX.LISTCX.LOG dst, z
Computes the principal complex logarithm log(z).
CX.LOGCX.MUL dst, a, b
Computes dst = a * b for two scalar complex variables.
CX.MUL p, z, zcCX.MUL_REAL dst, z, x
Computes dst = z * x where x is a normal real expression.
CX.MUL_REALCX.NEG dst, z
Computes dst = -z.
CX.NEGCX.NORM result, z
Stores squared modulus re*re + im*im in a normal numeric variable.
CX.NORM n2, zCX.POLAR dst, radius, angle
Alias of CX.FROM_POLAR.
CX.POLAR z, 5, 0.927295218CX.POW_REAL dst, z, exponent
Raises z to a real-valued exponent. Complex exponents are intentionally not parsed in this first CX layer.
CX.POW_REALCX.PRINT name
Prints a scalar complex variable in readable real/imaginary form.
CX.SET z, 3, 4
CX.PRINT zCX.RE result, z
Stores the real part of z in a normal numeric variable.
CX.RE re, zCX.SET name, re, im
Creates or replaces a scalar complex variable from real and imaginary parts.
CX.SET z, 3, 4
CX.PRINT zCX.SIN dst, z
Computes the complex sine.
CX.SINCX.SQRT dst, z
Computes the principal complex square root.
CX.SET z, 3, 4
CX.SQRT root, zCX.SUB dst, a, b
Computes dst = a - b for two scalar complex variables.
CX.SUBCX.SUB_REAL dst, z, x
Computes dst = z - x where x is a normal real expression.
CX.SUB_REALCX.TAN dst, z
Computes the complex tangent.
CX.TANCX.TO_POLAR z, radiusResult, angleResult
Stores modulus and phase angle, in radians, in two normal numeric variables.
CX.TO_POLAR z, r, phiCX.TO_RE_IM z, reResult, imResult
Stores real and imaginary parts of z in two normal numeric variables.
CX.TO_RE_IM z, re, im