Working with equations : Built-in functions


Built-in functions

Alphabetical list of all functions (except trigonometric functions, which are listed separately)




   

Input(s)

 

abs(X)

Returns the absolute value of X

   

all([X])

all{X})

Result is true if all the elements of the array [X] or the list {X} are true

boolean array/list

 

any([X])

any({X})

Result is true if any of the elements of the array [X] or the list {X} are true.

boolean array or list

 

ceil(X)

Rounds up X to the next whole number

   

channel_is(X)

X is an immigration, reproduction or creation channel. Returns true if this individual appeared through that channel.

   

count([X])

Number of values in the array [X] or the list {X}

scalar array/list

 

delay(X,n)

Returns value of variable X, n time steps ago

variable, integer

 

dt(I)

Returns the duration of the time step level I

   

element([X],I)

Picks the I'th value form the array [X]

array of any type,integer

 

exp(X)

Returns e to the power X

   

floor(X)

Rounds X down to a whole number

   

fmod(X,Y)

Returns remainder after dividing X by Y

numeric, numeric

 

greatest([X])

greatest({X})

Returns the largest value from an array [X] or the list {X}

numeric array/list

 

hypot(X,Y)

Returns length of hypotenuse of triangle with base X and height Y

numeric, numeric

 

index(I)

Returns the index (instance number) of a member of a fixed membership or population submodel, for the level I of submodel nesting.

   

init_time(1)

Returns the time at which this instance appeared -- argument is dummy

   

int(X)

Returns integer part of X

   

last(X)

Recalls value of X from previous time step

   

least([X])

least({X})

Returns the smallest value from an array [X] or the list {X}

numeric array/list

 

log(X)

Returns natural logarithm of X

   

log10(X)

Returns base-10 logarithm of X

   

makearray(X,N)

Makes an array consisting of N lots of X

any type, numeric

array of same type

max(X,Y)

Returns greater of X and Y

numeric, numeric

 

min(X,Y)

Returns lesser of X and Y

numeric, numeric

 

parent(I)

Returns the id of the individual whose reproduction gave rise to this one, or 0 if it immigrated or was created

   

place_in(I)

When making an array with makearray, this gives each term's position in the array -- argument is nesting depth

   

pow(X,Y)

Returns X raised to the power Y

numeric, numeric

 

prev(N)

Returns the value of this component N time steps ago

   

product([X])

product({X})

Result is the product of all elements of the array [X] or the list {X}

numeric array/list

 

rand_const(X,Y)

Returns a random number between X and Y at the start of the simulation or when the submodel instance is created, which stays the same until the simulation is reset.

numeric, numeric

 

rand_var(X,Y)

Returns a random number between X and Y, with a new value every time step.

numeric, numeric

 

round(X)

Rounds X up or down to the nearest whole number

   

size(S)

Takes the name of a fixed-membership submodel and returns the number of instances that it has.

   

size(S,I)

Takes the name of a fixed-membership submodel and returns the size of one of its dimensions

submodel, numeric

 

sqrt(X)

Returns the square root of X

   

stop(X)

Stops the simulation, displaying value of X in a popup message

   

sum([X])

Result is the sum of all elements of the argument

numeric array/list

 

time()

Returns the current simulation time (the argument is ignored)

   

with_greatest([N],[X])

with_greatest{[N},{X})

Returns the value from an array [X] or the list {X} whose position in the array or list corresponds to the largest value in the array [N] or list {N}

numeric array/list, any array/list




 

with_least([N],[X])

with_least{[N},{X})

Returns the value from an array [X] or the list {X} whose position in the array or list corresponds to the smallest value in the array [N] or list {N}

numeric array/list, any array/list




 

In addition, a full range of trigonometric functions are provided.

In: Contents >> Working with equations >> Functions