# whatIf? Wiki

### Site Tools

tool_reference_manual

Until full reference manual is ported to wiki, use this to document TOOL updates.

## A

abs : absolute value
a[x] = abs (b[x])

a[x,y] = b[x,y] + c[x,y] {add (b[x,y], c[x,y])}
a[x,y] = b[x,y] + c[x] {add (b[x,y], c[x])}

agetime : transform age to birth time
a[..,birthDate,t] = agetime (b[..,age,t]; {dimName=birthDate})

animalstk : evolve animal population
stock[..,t,s,a], culled[..,t,s,a], slaughtered[..,t,s,a] =

animalstk (base[..,s,a], cullRate[..,t,s,a],
fertility[..,t,a], genderShr[..,t], slaughterRate[..,t,s,a];
{demand=stockDemand[..,t], importDistr[..,t,s,a],
exportDistr[..,t,s,a], netExport[..,t,s,a]})

assign {=} : assign data from one object to another
a[x,y] = b[x,y] {assign (b[x,y])}
a[u,v] = assign (b[x,y]; checkDims=off)

avg : average of
a[x] = avg (b[x,y]; dim=y)

## C

create() syntax:

```A[X1,..,Xn] = create (; {object=array},
dim=dimString(X1), ...,dimString=Name(Xn),
{dimFromi=D[..]},{SIuom=uomStr,{metre=ni, m=ni},
{kilogram=ni, kg=ni},{second=ni, sec=ni, s=ni},{degreeC=ni, degC=ni},
{altUom=altUomStr}, {entity=entStr},
{SIuomFrom=S[..]}, {altUomFrom=T[..]}, {entityFrom=E[..]},
{dataType={real, integer}},{desc=descrStr},
{format={agg,coord,record,mdi}, useIndex={on,off},
{translate1=string1, .., translaten=stringn,..,value1=number1,..,valuen=numbern,
...,format dependent parameters...)```

parameter precision={single,double} for real objects

## G

getobjinfo (B[X1,..,Xn], \$infoVar; info={extent, dim=Xj}, {extents},{dataElement, {..dimi=elementName..}}, {sequence, dim=Xj},{sequenceName, dim=Xj}, {sequenceStart, dim=Xj},{sequenceEnd, dim=Xj} {sequenceStep, dim=Xj},{sequenceInterval, dim=Xj}) - the default parameter is not documented.

## M

multiply()
enhanced multiply

• dimensions can be out of order
• dimensions do not need to overlap (multiply takes over from outer)
• essentially this means you may multiply any two objects together, period.

some examples:

```a[p,t] = b[p,t] * c[t,p]
a[p,t] = b[p] * c[t]
a[m->z,g,t,a] = b[m,g] * c[m->z,t,a]
etc```

## N

norm : normalize
a[x,y,t] = norm (a[x,y,t]; dim=x)
a[x,y,t] = norm (a[x,y,t]; dim1=x,dim2=y)
a[x,y,t] = norm (a[x,y,t]; dim=all)

## S

sum
multi-dim sum

```a[p,t] = sum (b[p,g,t,a]; dim1=gender, dim2=age)
a[p,x,t,n] = sum (b[p,x->y,g,t,a]; dim1=gender, dim2=age, dim3=x->y@y, dim4=n->m@m)
a[] = sum (b[p,g,t,a]; dim=all)```