Stdlib.Complex(3)

πŸ’– Stdlib.Complex(3) πŸ’–

bestie, this is the OCaml library page for Stdlib.Complex β€” the complex-number module that's lowkey serving math main-character energy. it's giving complex-plane couture, no cap ✨


🌸 NAME 🌸

Stdlib.Complex β€” no description (yes, the manpage itself said no description; mysterious icon behavior, we respect it πŸ’…).

πŸŽ€ Module πŸŽ€

Module Stdlib.Complex β€” that's the module we're talking about, periodt.

✨ Documentation ✨

Module Complex : (module Stdlib__Complex) β€” yes bestie, the alias reveal 🫢

type t = {
 re : float ;
 im : float ;
 }

The type of complex numbers. re is the real part and im is the imaginary part. πŸŽ€

  • val zero : t β€” the complex number 0. zero bestie.
  • val one : t β€” the complex number 1. iconic.
  • val i : t β€” the complex number i. imaginary legend behavior.
  • val neg : t -> t β€” unary negation. flip the sign, slay.
  • val conj : t -> t β€” conjugate: given the complex x + i.y, returns x - i.y. mirror moment ✨
  • val add : t -> t -> t β€” addition. putting things together, we love to see it.
  • val sub : t -> t -> t β€” subtraction. taking things away, okay.
  • val mul : t -> t -> t β€” multiplication. math girlies rise.
  • val inv : t -> t β€” multiplicative inverse (1/z). reciprocal realness.
  • val div : t -> t -> t β€” division. sharing is caring but with numbers.
  • val sqrt : t -> t β€” square root. the result x + i.y is such that x > 0 or x = 0 and y >= 0. ⚠️ this function has a discontinuity along the negative real axis. (yes, dramatic but true.)
  • val norm2 : t -> float β€” norm squared: given x + i.y, returns x^2 + y^2. squared, not sorry.
  • val norm : t -> float β€” norm: given x + i.y, returns sqrt(x^2 + y^2). the actual norm vibe check.
  • val arg : t -> float β€” argument. the argument of a complex number is the angle in the complex plane between the positive real axis and a line passing through zero and the number. this angle ranges from -pi to pi. ⚠️ this function has a discontinuity along the negative real axis. angle tea πŸ«–
  • val polar : float -> float -> t β€” polar norm arg returns the complex having norm norm and argument arg. polar coords, cute.
  • val exp : t -> t β€” exponentiation. exp z returns e to the z power. exponential era.
  • val log : t -> t β€” natural logarithm (in base e). log bestie.
  • val pow : t -> t -> t β€” power function. pow z1 z2 returns z1 to the z2 power. raise it up πŸ”₯

mwah β€” OCamldoc, 2026-06-22, Stdlib.Complex(3) πŸ’–

πŸ“¦ where this page comes from