You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MathS.Mod(7, 3) // 1
"(-7) mod 3".ToEntity().Evaled // 2
There is now a Modf node with the parser, MathS.Mod, the % operator on Entity, evaluation, simplification, differentiation, limits, both compilers, LaTeX and SymPy export.
On the second half of your request — % in AngouriMath.Interactive — it needed no wrapper code at all. F# resolves % through op_Modulus, which is what the operator on Entity compiles to, so a % b in F# builds the kernel's node directly. There are F# tests covering it.
Two notes on what it does, since both were decided deliberately:
The remainder is floored and takes the sign of the divisor, so (-7) mod 3 is 2 rather than -1. That is what a mathematician means by mod, and what SymPy, Mathematica and Maxima all answer; C's % truncates, but that is an operation on machine integers.
In a parsed string it is written mod, not %. % is left free to mean percent, which is what it means in mathematical writing. The %operator in C# and F# source is unaffected.
AngouriMath.MathS.Modulus should be usable. Override
(%)in AngouriMath Interactive too.