| Script | Author |
|---|---|
|
arab2roman
Constructs a Roman numeric representation of a given integer (which should be typed as a real, not a string) between 1 and 3,999,999. |
By Daniel
January 11, 2009 |
|
dec2hex
Returns a hexadecimal string representation of some integer (which should be given as a real, not a string). |
By Daniel
January 11, 2009 |
|
decimal2fraction
Converts a decimal number into a fraction (represented as a string) |
By Daniel
December 24, 2008 |
|
draw_piechart
Draws a pie chart illustrating the given list of data. The list does not need to be normalized; this is done automatically. Note that this function only draws the shape of the chart, not the labels.... |
By Daniel
December 27, 2008 |
|
ds_list_max
Returns the largest real in a list of reals |
By Daniel
December 26, 2008 |
|
ds_list_min
Returns the smallest real in a list of reals |
By Daniel
December 26, 2008 |
|
ds_list_normalize
Normalizes a list of reals so that all the entries add up to 1 |
By Daniel
January 3, 2009 |
|
ds_list_subset_can_sum
Tests whether some subset of the given list has a given sum. The algorithm is fast with small (target) sums, but slow with larger ones. |
By Daniel
January 4, 2009 |
|
ds_list_sum
Sums the entries in a list of reals |
By Daniel
December 26, 2008 |
|
factorial
Computes the factorial of some number iteratively, avoid the overhead of recursion |
By Daniel
December 25, 2008 |
|
fibonacci
Computes the n'th number of the fibonacci sequence iteratively, taking O(n) time. This is accurate up to n=78. |
By Daniel
January 1, 2009 |
|
fibonacci
Computes the n'th number in the fibonacci sequence. This is faster than the iterative method, but loses precision more quickly, making it accurate up to n=75.... |
By Daniel
January 1, 2009 |
|
get_bit
Extracts one bit from some number n. bit=0 indicates the least significant bit (worth 1, usually written on the far right), bit=1 indicates the next (worth 2), and so forth; in... |
By Daniel
January 4, 2009 |
|
is_even
Return whether some number is in the set of even numbers: {.., -4, -2, 0, 2, 4, ..} |
By Daniel
January 6, 2009 |
|
is_odd
Returns whether some number is in the set of odd numbers: {.., -3, -1, 1, 3, ..} |
By Daniel
January 6, 2009 |
|
is_power
Tests whether n is a power of base; more precisely, whether there exists some power p such that base^p = n. |
By Daniel
December 26, 2008 |
|
is_prime
A general primality test |
By Daniel
January 5, 2009 |
|
line_intersects_line
Tests whether the line (NOT line segment) running from (x1, y1) to (x2, y2) intersects the line running from (x3, y3) to (x4, y4). |
By Daniel
January 12, 2009 |
|
matrix_determinant
Returns the determinant of some square matrix M using the recursive method. M should be a ds_grid filled with real entries. |
By Daniel
January 1, 2009 |
|
matrix_exponential
Returns the exponential of some square matrix M. This should both a ds_grid filled with real entries. This script uses the simple optimization of M^(2n) = (M^n)*(M^n), so it consumes O(log n) time.... |
By Daniel
January 1, 2009 |
|
matrix_identity
Returns an identity matrix with the given dimension |
By Daniel
January 1, 2009 |
|
matrix_is_diagonal
Returns whether some square matrix M is a diagonal matrix. M should be a ds_grid filled with real entries. |
By Daniel
January 1, 2009 |
|
matrix_is_lower_triangular
Returns whether some square matrix M is a lower triangular matrix. M should be a ds_grid filled with real entries. |
By Daniel
January 1, 2009 |
|
matrix_is_symmetric
Returns the whether some matrix M is symmetric, i.e., equivalent to its transpose. M should be a ds_grid filled with real entries. |
By Daniel
January 1, 2009 |
|
matrix_is_upper_triangular
Returns whether some square matrix M is an upper triangular matrix. M should be a ds_grid filled with real entries. |
By Daniel
January 1, 2009 |
|
matrix_product
Returns the matrix product of M1 and M2. These should both be ds_grids filled with real entries. This script uses the simple O(n^3) technique. |
By Daniel
January 1, 2009 |
|
matrix_scale
Returns a scaled transformation of some matrix M. This should be a ds_grid filled with real entries. |
By Daniel
January 1, 2009 |
|
matrix_sum
Returns the sum of two matrices. These should both be ds_grids filled with real entries. |
By Daniel
January 1, 2009 |
|
matrix_transpose
Returns the transpose of some matrix M. This should be a ds_grid filled with real entries. |
By Daniel
January 1, 2009 |
|
mod_alt
GML's modulo operator is implemented in such a way that the result always has the same sign as the dividend. For example, (-7 mod 2) evaluates to -1. This script implements the... |
By Daniel
January 9, 2009 |
|
num_divisors
Computes how many unique natural numbers divide evenly into the argument |
By Daniel
December 26, 2008 |
|
parseInt
Parse a numeric string in some specified base and the quantity as an integer |
By Daniel
March 21, 2009 |
|
random_integer
Generates a random integer between min and max, inclusive |
By Daniel
December 25, 2008 |
|
set_bit
Returns a modified version of n with some specified bit set to val. bit=0 indicates the least significant bit (worth 1, usually written on the far right), bit=1 indicates the next... |
By Daniel
January 4, 2009 |
|
toString
Generates a string representation of an integer using the specified base |
By Daniel
March 21, 2009 |