Fractions: NumCalc tries to give exact results with fractions:
Floating point numbers: You can still get the approximate floating point result by using a decimal point in your input or by using the Float() function:
Functions: all the usual mathematical functions are available such as: sqrt (square root), sin, cos, tab, log (logarithm in base e), exp, ...
Constants are referenced by upper case names, e.g. PI for the pi constant. Example:
Variables: You can store your results in variables and reuse them in the following expressions:
Multiple expressions: You can type several expressions on the same line by separating them with a semicolon.
Binary arithmetic: Use the 0x prefix to enter hexadecimal numbers (e.g. 0x1a). The 0b prefix is used for binary numbers. The output radix can be changed with the \x (hexadecimal) and \d (decimal) directives.
All binary arithmetic functions assume that integers are
represented in two's complement notation. Hence a negative number can
be seen as having an infinite number of '1' to the left.
Complex numbers: use the constant I to enter complex numbers:
Polynomials: use the constant X to enter polynomials. Polynomials are represented internally as an array of their coefficient, so the actual variable used to represent them does not matter. In the calculator, the X variable is used by convention.
Rational fonctions: if you divide two polynomials you get a rational fonction and they can be manipulated as objects too:
Taylor series: Taylor series are created with the O function. Taylor series can be seen as polynomials where all the terms of degrees >= O(X^n) are thrown away. To be more precise, the calculator handles Laurent series as well. It means that the exponents can be negative too.
Example of use:
Linear algebra: Vectors and matrixes are supported. Example:
Enter a 3x3 matrix:
Vectors are also supported:
Primes: isprime(n) and nextprime(n) test if a number is prime using the Miller Rabin probabilistic test. factor(n) factorize a number using trial divisions.
Modulo arithmetic: invmod(a,m) returns the inverse of a modulo m. pmod(a,b,m) compute a^b modulo m with less computational resources than doing a^b%m. It also works with polynomials.
Mod(a, n) represents the residue of a modulo the integer n. It supports the usual operators:
Polynomial modulo P: PolyMod works the same way as Mod but with polynomials:
It uses the libbf library for big integer and floating point number operations.