SteveHopwood wrote:garyfritz wrote:If it would be helpful, I would be happy to provide a quick summary of what the [MathXXX functions] do,
That would be fabulous, thanks.
OK, here are all the MathXXX functions. Some are probably obvious but I'll cover them all.
MathAbs(X) -- absolute value of X. MathAbs(3) = 3, MathAbs(-3) = 3.
MathMax(X,Y), MathMin(X,Y) -- the largest or smallest of two numbers.
MathMod(X,Y) -- the "modulo" function, which returns the remainder of a division. E.g. 7 / 3 = 2.333, or "2 with 1 remainder." MathMod(7,3) returns 1 -- the remainder of the 7/3 division. Non-integer values work -- e.g. MathMod(8.3,2.5) returns 0.5, because 3*2.5 = 7.5, and there is 0.8 "left over" between 7.5 and 8.3.
MathRound(X) -- the nearest integer value. MathRound(2.1) = 2.0, MathRound(-2.1) = -2.0.
MathFloor(X), MathCeil(X) -- The closest lower or higher integer value. MathFloor(2.2) = 2.0, MathCeil(2.2) = 3.0. MathFloor(-2.2) = -3.0, MathCeil(-2.2) = -2.0.
MathSqrt(X) -- square root of X.
MathPow(X,Y) -- X raised to the Y power. So MathPow(2,3) = 8, because 2^3 = 8. Non-integral values work. MathSqrt(X) == MathPow(X,1/2).
MathExp(X), MathLog(Y) -- the constant e (~= 2.71828) raised to the X power, or the natural log (base e) of Y. (Don't ask why they use base e. It's a deep involved mathematical explanation. Imagine trying to explain Myxolidian mode to someone who's never heard music.

) These are inverses of each other, so if MathLog(A) = B, MathExp(B) = A. Since MathExp(X) is e raised to the X power, MathExp(X) = MathPow(e,X). Logarithms are easiest to understand if you look at base-10 logs. The Log10 of X is the value that satisfies 10^Y = X. So e.g. log10(100) = 2.0, because 10^2.0 = 100. Non-integral values also work, e.g. log10(4321) = 3.6356, because 10^3.6356 = 4321. MQL only supports natural (base e) log, but you can get log10 from MathLog: log10(X) = MathLog(X) / MathLog(10).
MathSrand(X), MathRand() -- Pseudo-random number generator. (Because software cannot generate truly random numbers.) MathSrand() starts or "seeds" the random series. You might feed it TimeLocal() to give it a nice semi-random start. MathRand() pulls the next random number in the sequence.
MathCos(X), MathSin(X), MathTan(X) -- sine, cosine, tangent of X. Probably not used all that much in EAs.
MathArccos(X), MathArcsin(X), MathArctan(X) -- the *inverse* of the above. So if Mathcos(X) = Y, then MathArccos(Y) = X.