Classes | Math

# SimpleNumber : Number : Magnitude : Object

one-dimensional value
Subclasses: Float, Integer

## Description

Base class for numbers which can be represented by a single one dimensional value.

Most of the Unary and Binary operations are also implemented by UnaryOpUGen and BinaryOpUGen, so you can get more examples by looking at the help for those.

## Class Methods

### SimpleNumber.new

allocates a new SimpleNumber.

## Instance Methods

Subtraction

Multiplication

Division

### %(that)

From superclass: Object

Modulo

Modulo

Integer Division

### **(that)

From superclass: Object

Exponentiation

Is not

greater than

greater than

greater or equal than

smaller or equal than

Least common multiple

Greatest common divisor

Round to multiple of aNumber

Round up to a multiple of aNumber. For roundDown use trunc.

Truncate to multiple of aNumber (e.g. it rounds numbers down to a multiple of aNumber).

### .softRound(resolution: 1.0, margin: 0.05, strength: 1.0)

Rounds the value to a multiple of resolution. By using margin and strength you can control which values will be rounded, and by how much.

Conceptually this is the equivalent of MIDI quantization in a DAW/MIDI sequencer. In particular it allows a certain sloppiness close to the resolution value.

Note: this method expects values >= 0.

#### Arguments:

 resolution Round this value to a multiple of resolution. E.g. if you chose 1, then all values would be rounded to the nearest integer. margin Values that are within ±margin from a multiple of resolution will be left as they are. E.g. if you chose a resolution value of 0.5 and a margin of 0.01, then the values 0.501 and 0.499 would be left as they are, but the value 0.502 would become 0.5. This should be a value between 0 and resolution. strength Determines the degree to which this number will be changed. If strength is 1, then this function will return the nearest resolution. If it is 0, then value of this number will be left unchanged. E.g. If the resolution was 1 and strength was 0.5, then the value 0.6 would become 0.8.

### .snap(resolution: 1.0, margin: 0.05, strength: 1.0)

Rounds the values margin distance from resolution to a multiple of resolution. By using margin and strength you can control when values will be rounded, and by how much.

Conceptually this is the equivalent of 'snap' in a graphics program. Values within a certain distance (margin) from a grid line are snapped to it. All other values are unchanged.

Note: this method expects values >= 0.

#### Arguments:

 resolution Snap this value to a multiple of resolution. E.g. if you chose 1, then all values would be rounded to the nearest integer. margin Only values that are greater ±margin from a multiple of resolution value will be changed. Values that are less than margin will be unchanged. E.g. if you chose a resolution value of 0.5 and a margin of 0.01, then the values 0.501 and 0.499 would be snapped to 0.5, but the value 0.502 would be unchanged. This should be a value between 0 and resolution. strength Determines the degree to which this number will be changed. If strength is 1, then this function will return the nearest resolution. If it is 0, then value of this number will be left unchanged. E.g. If the resolution was 1 and strength was 0.5, then the value 0.6 would become 0.8.

#### Discussion:

Minimum

Maximum

Arctangent of (this/aNumber)

Square root of the sum of the squares.

### .log

#### Returns:

Base e logarithm.

### .log2

#### Returns:

Base 2 logarithm.

### .log10

#### Returns:

Base 10 logarithm.

negation

absolute value.

### .sign

#### Returns:

Answer -1 if negative, +1 if positive or 0 if zero.

### .ceil

#### Returns:

next larger integer.

### .floor

#### Returns:

next smaller integer

Sine

Cosine

Tangent

Arcsine

Arccosine

Arctangent

Hyperbolic sine

### .cosh

Hyperbolic cosine

### .tanh

Hyperbolic tangent

fractional part

### .squared

the square of the number

### .cubed

the cube of the number

### .sqrt

the square root of the number.

### .exp

e to the power of the receiver.

### .reciprocal

1 / this

this to the power of aNumber

the folded value, a bitwise or with aNumber

### .previousPowerOf(base)

the number relative to this that is the previous power of aNumber

### .nextPowerOf(base)

the next power of aNumber

### .nextPowerOfTwo

#### Returns:

the number relative to this that is the next power of 2

### .nextPowerOfThree

the next power of three

a hash value

### <!(that)

From superclass: Object

