# LLM Prompt for Documentation ## Documentation ### Math #### exp **Type Annotation** ```roc F64 -> F64 ``` **Description** The [natural exponential function](https://en.wikipedia.org/wiki/Exponential_function), the inverse of the [naturalLog] function. #### reciprocal **Type Annotation** ```roc Num * -> F64 ``` **Description** The [multiplicative inverse function](https://en.wikipedia.org/wiki/Multiplicative_inverse), defined as x⁻¹ = 1/x. #### natural_log **Type Annotation** ```roc F64 -> F64 ``` **Description** The [natural logarithm function](https://en.wikipedia.org/wiki/natural_logarithm), the inverse of the [exp] function. #### sigmoid **Type Annotation** ```roc Num * -> F64 ``` **Description** The [standard logistic function](https://en.wikipedia.org/wiki/Logistic_function), defined as S(x) = eˣ / (eˣ + 1). #### relu **Type Annotation** ```roc Num a -> Num a ``` **Description** The [rectified linear unit activation](https://en.wikipedia.org/wiki/Rectifier_(neural_networks)) (ReLU) function. #### sign **Type Annotation** ```roc F64 -> [ PositiveNumber, NegativeNumber, Zero, NaN, PositiveInfinity, NegativeInfinity ] ``` **Description** A variant of the [mathematical sign function](https://en.wikipedia.org/wiki/Sign_function) that handles `NaN` and infinity values. #### sign_int **Type Annotation** ```roc Int * -> [ PositiveNumber, NegativeNumber, Zero ] ``` **Description** The [sign function](https://en.wikipedia.org/wiki/Sign_function) for integers. For getting the sign of a floating-point number, use the [sign] function instead. ### Angle #### Angle **Type Annotation** **Description** An angle, in either radians, degrees, turns or gon (also called gradians). #### to_radians **Type Annotation** ```roc Angle -> [Radians F64] ``` **Description** Convert an angle to radians. #### to_degrees **Type Annotation** ```roc Angle -> [Degrees F64] ``` **Description** Convert an angle to degrees. #### to_turns **Type Annotation** ```roc Angle -> [Turns F64] ``` **Description** Convert an angle to turns. #### to_gon **Type Annotation** ```roc Angle -> [Gon F64] ``` **Description** Convert an angle to gon. #### is_approx_eq **Type Annotation** ```roc Angle, Angle, { rtol ? F64, atol ? F64 } -> Bool ``` **Description** Check if two angles are approximately equal. The tolerance values apply to the angles when converted to radians. #### is_nan **Type Annotation** ```roc Angle -> Bool ``` #### to_str **Type Annotation** ```roc Angle -> Str ``` ### Arithmetic #### gcd **Type Annotation** ```roc U64, U64 -> U64 ``` **Description** The [greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor) of two positive integers `a` and `b` is the largest integer that divides both `a` and `b`. #### lcm **Type Annotation** ```roc U64, U64 -> U64 ``` **Description** The [least common multiple](https://en.wikipedia.org/wiki/Least_common_multiple) of two positive integer `a` and `b` is the smallest positive integer that is a multiple of both `a` and `b`. #### divides **Type Annotation** ```roc I64, I64 -> Bool ``` **Description** An integer `a` divides another integer `b` if and only if there exists an integer `c` such that `a * c = b` #### divisors **Type Annotation** ```roc U64 -> List U64 ``` **Description** The positive [divisors](https://en.wikipedia.org/wiki/Divisor) of a positive integer `n` are all the positive numbers that divide `n` with no remainder, including `n` itself. To get the divisors of `n` excluding `n` itself, see [properDivisors]. #### proper_divisors **Type Annotation** ```roc U64 -> List U64 ``` **Description** The [proper divisors](https://en.wikipedia.org/wiki/Divisor) of a positive integer `n` are all the positive numbers that divide `n` with no remainder, excluding `n` itself. To get the divisors of `n` including `n` itself, see [divisors]. #### is_prime **Type Annotation** ```roc U64 -> Bool ``` #### prime_factors **Type Annotation** ```roc U64 -> List U64 ``` **Description** The [prime factors](https://en.wikipedia.org/wiki/Prime_factor) of a positive integer `n` are the prime numbers that divide `n` exactly. #### is_perfect **Type Annotation** ```roc U64 -> Bool ``` **Description** A [perfect number](https://en.wikipedia.org/wiki/Perfect_number) is a positive integer that is equal to the sum of its proper divisors, excluding itself. ### Combinatorics #### factorial **Type Annotation** ```roc U64 -> U64 ``` **Description** The [factorial](https://en.wikipedia.org/wiki/Factorial) of `n` is product of all the integers from 1 to `n`. #### choose **Type Annotation** ```roc U64, U64 -> U64 ``` **Description** The [binomial coefficient](https://en.wikipedia.org/wiki/Binomial_coefficient), the number of ways of choosing `k` things from a collection of size `n`. ### Complex #### Complex **Type Annotation** **Description** A complex number z = x + yi, where i = √-1. #### i **Type Annotation** ```roc Complex ``` **Description** The imaginary unit. #### zero **Type Annotation** ```roc Complex ``` **Description** The complex number z = 0 + 0i. #### from_real **Type Annotation** ```roc Num * -> Complex ``` **Description** Convert a number x to a complex number z = x + 0i. #### from_imag **Type Annotation** ```roc Num * -> Complex ``` **Description** Convert a number y to a complex number z = 0 + yi. #### from_tuple **Type Annotation** ```roc ( Num *, Num * ) -> Complex ``` **Description** Convert two numbers x and y to a complex number z = x + yi. The inverse of [toTuple]. #### to_tuple **Type Annotation** ```roc Complex -> ( F64, F64 ) ``` **Description** Convert a complex number z = x + yi to a tuple `(x, y)`. The inverse of [fromTuple]. #### add **Type Annotation** ```roc Complex, Complex -> Complex ``` **Description** Add two complex numbers together. #### sub **Type Annotation** ```roc Complex, Complex -> Complex ``` **Description** Subtract one complex number from another. #### mul **Type Annotation** ```roc Complex, Complex -> Complex ``` **Description** Multiply two complex numbers together. #### div **Type Annotation** ```roc Complex, Complex -> Complex ``` **Description** Divide one complex number by another. #### reciprocal **Type Annotation** ```roc Complex -> Complex ``` **Description** The reciprocal of a non-zero complex number. #### abs **Type Annotation** ```roc Complex -> F64 ``` **Description** The absolute value of a complex number, which is the distance from 0. Defined as |x + yi| = √x² + y². #### arg **Type Annotation** ```roc Complex -> F64 ``` **Description** The argument of a complex number, the angle from the positive x-axis. #### to_polar **Type Annotation** ```roc Complex -> { r : F64, arg : F64 } ``` **Description** Convert a complex number to polar form. #### is_approx_eq **Type Annotation** ```roc Complex, Complex, { rtol ? F64, atol ? F64 } -> Bool ``` **Description** Check if two complex numbers are approximately equal. ### Const #### pi **Type Annotation** ```roc F64 ``` **Description** The circle constant [π](https://en.wikipedia.org/wiki/Pi), defined as the ratio of a circle's diameter to the circle's circumference. #### π **Type Annotation** ```roc F64 ``` **Description** An alias for [pi]. #### tau **Type Annotation** ```roc F64 ``` **Description** The other circle constant [τ](https://en.wikipedia.org/wiki/Tau_(mathematical_constant)), defined as the ratio of a circle's radius to the circle's circumference. #### τ **Type Annotation** ```roc F64 ``` **Description** An alias for [tau]. #### e **Type Annotation** ```roc F64 ``` **Description** [Euler's number](https://en.wikipedia.org/wiki/E_(mathematical_constant)), the base of the natural logarithm. #### ℯ **Type Annotation** ```roc F64 ``` **Description** An alias for [e]. #### golden_ratio **Type Annotation** ```roc F64 ``` **Description** [The golden ratio](https://en.wikipedia.org/wiki/Golden_ratio), defined as φ = (1 + √5)/2, and satisfies the quadratic equation φ² = φ + 1. #### φ **Type Annotation** ```roc F64 ``` **Description** An alias for [goldenRatio]. #### sqrt2 **Type Annotation** ```roc F64 ``` **Description** The [square root of two](https://en.wikipedia.org/wiki/Square_root_of_2) (√2). ### Stats #### mean **Type Annotation** ```roc List (Num *) -> Result F64 [ListWasEmpty] ``` **Description** The [arithmetic mean](https://en.wikipedia.org/wiki/Mean#Arithmetic_mean_(AM)) of a list `x` is defined as the sum of the elements of `x` divided by the number of elements in `x`. For a version of this function that silently returns `NaN` when the input list is empty, see [meanUnchecked]. #### mean_unchecked **Type Annotation** ```roc List (Num *) -> F64 ``` **Description** A version of [mean] that silently returns `NaN` when the input list is empty. #### variance **Type Annotation** ```roc List (Num *) -> Result F64 [ListWasEmpty] ``` **Description** The [unbiased sample variance](https://en.wikipedia.org/wiki/Variance#Unbiased_sample_variance) of a list of numbers. Defined as S² = ∑(x - x̄)² / (n − 1). #### variance_unchecked **Type Annotation** ```roc List (Num *) -> F64 ``` **Description** A version of the [variance] function that silently returns `NaN` when the input list is empty. #### variance_with_mean **Type Annotation** ```roc List (Num *), F64 -> F64 ``` **Description** A version of the [variance] function that uses a pre-calculated mean value for efficiency. #### mean_and_variance **Type Annotation** ```roc List (Num *) -> Result ( F64, F64 ) [ListWasEmpty] ``` **Description** A function that calculates both the [mean] and [variance] of a list at the same time. This is more efficient than calculating both values separately. #### mean_and_variance_unchecked **Type Annotation** ```roc List (Num *) -> ( F64, F64 ) ``` **Description** A function that calculates both the [mean] and [variance] of a list at the same time. This is more efficient than calculating both values separately. #### standard_deviation **Type Annotation** ```roc List (Num *) -> Result F64 [ListWasEmpty] ``` **Description** The [corrected sample standard deviation](https://en.wikipedia.org/wiki/Standard_deviation#Corrected_sample_standard_deviation) of a list of numbers. #### nth_sample_moment **Type Annotation** ```roc List (Num *), U64 -> Result F64 [ListWasEmpty] ``` **Description** The [n-th sample moment](https://en.wikipedia.org/wiki/Moment_(mathematics)#Sample_moments) of a list of numbers. #### nth_sample_moment_unchecked **Type Annotation** ```roc List (Num *), U64 -> F64 ``` **Description** The [n-th sample moment](https://en.wikipedia.org/wiki/Moment_(mathematics)#Sample_moments) of a list of numbers that silently returns NaN when the input list is empty. #### nth_sample_moment_with_mean **Type Annotation** ```roc List (Num *), U64, F64 -> F64 ``` **Description** The [n-th sample moment](https://en.wikipedia.org/wiki/Moment_(mathematics)#Sample_moments) of a list of numbers, given a pre-calculated mean. #### median **Type Annotation** ```roc List (Num *) -> Result F64 [ListWasEmpty] ``` **Description** The [median](https://en.wikipedia.org/wiki/Median) of a list of numbers. #### median_unchecked **Type Annotation** ```roc List (Num *) -> F64 ``` **Description** A version of the [median] function that silently returns `NaN` when the input list is empty. #### range **Type Annotation** ```roc List (Num a) -> Result (Num a) [ListWasEmpty] ``` **Description** The difference between the maximum and minimum values in a list. ### Trig #### sin **Type Annotation** ```roc Angle -> F64 ``` **Description** The [sine](https://en.wikipedia.org/wiki/Sine_and_cosine) of an angle. #### cos **Type Annotation** ```roc Angle -> F64 ``` **Description** The [cosine](https://en.wikipedia.org/wiki/Sine_and_cosine) of an angle. #### tan **Type Annotation** ```roc Angle -> F64 ``` **Description** The [tangent](https://en.wikipedia.org/wiki/Trigonometric_functions) of an angle. #### asin **Type Annotation** ```roc F64, [ ToRadians, ToDegrees, ToTurns, ToGon ] -> Angle ``` **Description** The [arcsine](https://en.wikipedia.org/wiki/Sine_and_cosine#Inverses) of a number. Silently returns `NaN` if the input is outside the range `[-1, 1]`. #### acos **Type Annotation** ```roc F64, [ ToRadians, ToDegrees, ToTurns, ToGon ] -> Angle ``` **Description** The [arccosine](https://en.wikipedia.org/wiki/Sine_and_cosine#Inverses) of a number. Silently returns `NaN` if the input is outside the range `[-1, 1]`. #### atan **Type Annotation** ```roc F64, [ ToRadians, ToDegrees, ToTurns, ToGon ] -> Angle ``` **Description** The [arctangent](https://en.wikipedia.org/wiki/Trigonometric_functions#Inverses) of a number. #### sinh **Type Annotation** ```roc F64 -> F64 ``` **Description** The [hyperbolic sine](https://en.wikipedia.org/wiki/Hyperbolic_functions). #### cosh **Type Annotation** ```roc F64 -> F64 ``` **Description** The [hyperbolic cosine](https://en.wikipedia.org/wiki/Hyperbolic_functions). #### tanh **Type Annotation** ```roc F64 -> F64 ``` **Description** The [hyperbolic tangent](https://en.wikipedia.org/wiki/Hyperbolic_functions). #### coth **Type Annotation** ```roc F64 -> F64 ``` **Description** The [hyperbolic cotangent](https://en.wikipedia.org/wiki/Hyperbolic_functions). #### sech **Type Annotation** ```roc F64 -> F64 ``` **Description** The [hyperbolic secant](https://en.wikipedia.org/wiki/Hyperbolic_functions). #### csch **Type Annotation** ```roc F64 -> F64 ``` **Description** The [hyperbolic cosecant](https://en.wikipedia.org/wiki/Hyperbolic_functions).