# Functions

When writing out measurement equations in Seamly, there are many mathematical functions that one may use to make them work seamlessly. This is a list of the functions, with a one-line example of how to actually use them in equations. Functions are served by the muparser math library.

## Basic Functions

These are functions which are so basic that they didn't get included in the list

+ plus (3+4=7)

- minus (3-4=-1)

* times (3*4=12)

/ divided by (3/4=.75)

^ to the power of (3^4=81)

Most of these functions are found in the table, however IF, (& possibly others?) are not in the list. I will list IF first, & then proceed in alphabetical order as the functions appear in the list. It may be better to list them by branch of mathematics, but for now the list, & thus the alphabet, has priority.

Variables are always welcome to be equations, they do not need to be numerals.

#### IF function

• if a<b then c else d looks like ( a<b ? c : d) in Seamly2D formulas.
• if e<f then f else g looks like (e<f ? f : g)
• When d is another test, then it looks like: ( a<b ? c : (e<f ? f : g) )

#### _pi - π

• Definition: π is equal to how many times a diameter can go around its circle. In Seamly it is taken to the fifth decimal place: 3.14159
• Why: To work with circles. For instance, if you want to make a circle of a certain circumference, you might use the equation `head_circ/_pi/2`

#### abs - absolute value

• Definition: a nonnegative number equal in numerical value to a given real number.In other words, "How far is this number from zero?" -2 is still absolutely 2 spaces from zero, even if it's on the wrong side of the tracks.
• Use: abs(N) always returns a positive value
• Why: Because in some equations you might want the difference between two measurements to come back positive regardless of which is larger. I'm sure I've read about such occurrences somewhere.

#### acos - arcus cosine function working with radians

Use: acos(N) where -1≤N≤1

#### acosD - arcus cosine function working with degrees

Use: acosD(N) where -1≤N≤1

#### acosh - hyperbolic arcus cosine function

Use: acosh(N) where N≥1

#### asin - arcus sine function working with radians

Use: asin(N) where -1≤N≤1

#### asinD - arcus sine function working with degrees

Use: asinD(N) where -1≤N≤1

#### asinh - hyperbolic arcus sine function

Use: asinh(N)

Use: atan(N)

#### atanD - arcus tangens function working with degrees

Use: atanD(N)

#### atanh - hyperbolic arcur tangens function

Use: atanh(N) where -1<N<1

#### avg - (average,) mean value of all arguments

Use: avg(N1;N2;N3;…)

Use: cos(N)

Use: cosD(N)

Use: cosh(N)

#### exp - e raised to the power of x

Use: exp(N) If you have as much a clue what this is for as I do, may I suggest the Wikipedia article on the number e?

#### fmod - Returns the floating-point remainder of numer/denom (rounded towards zero)

Use: fmod(N;D)

#### ln - logarithm to base e (2.71828…)

Use: ln(N) where N>0

#### log - logarithm to the base 10

Use: log(N) where N>0

#### log10 - logarithm to the base 10

Use: log10(N) where N>0

#### log2 - logarithm to the base 2

Use: log2(N) where N>0

#### max - max of all arguments

Use: max(N;N1;N2;…)

#### min - min of all arguments

Use: min(N;N1;N2;…)

Use: rint(N)

Use: sign(N)

Use: sin(N)

Use: sinD(N)

Use: sinh(N)

#### sqrt - square root of a value

Use: sqrt(N) where N≥0

#### sum - sum of all arguments

Use: sum(N;N1;N2;…)

Use: tan(N)

Use: tanD(N)

Use: tanh(N)