### &(that)

From superclass: Object

Bitwise And

### |(that)

From superclass: Object

Bitwise Or

Bitwise Exclusive Or

Binary Hamming distance: the count of bits that are not the same in the two numbers

### .bitTest(bit)

#### Returns:

true if bit at index aNumber is set.

ones complement

### <<(that)

From superclass: Object

Binary shift left.

### >>(that)

From superclass: Object

Binary shift right.

### +>>(that)

From superclass: Object

Unsigned binary shift right.

#### Returns:

performs a binary right shift

#### Returns:

performs an unsigned right shift

#### Returns:

performs a binary left shift

#### Returns:

performs a bitwise or with aNumber

#### Returns:

performs a bitwise and with aNumber

(a * b) + a

((a*b) + a + b)

(a * a *b)

((a*a *b) - (a*b*b))

(a*a) - (b*b)

(a*a) + (b*b)

(a - b) ** 2

(a + b) ** 2

(a - b).abs

### .moddif(aNumber: 0.0, mod: 1.0)

On a circle, there are two distances between two points. This operator returns the smaller value of the two.

0 when b <= 0, a*b when b > 0

a * b when a < 0, otherwise a.

Returns the difference of the receiver and its clipped form.

### .isPositive

Answer if the number is >= 0.

### .isNegative

Answer if the number is < 0.

### .isStrictlyPositive

Answer if the number is > 0.

### .booleanValue

#### Returns:

true, if strictly positive ( > 0), otherwise false (see Boolean)

### .asFraction(denominator: 100, fasterBetter: true)

#### Arguments:

 denominator fasterBetter if true, asFraction may find a much closer approximation and do it faster.

#### Returns:

an array of denominator and divisor of the nearest and smallest fraction

### .asAudioRateInput

Converts this into an audiorate input.

### .asTimeString(precision: 0.001, maxDays: 365, dropDaysIfPossible: true)

Produces a time string in the format `ddd:hh:mm:ss.sss`, interpreting the receiver as time in seconds. See String: -asSecs for the inverse function.

#### Arguments:

 precision accuracy of the millisecond format; the string will always be formatted with 3 decimal places for milliseconds. Minimum value: 0.001. maxDays maximum number of days dropDaysIfPossible a Boolean. If set to `true`, and the number of days in the formatted string would be 0, that section is instead ommitted and the string is formatted as `hh:mm:ss.sss`.

### .asPoint

#### Returns:

this as Point. x = y = this.

### .asComplex

#### Returns:

this as Point. x = y = this.

### .asWarp(spec)

 spec

#### Returns:

this as CurveWarp according to spec.

this as Float

### .asRect

#### Returns:

a Rect with x = y = w = h = this.

### .asBoolean

#### Returns:

this as a Boolean. this > 0

### .asQuant

#### Returns:

the values as Quant

this as Integer

### .wait

within a routine, yield the number so that the clock can wait for this many beats. Outside a Routine, this trows an error (see also Routine for details).

#### Discussion:

Create a routine by a function fork

### .waitUntil

