Maths() Reference
Download
Ahk Topic
ChangeLog
More Notes
List
- Solve(expression, ahk=false)
- Evaluate(number1, number2)
- Multiply(number1, number2)
- Divide(number1, number2, length=10)
- UniquePmt(series, Index)
- Roots(CSV-seperated-coefficients)
- fact(number)
- Greater(number1, number2, trueforequal)
- Prefect(number)
- Pow(number, Power)
- ModG(Dividend, Divisor)
- RoundG(number, Decimals)
- FloorG(Number)
- Antilog(number, basetouse)
- nthRoot(number, n)
- logB(number, base)
Points
- Solves a Mathematical expression in a string
- Solve() supports infinetly large numbers and its +-/* is powered by the respective custom functions (Evaluate, Multiply, Divide).
- Solve() supports functions() and Nesting via [] brackets ( not () )
- Please use function Pow(number, power) in place of ** in equations
Examples
Msgbox,% Solve("1 + 3.5 - [2 * 3] + Antilog(0.3010, ""e"")")
In the above example notice the use of [...] brackets in
[2 * 3]
. Make sure you use them.
Also, notice the use of double quotes ("") in
Antilog(0.3010, ""e"")
to escape them.
var = sqrt(4) - [nthroot(17248,3) * antilog(0.3010)] * [892839.2382389 - 89238239.923]
msgbox,% Solve(var)
In the above example,
var
has the equation.
Points
- Adds two infinetly large numbers . Supports decimal and negatives.
- Please feed numbers into the function as strings (See below)
number1 = 3292389200000000000382398232309.239230923092302390239230
number2 = 239209239230290239239049349309403434.34930909090
Msgbox,% Evaluate(number1 ,number2)
Msgbox,% Evaluate(number1, "-" . number2)
In the above example, notice the use of
= in place of
:=
To minus two numbers , look at the 2nd Msgbox
"-" . number2
Points
- Feed large numbers as Strings
- Better recommended to keep the length param of Divide as 10 which is default. If you want more preciseness you can move it to anything.
- Divide() has smartround which means something like 0.000000003433423 with a length 3 will not give 0.000 but 0.00000000343
Examples
MsgBox,% Divide("434343455677690909087534208967834434444.5656", "8989998989898909090909009909090909090908656454520", 10)
msgbox,% Divide("22","7",100) ;<--- 100 Decimal places
MsgBox,% Multiply("111111111111111111111111111111111111111111.111","55555555555555555555555555555555555555555555.555")
Points
- Gives roots of a polynomial functions
- Can be slow and buggy at times
- Can be inaccurate
Examples
msgbox,% Roots("1,1,1,-3") ;xcube + xsq + x - 3 = 0
msgbox,% roots("1,1,1,1,-10") ;x4 +xcube + xsq + x - 10 = 0
Points
- Gives unique Permuation for a given Index where Index < No of Permutations
- Make Index = All to list down all possible permutations
Examples
msgbox,% UniquePMT("avi,annat,koiaur,aurkoi", "All") ;no of permutation = 24
msgbox,% UniquePMT("abd", 3) ;no of permutation = 6
- Greater() , fact() , Power() and Prefect() support larger than life numbers . So, feed numbers as strings in them.
- Roots() may have problems . Currently , it seems Roots() has problems with higher deegree polynomials (>3) with larger coffecients (>10). Please dont
try to test equations in Roots(). More often than not, it will not be processed.
- FloorG() and ModG() are just like Floor() and Mod() but for larger numbers
- And dont forget to feed numbers as strings . DONT
More Examples