You are here

Working with equations : Built-in functions

Built-in functions

Alphabetical list of most commonly used functions,  Trigonometric functions are listed separately. Please see the other categories at the bottom of the page for less common or recently added functions.

 Template  Effect

Input(s)

Return

value

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

 Boolean

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

 Boolean
at_init(X) Returns X's value when last initialized or reset Any Same as input

at_posn(C)

at_posn(C, X, Y)

Causes component to get value from instance of C in a grid submodel Any, two optional integers Scalar as 1st argument
binome(P, N) Returns a value from the binomial distribution with probability P and number of trials N

Real value from 0 to 1,                  Integer value

Integer value

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.

   
colin([X]) Returns an index to the given array, with probabilities proportional to the array's values Array of numeric values Integer or enumerated type member
const_delay(X, T) Returns the value of X as it was T time units earlier in the run, or 0 or "false" if the component did not exist at that time Any non-array type, numeric constant As 1st argument

count([X])

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

scalar array/list

 

delay1(x,t), delay3(x,t), delayn(x,t,n)

Insert a material delay of order 1, 3 or n

numerical

numerical, numerical, integer (delayn only)
dies_of(X) X is a loss channel. True if channel specifies the removal of the individual this time step. from loss channel Boolean

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 or enumerated type member

 

exp(X)

Returns e to the power X

   

exprnd(mean [, seed])

Samples an exponential distribution

numerical[, integer] numerical
first(T) Returns "true" if argument is the first member of its enumerated type Enumerated type member Boolean
firsttrue([B]) Takes an array of booleans and returns the index of the first with value "true" Array of booleans Integer or enumerated type member

floor(X)

Rounds X down to a whole number

   

fmod(X,Y)

Returns remainder after dividing X by Y

numeric, numeric

 
following(T) Returns next member of argument's enumerated type Enumerated type member Enumerated type member
forcst(input, time, horizon [, initial]) New in v6.6: Performs simple trend extrapolation Real, real, real [,real] Real
gaussian_var(X,Y) Returns a sample from a Gauusian distribution with mean X and SD Y Real, real real

greatest([X])

greatest({X})

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

numeric array/list

 
howmanytrue([B]) Takes an array of booleans and returns the number that are true List or array of booleans Integer
hypergeom(P, M, S) Returns a deviate from a hypergeometric distribution for population, P, number of marks M, and sample size S. integer, integer, integer integer

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.

 Integer Integer or enumerated type member

inf()

New in v6.6: Returns the value of positive infinity.

 Real None

init_time(1)

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

   
in_preceding(X) New in Simile v5.7: Returns value of X in preceding submodel instance Any scalar or array type As argument
in_progenitor(X) New in Simile v5.8: Returns value of X in submodel instance that reproduced to make current one Any scalar or array type As argument

int(X)

Returns integer part of X

   
interpolate(X, [Xarray], [Yarray]) Returns interpolated value from [Yarray] corresponding to X's place in Xarray

Numeric, Array of numeric, Array of numeric

Numeric
iterations(B) Counts executions of iterative submodel Boolean Integer

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, integer

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

 
order([X]) Returns an array holding the indices of the argument array in ascending order of their values array of numeric array of integer

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

   
poidev(X) Returns a value from the Poisson distribution with the given mean numeric integer
posgreatest([X]) Returns the index of the highest value in the argument array Array of numeric values Integer or enumerated type member
posleast([X]) Returns the index of the lowest value in the argument array Array of numeric values Integer or enumerated type member

pow(X,Y)

Returns X raised to the power Y

numeric, numeric

 numeric
preceding(T) Returns previous member of argument's enumerated type Enumerated type member Enumerated type member

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

numeric

pulse(H, T [, I])

Generates a single time step pulse of magnitude M at time T, and before or after at intervals of I if I present

numeric, numeric, numeric

numeric

ramp(T,S)

Generate a linearly increasing or decreasing value over time with the given slope

numeric, numeric

numeric

rand_const(X,Y)

(Deprecated) Returns a random number between X and Y, 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

 
rankings([X]) Returns ranking of each element in order of size Array of numerics Array of integers

round(X)

Rounds X up or down to the nearest whole number

   
sgn(X) Returns the size of X; -1 if negative, 1 otherwise    

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

 

smth1(x,a), smth3(x,a), smthn(x,a,n)

Insert a material smoothing of order 1, 3 or n

numerical

numerical, numerical, integer (smthn only)

sqrt(X)

Returns the square root of X

   

step(H, T)

Generate a step increase (or decrease) at the given time

numeric, numeric numeric

stop(X)

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

   
subtotals([X])

Returns running totals from summing the elements in the supplied array

Numeric array Numeric array

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)

   
trigger_magnitude() Returns value of triggering event    As triggering event
var_delay(X,T) Returns value of X as it was T time units earlier in run, or 0 or "false" if this is before component existed Any non-array type, numeric expression As first argument

with_colin({N},{X})

Returns a value from the list {X} with probabilities proportional to the corresponding values in the list {N}

numeric list,       any list

member of second arg

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

Comments

Please note that these are NOT all the built-in functions in Simile. Do not forget to check the links below for other functions available. Also helps to do a global search for a function that you are looking for. You might be lucky to guess how it's called.

Thanks for drawing our attention to the fact that the alphabetical list is incomplete. Work is starting to bring the list up to date.