Complex
A complex number, i.e. an element of the algebraic closure of the real numbers.
struct Complex
A complex number, i.e. an element of the algebraic closure of the real numbers.
struct Complex
import Utils
protocol Absolutable
protocol Addable
protocol AdditiveArithmetic : Equatable
A type with values that support addition and subtraction.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Divisible
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByFloatLiteral
A type that can be initialized with a floating-point literal.
protocol ExpressibleByIntegerLiteral
A type that can be initialized with an integer literal.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Multipliable
protocol Negatable
Describes a (signed) type that has an additive inverse.
protocol Numeric : AdditiveArithmetic, ExpressibleByIntegerLiteral
A type with values that support multiplication.
protocol Sendable
protocol SignedNumeric : Numeric
A numeric type with a negation operation.
protocol Subtractable
init(_ real: Double = 0, i imag: Double = 0)
init<T>(exactly value: T) where T : BinaryInteger
init(floatLiteral value: Double)
init(integerLiteral value: Int)
static let i: Complex
var absolute: Double { get }
var conjugate: Complex { get }
var description: String { get }
var exp: Complex { get }
var imag: Double
var magnitude: Double { get }
var magnitudeSquared: Double { get }
var real: Double
var squared: Complex { get }
static func * (lhs: Complex, rhs: Complex) -> Complex
static func * (lhs: Complex, rhs: Double) -> Complex
static func * (lhs: Complex, rhs: Int) -> Complex
static func *= (lhs: inout Complex, rhs: Complex)
static func + (lhs: Complex, rhs: Complex) -> Complex
static func += (lhs: inout Complex, rhs: Complex)
static func - (operand: Complex) -> Complex
static func - (lhs: Complex, rhs: Complex) -> Complex
static func -= (lhs: inout Complex, rhs: Complex)
static func / (lhs: Complex, rhs: Complex) -> Complex
static func / (lhs: Complex, rhs: Double) -> Complex
static func / (lhs: Complex, rhs: Int) -> Complex
static func /= (lhs: inout Complex, rhs: Complex)
func equals(_ rhs: Complex, accuracy: Double) -> Bool
mutating func negate()
static var zero: Self { get }
The zero value.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
static func + (x: Self) -> Self
Returns the given number unchanged.
static func += (lhs: inout Self, rhs: Self)
static func - (operand: Self) -> Self
Returns the additive inverse of the specified value.
static func -= (lhs: inout Self, rhs: Self)
mutating func negate()
Replaces this value with its additive inverse.