Complex(3)

✨ NAME ✨

okay so bestie, this is literally Complex from the OCaml library πŸ’– and it is about Complex numbers. no cap, that is the whole name vibe. we are keeping every single detail, periodt.


πŸŽ€ Module πŸŽ€

the module is literally Module Complex, and its signature opens with : sig end β€” that is the whole shape of it, bestie 🫢.


πŸ’– Documentation πŸ’–

Complex numbers. this module provides arithmetic operations on complex numbers. Complex numbers are represented by their real and imaginary parts (cartesian representation). each part is represented by a double-precision floating-point number (type float). slay, that is the whole setup ✨.

the type is giving record realness:

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

this is the type of complex numbers. re is the real part and im is the imaginary part. iconic little pair, no notes πŸ’….

  • val zero : t β€” the complex number 0. πŸ“
  • val one : t β€” the complex number 1. 🌸
  • val i : t β€” the complex number i. πŸ¦‹
  • val neg : t -> t β€” unary negation. πŸ™ˆ
  • val conj : t -> t β€” conjugate: given the complex x + i.y, returns x - i.y. πŸ’«
  • val add : t -> t -> t β€” addition. βž•
  • val sub : t -> t -> t β€” subtraction. βž–
  • val mul : t -> t -> t β€” multiplication. βœ–οΈ
  • val inv : t -> t β€” multiplicative inverse (1/z). πŸ”„
  • val div : t -> t -> t β€” division. βž—
  • 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. ⚠️
  • val norm2 : t -> float β€” norm squared: given x + i.y, returns x^2 + y^2. πŸ”₯
  • val norm : t -> float β€” norm: given x + i.y, returns sqrt(x^2 + y^2). 🌈
  • 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. ⭐
  • val polar : float -> float -> t β€” polar norm arg returns the complex having norm norm and argument arg. πŸŽ€
  • val exp : t -> t β€” exponentiation. exp z returns e to the z power. πŸ‘‘
  • val log : t -> t β€” natural logarithm (in base e). 🌿
  • val pow : t -> t -> t β€” power function. pow z1 z2 returns z1 to the z2 power. πŸ’₯

okay that is the whole page bestie β€” source/version is OCamldoc, date is 2026-06-22, and the page is Complex(3). mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from