like wait, only specify a time (measured in beats of the current thread's clock). Outside a Routine, this trows an error (see also Routine for details).

### .sleep

make the current thread sleep, until woken up by re-scheduling. Outside a Routine, this trows an error (see also Routine for details).

### .nextTimeOnGrid(clock)

 clock

#### Returns:

the next possible multiple of the clock's beats.

### .nearestInList(list)

#### Returns:

the value in the list closest to this

### .nearestInScale(scale, stepsPerOctave: 12)

#### Arguments:

 scale an array of SimpleNumbers each treated as a step in the octave. stepsPerOctave 12 by default

#### Returns:

the value in the collection closest to this, assuming an octave repeating table of note values.

### .series(second, last)

return an arithmetic series from this over second to last. The last value may not be included in the result if the step size does not divide evenly into the range of the series.

#### Discussion:

This is used in the shortcuts:

If second is nil, it is one magnitude step towards last (1 or -1). Examples:

### .seriesIter(second, last)

#### Returns:

a Routine that iterates over the numbers from this to last.

#### Discussion:

Since this is a lazy operation, last may be inf, generating an endless series (see also List Comprehensions)

### .rectWindow

#### Returns:

a value for a rectangular window function between 0 and 1.

### .hanWindow

#### Returns:

a value for a hanning window function between 0 and 1.

### .welWindow

#### Returns:

a value for a welsh window function between 0 and 1.

### .triWindow

#### Returns:

a value for a triangle window function between 0 and 1.

### .distort

a nonlinear distortion function.

### .softclip

Distortion with a perfectly linear region from -0.5 to +0.5

### .scurve

Map receiver in the onto an S-curve.

### .ramp

Map receiver onto a ramp starting at 0.

### .magnitude

#### Returns:

absolute value (see Polar, Complex)

### .angle

#### Returns:

angle of receiver conceived as Polar or Complex number.

### .degreeToKey(scale, stepsPerOctave: 12)

#### Arguments:

 scale an array of SimpleNumbers each treated as a step in the octave. stepsPerOctave 12 is the standard chromatic scale.

#### Discussion:

the value is truncated to an integer and used as an index into an octave repeating table of note values. Indices wrap around the table and shift octaves as they do.

### .keyToDegree(scale, stepsPerOctave: 12)

inverse of degreeToKey.

#### Arguments:

 scale an array of SimpleNumbers each treated as a step in the octave. stepsPerOctave 12 is the standard chromatic scale.

### .gaussCurve(a: 1.0, b: 0.0, c: 1.0)

map the receiver onto a gauss function.

#### Discussion:

Uses the formula:

Example code

### .equalWithPrecision(that, precision: 0.0001, relativePrecision: 0)

#### Arguments:

 that the number to compare with within precision precision The absolute precision, independent of the value compared relativePrecision The precision relative to the larger absolute of the values compared.

#### Returns:

true if receiver is closer to that than precision.

### .quantize(quantum: 1.0, tolerance: 0.05, strength: 1.0)

Deprecated. Round the receiver to the quantum. If you're looking for MIDI quantization type features use `SimpleNumber#-softRound`

#### Arguments:

 quantum amount. tolerance allowed tolerance. strength Determines how much the value is allowed to differ in the tolerance range.

### .linlin(inMin, inMax, outMin, outMax, clip: 'minmax')

map the receiver from an assumed linear input range to a linear output range. If the input exceeds the assumed input range, the behaviour is specified by the clip argument.

#### Arguments:

 inMin assumed input minimum inMax assumed input maximum outMin output minimum outMax output maximum clip nil (don't clip) \max (clip ceiling) \min (clip floor) \minmax (clip both - this is default).

### .linexp(inMin, inMax, outMin, outMax, clip: 'minmax')

map the receiver from an assumed linear input range (inMin..inMax) to an exponential output range (outMin..outMax). The output range must not include zero. If the input exceeds the input range, the following behaviours are specified by the clip argument.

#### Arguments:

 inMin assumed input minimum inMax assumed input maximum outMin output minimum outMax output maximum clip nil (don't clip) \max (clip ceiling) \min (clip floor) \minmax (clip both - this is default).

### .explin(inMin, inMax, outMin, outMax, clip: 'minmax')

map the receiver from an assumed exponential input range (inMin..inMax) to a linear output range (outMin..outMax). If the input exceeds the assumed input range. The input range must not include zero. If the input exceeds the input range, the following behaviours are specified by the clip argument.

#### Arguments:

 inMin assumed input minimum inMax assumed input maximum outMin output minimum outMax output maximum clip nil (don't clip) \max (clip ceiling) \min (clip floor) \minmax (clip both - this is default).

### .expexp(inMin, inMax, outMin, outMax, clip: 'minmax')

map the receiver from an assumed exponential input range (inMin..inMax) to an exponential output range (outMin..outMax). If the input exceeds the assumed input range. Both input range and output range must not include zero. If the input exceeds the input range, the following behaviours are specified by the clip argument.

#### Arguments:

 inMin assumed input minimum inMax assumed input maximum outMin output minimum outMax output maximum clip nil (don't clip) \max (clip ceiling) \min (clip floor) \minmax (clip both - this is default).

### .lincurve(inMin: 0, inMax: 1, outMin: 0, outMax: 1, curve: -4, clip: 'minmax')

map the receiver from an assumed linear input range (inMin..inMax) to an exponential curve output range (outMin..outMax). A curve is like the curve parameter in Env. Unlike with linexp, the output range may include zero. If the input exceeds the input range, the following behaviours are specified by the clip argument.

#### Arguments:

 inMin assumed input minimum inMax assumed input maximum outMin output minimum outMax output maximum curve 0 (linear) <0 (concave, negatively curved) >0 (convex, positively curved) clip nil (don't clip) \max (clip ceiling) \min (clip floor) \minmax (clip both - this is default).

### .curvelin(inMin: 0, inMax: 1, outMin: 0, outMax: 1, curve: -4, clip: 'minmax')

map the receiver from an assumed curve-exponential input range (inMin..inMax) to a linear output range (outMin..outMax). If the input exceeds the assumed input range. A curve is like the curve parameter in Env. Unlike with explin, the input range may include zero. If the input exceeds the input range, the following behaviours are specified by the clip argument.

#### Arguments:

 inMin assumed input minimum inMax assumed input maximum outMin output minimum outMax output maximum curve 0 (linear) <0 (concave, negatively curved) >0 (convex, positively curved) clip nil (don't clip) \max (clip ceiling) \min (clip floor) \minmax (clip both - this is default).

### .bilin(inCenter, inMin, inMax, outCenter, outMin, outMax, clip: 'minmax')

map the receiver from two assumed linear input ranges (inMin..inCenter) and (inCenter..inMax) to two linear output ranges (outMin..outCenter) and (outCenter..outMax). If the input exceeds the input range, the following behaviours are specified by the clip argument.

#### Arguments:

 inCenter inMin assumed input minimum inMax assumed input maximum outCenter outMin output minimum outMax output maximum clip nil (don't clip) \max (clip ceiling) \min (clip floor) \minmax (clip both - this is default).

### .biexp(inCenter, inMin, inMax, outCenter, outMin, outMax, clip: 'minmax')

map the receiver from two assumed exponential input ranges (inMin..inCenter) and (inCenter..inMax) to two linear output ranges (outMin..outCenter) and (outCenter..outMax). The input range must not include zero. If the input exceeds the input range, the following behaviours are specified by the clip argument.

#### Arguments:

 inCenter inMin assumed input minimum inMax assumed input maximum outCenter outMin output minimum outMax output maximum clip nil (don't clip) \max (clip ceiling) \min (clip floor) \minmax (clip both - this is default).

### .lcurve(a: 1.0, m: 0.0, n: 1.0, tau: 1.0)

map the receiver onto an L-curve.

#### Discussion:

Uses the formula

This is used for smoothing values and limiting them to a range.

### .midicps

Convert MIDI note to cycles per second

#### Returns:

cycles per second

### .cpsmidi

Convert cycles per second to MIDI note.

midi note

### .midiratio

Convert an interval in semitones to a ratio.

a ratio

### .ratiomidi

Convert a ratio to an interval in semitones.

#### Returns:

an interval in semitones

### .ampdb

Convert a linear amplitude to decibels.

### .dbamp

Convert a decibels to a linear amplitude.

### .octcps

Convert decimal octaves to cycles per second.

### .cpsoct

Convert cycles per second to decimal octaves.

### .storeOn(stream)

stores this on the given stream

### .printOn(stream)

prints this on the given stream

### .coin

Let x be the receiver clipped to the range [0, 1]. With probability x, return true. With probability 1 - x, return false.

### .rand

#### Returns:

Random number from zero up to the receiver, exclusive.

### .rand2

#### Returns:

a random number from -this to +this.

#### Returns:

a random number in the interval ]a, b[.

#### Discussion:

If both a and b are Integer then the result will be an Integer.

### .linrand

#### Returns:

a linearly distributed random number from zero to this.

### .bilinrand

#### Returns:

Bilateral linearly distributed random number from -this to +this.

### .sum3rand

This was suggested by Larry Polansky as a poor man's gaussian.

#### Returns:

A random number from -this to +this that is the result of summing three uniform random generators to yield a bell-like distribution.

an exponentially distributed random number in the interval ]a, b[. This is always a Float. (Note that the distribution of numbers is not exactly an exponential distribution, since that would be unbounded: we might call it a logarithmic uniform distribution.)

### .gauss(standardDeviation)

a gaussian distributed random number.

#### Arguments:

 standardDeviation the upper limit

#### Discussion:

Always returns a Float.

### .partition(parts: 2, min: 1)

randomly partition a number into parts of at least min size.

#### Arguments:

 parts number of parts min the minimum size

### UGen Compatibility Methods

Some methods to ease the development of generic ugen code.

`this`

### .isValidUGenInput

#### Returns:

false if receiver cannot be used in UGen.

### Special Functions

A variety of Special Functions are supplied by the Boost C++ library. The library's online documentation serves as the primary reference for the following functions. The methods here match closely with those found in the source library, as do argument names.

Below you'll find descriptions of the functions and their bounds, but for visualizing the functions, have a look in Tour of Special Functions.

WARNING: Many of the functions are only valid in certain numerical ranges. For the most part, error handling happens in the underlying boost functions. While these errors are often obtuse, you'll usually find a useful message at the end of the error regarding proper ranges and the erroneous value supplied. Refer to the online documentation for more detailed descriptions, and the Tour of Special Functions for plots showing ranges and asymptotes.

### Number Series

Take a tour of Number Series.

### .bernouliB2n

Returns the (2*`n`)th Bernoulli number.

Because all odd numbered Bernoulli numbers are zero (apart from B(1) which is -1/2) the interface will only return the even numbered Bernoulli numbers.

### .tangentT2n

Returns a single tangent number at `i`. Also called a zag function.

### Gamma Functions

Take a tour of Gamma Functions.

### .tgamma

Returns the "true gamma" of value `z`.

### .tgamma1pm1

Returns `gamma(dz + 1) - 1`.

### .lgamma

Returns the natural logarithm of the gamma function.

### .digamma

Returns the digamma or psi function of `z`.

Digamma is defined as the logarithmic derivative of the gamma function.

### .trigamma

Returns the trigamma function of `z`.

Trigamma is defined as the derivative of the digamma function.

### .polygamma(z)

Returns the polygamma function of `z`.

Polygamma is defined as the `n`'th derivative of the digamma function.

### .tgammaRatio(b)

Returns the ratio of gamma functions `tgamma(a) / tgamma(b)`.

Returns the ratio of gamma functions `tgamma(a) / tgamma(a+delta)`.

### .gammaP(z)

Returns the normalised lower incomplete gamma function.

Requires `a` > 0 and `z` >= 0.

### .gammaQ(z)

Returns the normalised upper incomplete gamma function.

Requires `a` > 0 and `z` >= 0.

### .tgammaLower(z)

Returns the full (non-normalised) lower incomplete gamma function.

Requires `a` > 0 and `z` >= 0.

### .tgammaUpper(z)

Returns the full (non-normalised) upper incomplete gamma function.

Requires `a` > 0 and `z` >= 0.

### .gammaPInv(p)

Returns a value such that `p = gamma_p(a, x)`.

Requires `a` > 0 and 1 >= `p,q` >= 0.

### .gammaQInv(q)

Returns a value x such that `q = gamma_q(a, x)`.

Requires `a` > 0 and 1 >= `p,q` >= 0.

### .gammaPInvA(p)

Returns a value such that `p = gamma_p(a, x)`.

Requires `x` > 0 and 1 >= `p,q` >= 0.

### .gammaQInvA(q)

Returns a value x such that `q = gamma_q(a, x)`.

Requires `x` > 0 and 1 >= `p,q` >= 0.

### .gammaPDerivative(x)

Implements the partial derivative with respect to x of the incomplete gamma function (lower).

### .gammaQDerivative(x)

Implements the partial derivative with respect to x of the incomplete gamma function (upper).

### Factorials and Binomial Coefficients

Take a tour of Factorials and Binomial Coefficients.

### .factorial

Returns `i!`.

WARNING: `factorial` will overflow if `i > 170`

### .doubleFactorial

Returns `i!!`.

For even `i`, `i !! = i(i-2)(i-4)(i-6) ... (4)(2)`.

For odd `i`, `i !! = i(i-2)(i-4)(i-6) ... (3)(1)`.

### .risingFactorial(i)

Returns the rising factorial of `x` and `i`:

`x(x+1)(x+2)(x+3)...(x+i-1)`

Both `x` and `i` can be negative as well as positive.

### .fallingFactorial(i)

Returns the falling factorial of `x` and `i`:

`x(x-1)(x-2)(x-3)...(x-i+1)`

This function is only defined for positive `i`. Argument `x` can be either positive or negative.

### .binomialCoefficient(k)

Requires `k` <= `n`.

### Beta Functions

Take a tour of Beta Functions.

### .beta(b)

The beta function is defined by: `tgamma(a)*tgamma(b) / tgamma(a+b)`.

### .ibeta(b, x)

Returns the normalised incomplete beta function of `a`, `b` and `x`.

Require 0 <= `x` <= 1, `a,b` >= 0, and in addition that not both `a` and `b` are zero.

### .ibetaC(b, x)

Returns the normalised complement of the incomplete beta function of `a`, `b` and `x`.

Require 0 <= `x` <= 1, `a,b` >= 0, and in addition that not both `a` and `b` are zero.

### .betaFull(b, x)

Returns the full (non-normalised) incomplete beta function of `a`, `b` and `x`.

Require 0 <= `x` <= 1, and `a,b` > 0.

### .betaFullC(b, x)

Returns the full (non-normalised) complement of the incomplete beta function of `a`, `b` and `x`.

Require 0 <= `x` <= 1, and `a,b` > 0.

### .ibetaInv(b, p)

Returns a value `x` such that: `p = ibeta(a, b, x)`.

Requires `a,b` > 0 and 0 <= `p` <= 1.

### .ibetaCInv(b, q)

Returns a value `x` such that: `q = ibetaC(a, b, x)`.

Requires `a,b` > 0 and 0 <= `q` <= 1.

### .ibetaInvA(x, p)

Returns a value `a` such that: `p = ibeta(a, b, x)`.

Requires `b` > 0, 0 < `x` < 1, and 0 <= `p` <= 1.

### .ibetaCInvA(x, q)

Returns a value `a` such that: `q = ibetaC(a, b, x)`.

Requires `b` > 0, 0 < `x` < 1, and 0 <= `q` <= 1.

### .ibetaInvB(x, p)

Returns a value `b` such that: `p = ibeta(a, b, x)`.

Requires `a` > 0, 0 < `x` < 1, and 0 <= `p` <= 1.

### .ibetaCInvB(x, q)

Returns a value `b` such that: `q = ibetaC(a, b, x)`.

Requires `a` > 0, 0 < `x` < 1, and 0 <= `q` <= 1.

Returns the partial derivative with respect to `x` of the incomplete beta function `ibeta(a,b,x)`.

### Error Functions

Take a tour of Error Functions.

### .erf

Returns the error function of `z`.

### .erfC

Returns the complement of the error function of `z`.

### .erfInv

Returns the inverse error function of `z`, that is a value `x` such that:

`p = erf(x)`.

### .erfCInv

Returns the inverse of the complement of the error function of `z`, that is a value `x` such that:

`p = erfC(x)`

### Polynomials

Take a tour of Polynomials.

### .legendreP(x)

Returns the Legendre Polynomial of the first kind.

Requires -1 <= `x` <= 1.

### .legendrePPrime(x)

Returns the derivatives of the Legendre polynomials.

### .legendrePZeros

Since the Legendre polynomials are alternatively even and odd, only the non-negative zeros are returned. For the odd Legendre polynomials, the first zero is always zero. The rest of the zeros are returned in increasing order.

### .legendrePAssoc(m, x)

Returns the associated Legendre polynomial of the first kind.

Requires -1 <= `x` <= 1.

### .legendreQ(x)

Returns the value of the Legendre polynomial that is the second solution to the Legendre differential equation.

Requires -1 <= `x` <= 1.

### .laguerre(x)

Returns the value of the Laguerre Polynomial of order `n` at point `x`.

### .laguerreAssoc(m, x)

Returns the Associated Laguerre polynomial of degree of dgree `n` and order `m` at point `x`.

### .hermite(x)

Returns the value of the Hermite Polynomial of order `n` at point `x`.

### .chebyshevT(x)

Returns the Chebyshev polynomials of the first kind.

### .chebyshevU(x)

Returns the Chebyshev polynomials of the second kind.

### .chebyshevTPrime(x)

Returns the derivatives of the Chebyshev polynomials of the first kind.

### .chebyshevTZeros

Returns the roots (zeros) of the `n`-th Chebyshev polynomial of the first kind.

### .sphericalHarmonic(m, theta, phi)

Returns the (`Complex`) value of the Spherical Harmonic.

`theta` is taken as the polar (colatitudinal) coordinate within `[0, pi]`, and `phi` as the azimuthal (longitudinal) coordinate within `[0,2pi]`.

See boost documentation for further information, including a note about the Condon-Shortley phase term of `(-1)^m`.

### .sphericalHarmonicR(m, theta, phi)

Returns the real part of the Spherical Harmonic.

### .sphericalHarmonicI(m, theta, phi)

Returns the imaginary part of the Spherical Harmonic.

### Bessel Functions

Take a tour of Bessel Functions.

### .cylBesselJ(x)

Returns the result of the Bessel functions of the first kind.

The functions return the result of `domain_error` whenever the result is undefined or complex. This occurs when `x < 0` and `v` is not an integer, or when `x == 0` and `v != 0`.

### .cylNeumann(x)

Returns the result of the Bessel functions of the second kind.

The functions return the result of `domain_error` whenever the result is undefined or complex. This occurs when `x <= 0`.

### .cylBesselJZero(index)

Returns a single zero or root of the Bessel function of the first kind.

`index` is a 1-based index of zero of the cylindrical Bessel function of order `v`.

### .cylNeumannZero(index)

Returns a single zero or root of the Neumann function (Bessel function of the second kind).

`index` is a 1-based index of zero of the cylindrical Neumann function of order `v`.

### .cylBesselI(x)

Returns the result of the modified Bessel functions of the first kind.

### .cylBesselK(x)

Returns the result of the modified Bessel functions of the second kind.

Requires `x > 0`.

### .sphBessel(x)

Returns the result of the spherical Bessel functions of the first kind.

Requires `x` > 0.

### .sphNeumann(x)

Returns the result of the spherical Bessel functions of the first kind.

Requires `x` > 0.

### .cylBesselJPrime(x)

Returns the first derivative with respect to x of the corresponding Bessel function.

### .cylNeumannPrime(x)

Returns the first derivative with respect to x of the corresponding Neumann function.

Requires `x > 0`.

### .cylBesselIPrime(x)

Returns the first derivative with respect to x of the corresponding Bessel function.

### .cylBesselKPrime(x)

Returns the first derivative with respect to x of the corresponding Bessel function.

Requires `x > 0`.

### .sphBesselPrime(x)

Returns the first derivative with respect to x of the corresponding Bessel function.

Requires `x > 0`.

### .sphNeumannPrime(x)

Returns the first derivative with respect to x of the corresponding Neumann function.

Requires `x > 0`.

### Hankel Functions

Take a tour of Hankel Functions.

### .cylHankel1(x)

Returns the result of the Hankel functions of the first kind.

### .cylHankel2(x)

Returns the result of the Hankel functions of the second kind.

### .sphHankel1(x)

Returns the result of the spherical Hankel functions of the first kind.

### .sphHankel2(x)

Returns the result of the spherical Hankel functions of the second kind.

### Airy Functions

Take a tour of Airy Functions.

### .airyAi

Returns the result of the Airy function Ai at `x`.

### .airyBi

Returns the result of the Airy function Bi at `x`.

### .airyAiPrime

Returns the derivative of the Airy function Ai at `x`.

### .airyBiPrime

Returns the derivative of the Airy function Bi at `x`.

### .airyAiZero

Returns the `m`th zero or root of the Airy Ai function. The Airy Ai function has an infinite number of zeros on the negative real axis.

`m` is 1-based.

### .airyBiZero

Returns the `m`th zero or root (1-based) of the Airy Bi function. The Airy Bi function has an infinite number of zeros on the negative real axis.

`m` is 1-based.

### Elliptic Integrals

Take a tour of Elliptic Integrals.

### .ellintRf(y, z)

Returns Carlson's Elliptic Integral RF.

Requires that `x,y >= 0`, with at most one of them zero, and that `z >= 0`.

### .ellintRd(y, z)

Returns Carlson's Elliptic Integral RD.

Requires that `x,y >= 0`, with at most one of them zero, and that `z >= 0`.

### .ellintRj(y, z, p)

Returns Carlson's Elliptic Integral RJ.

Requires that `x,y,z >= 0`, with at most one of them zero, and that `p != 0`.

### .ellintRc(y)

Returns Carlson's Elliptic Integral RC.

Requires that `x >= 0`, with at most one of them zero, and that `y != 0`.

### .ellintRg(y, z)

Returns Carlson's Elliptic Integral RG.

Requires that `x,y >= 0`.

### .ellint1(phi)

Returns the incomplete elliptic integral of the first kind, Legendre form.

Requires `-1 <= k <= 1`.

### .ellint1C

Returns the complete elliptic integral of the first kind, Legendre form.

Requires `-1 <= k <= 1`.

### .ellint2(phi)

Returns the incomplete elliptic integral of the second kind, Legendre form.

Requires `-1 <= k <= 1`.

### .ellint2C

Returns the complete elliptic integral of the second kind, Legendre form.

Requires `-1 <= k <= 1`.

### .ellint3(n, phi)

Returns the incomplete elliptic integral of the third kind, Legendre form.

Requires `-1 <= k <= 1` and `n < 1/sin^2(phi)`.

### .ellint3C(n)

Returns the complete elliptic integral of the third kind, Legendre form.

Requires `-1 <= k <= 1` and `n < 1`.

### .ellintD(phi)

Returns the incomplete elliptic integral D(phi, k), Legendre form.

Requires `-1 <= k <= 1`.

### .ellintDC

Returns the complete elliptic integral D(phi, k), Legendre form.

Requires `-1 <= k <= 1`.

### .jacobiZeta(phi)

Returns the result of the Jacobi Zeta Function.

Requires `-1 <= k <= 1`.

### .heumanLambda(phi)

Returns the result of the Heuman Lambda Function.

Requires `-1 <= k <= 1`.

### Jacobi Elliptic Functions

Like all elliptic functions, these can be parameterised in a number of ways:

• In terms of a parameter `m`.
• In terms of the elliptic modulus `k` where `m = k^2`.
• In terms of the modular angle `α`, where `m = sin2α`.

This implementation takes the elliptic modulus `k` as the parameter. In addition the variable `u` is used to express an amplitude φ. All take the elliptic modulus as the first argument - this is for alignment with the Elliptic Integrals.

Take a tour of Jacobi Elliptic Functions.

### Zeta Functions

Take a tour of Zeta Functions.

### .zeta

Returns the zeta function of `z`.

Requires `z != 1`.

### Exponential Integrals

Take a tour of Exponential Integrals.

### .expintEn(z)

Returns the exponential integral En of `z`.

Requires that when `n == 1`, `z !=0`.

### .expintEi

Returns the exponential integral of `z`.

Requires `z != 0`.

### Basic Functions

Take a tour of Basic Functions.

### .sinPi

Returns `sin(x * π)`.

### .cosPi

Returns `cos(x * π)`.

### .log1p

Returns the natural logarithm of `x+1`.

### .expm1

Returns `e^x - 1`.

### .cbrt

Returns the cube root of `x`.

### .sqrt1pm1

Returns `sqrt(1+x) - 1`.

### .powm1(y)

Returns `x^y - 1`.

### .sincPi

Returns the Sinus Cardinal of `x`. Also known as the "sinc" function.

`sincPi(x) = sin(x) / x`

### .sinhcPi

Returns the Hyperbolic Sinus Cardinal of `x`.

`sinhcPi(x) = sinh(x) / x`

### Inverse Hyperbolic Functions

Take a tour of Inverse Hyperbolic Functions.

### .asinh

Returns the reciprocal of the hyperbolic sine function at `x`.

### .acosh

Returns the reciprocal of the hyperbolic cosine function at `x`.

Requires `x >= 1`.

### .atanh

Returns the reciprocal of the hyperbolic sine function at `x`.

Requires `-1 < x < 1`.

### Owen's T Function

Take a tour of Owen's T Function.

### .owensT(a)

Returns the Owens T function of `h` and `a`.

### .asEvent

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/Streams/Rest.sc

### .delta

From extension in /usr/local/share/SuperCollider/SCClassLibrary/Common/Streams/Rest.sc