-
Notifications
You must be signed in to change notification settings - Fork 865
Utility Module Reference
We just started working on documenting all of the utility functions. A great way to help out and become more familiar with the modules is to help us expand the documentation by editing the reference wiki. Feel free to adjust formatting, re-organize, whatever makes it easier for everyone to find the utility modules they need.
`cleanMath( expr )`Simplify formulas before display by removing, eg,
+ -
,- -
, and^1
rand( num )
Returns a random int in
[0, num)
digits( n )
Returns an array of the digits of a nonnegative integer in reverse order
digits( 376 ) = [ 6, 7, 3 ]
integerToDigits
Returns an array of the digits of a nonnegative integer
digits( 376 ) = [ 3, 7, 6 ]
digitsToInteger
Returns an integer from an array of the digits
digits([ 6, 7, 3 ]) = 673
padDigitsToNum
powerToPlace
roundTowardsZero
getGCD
getLCM
getPrime
isPrime
isOdd
isEven
getOddComposite
getEvenComposite
getComposite
getPrimeFactorization
getFactors
getNontrivialFactor
getMultiples
splitRadical
randRange
randRangeUnique( min, max, count )
Returns an array (of size count) of unique numbers between min and max
randRangeWeighted
randRangeExclude
randRangeWeightedExclude
randRangeNonZero
randFromArray
randFromArrayExclude
roundTo
floorTo
ceilTo
toFraction
shuffle
sortNumbers
truncate_to_max
restoreSign
isInt
decimalFraction
reduce
toFractionTex
fraction
mixedFractionFromImproper
mixedFraction
fractionReduce
fractionSmall
piFraction
reduces
fractionSimplification
mixedOrImproper
splitRadical
formattedSquareRootOf
squareRootCanSimplify
cardinal
Cardinal
quadraticRoots
commafy
plus
randVar
`plural( ... )`Returns a random algebraic variable (such as "x", or "y" ) to use in expressions.
Pluralization helper
Return “s” if NUMBER is not 1:
plural( NUMBER )
If necessary, magically pluralize and return “NUMBER word”:
plural( NUMBER, singular )
Return “NUMBER word”:
plural( NUMBER, singular, plural )
If necessary, magically pluralize and return “word”:
plural( singular, NUMBER )
Return “word”:
plural( singular, plural, NUMBER )
person( i )
Returns a person’s name from the shuffled list
personVar( i )
Returns the lower case first letter of the person’s name
he( i )
Returns “he” or “she”
He( i )
Returns “He” or “She”
him( i )
Returns “him” or “her”
his( i )
Returns “his” or “her”
His( i )
Returns “His” or “Her”
An( word )
Returns “A”, or “An” if
word
starts with a vowel
an( word )
Returns “a”, or “an” if
word
starts with a vowel
vehicle( i )
Returns a type of vehicle from the shuffled list
vehicleVar( i )
Returns the lower case first letter of the vehicle type
course( i )
Returns the name of a course (algebra, Spanish, etc.) from the shuffled list
courseVar( i )
Returns the lower case first letter of the course name
exam( i )
Returns a synonym for exam (test, quiz, etc.) from the shuffled list
binop( i )
Returns an unusual character symbol (diamond, circle, etc.) from the shuffled list.
item ( i )
Returns an item that can be grouped
see also:
group()
groupVerb()
group( i )
Returns the name of a group of items
see also:
item()
groupVerb()
groupVerb( i )
Returns the verb describing grouping a type of item
see also:
item()
group()
store( i )
Returns a type of store/shop
storeItem( i, j )
Returns an item that can be bought at a particular store
i
: which store in the shuffled listj
: which item in the shuffled listsee also: store
pizza( i )
Returns a round food item
exercise( i )
Returns a physical exercise
timeofday( i )
Returns a rough time of day (in the morning, at night, etc.)
school( i )
Returns the name of a school
clothing( i )
Returns an article of clothing
color( i )
Returns the name of a color
fruit( i )
Returns the name of a piece of fruit
deskItem( i )
Returns the name of an office supply
distance( i )
Returns a unit of distance (miles/kilometers)
rode( i )
Returns the past tense verb for an activity
see also:
ride()
bike()
biked()
biking()
ride( i )
Returns the infinitive verb for an activity
see also:
rode()
bike()
biked()
biking()
bike( i )
Returns the object noun for an activity
see also:
rode()
ride()
biked()
biking()
biked( i )
Returns a more specific past tense verb for an activity
see also:
rode()
ride()
bike()
biking()
biking( i )
Returns the present progressive tense verb for an activity
see also:
rode()
ride()
bike()
biked()
farmer( i )
Returns a type of farmer
see also:
crop()
field()
crop( i )
Returns the name of the crop grown by a farmer
see also:
farmer()
field()
field( i )
Returns the type of field used by a farmer
see also:
farmer()
crop()
side( i )
Returns “left” or “right”
shirtStyle( i )
Returns a style of shirt
scaleVector
scalePoint
circle
ellipse
arc
path
line
grid
label
plotParametric
plotPolar
plot
init
style