In> Div(5,3) Out> 1; In> Mod(5,3) Out> 2; |
Routine for calculating Gcd(n,m) 1) if n = m then return n 2) if both n and m are even then return 2*Gcd(n/2,m/2) 3) if exactly one of n or m (say n) is even then return Gcd(n/2,m) 4) if both n and m are odd and, say, n>m then return Gcd( (n-m)/2,m) |
Gcd({a,b,c}) = Gcd(Gcd(a,b),c) |
In> Gcd(55,10) Out> 5; In> Gcd({60,24,120}) Out> 12; |
Lcm(n,m) = Div(n*m,Gcd(n,m)) |
In> Lcm(60,24) Out> 120; |
Examples: 1<<10; should evaluate to 1024 -1024>>10; should evaluate to -1 |
n = a0 +a1*p +a2*p^2+...
So for instance
In> PrettyForm(PAdicExpand(1234,10)) 2 3 4 + 3 * 10 + 2 * 10 + 10 Out> True; |
In> PrettyForm(ContFrac(N(Pi))) 1 3 + --------------------------- 1 7 + ----------------------- 1 15 + ------------------ 1 1 + -------------- 1 292 + -------- 1 + rest |
Example:
In> Decimal(1/22) Out> {0,0,{4,5}}; In> N(1/22,30) Out> 0.045454545454545454545454545454; |
The library uses the formula
/ r \ r - MathFloor| ------ | * 2 * Pi \ 2 * Pi / |
In> 2*Pi() Out> 6.283185307; In> TruncRadian(6.28) Out> 6.28; In> TruncRadian(6.29) Out> 0.0068146929; |