Icon

Unary Recursive Function Interpreter

Urfidesh is an interpreter made in J2ME (java for mobiles). Just write the function you want to evaluate!

Initial functions are:
Zero constant Z(x) = 0
One constant 1(x) = 1
Two constant 2(x) = 2
Successor function S(x) = x + 1
Double function D(x) = 2x
Predecessor function P(x) = x - 1, if x > 0
P(0) = 0
Identity function I(x) = x
Square function Sq(x) = x*x
Square root function Rt(x) = floor(sqrt(x))
Power of zero O(x) = 0, if x > 0
O(0) = 1
Half function Hf(x) = floor(x/2)
Alternation function N(x) = 1, if x is odd
N(x) = 0, otherwise
Power of two Pw(x) = 2^x
Char. of squares Q(x) = 1, if x is a square number
Q(x) = 0, otherwise
Excess over a square E(x) = x - Sq(Rt(x))
M function M(x) = x mod 3
T function T(x) = x + 2Rt(x) (see id:A112594)
Triangular numbers A(x) = xth triangular number
V function V(x) = inverse of A
K function K(x) = first inverse of J
L function L(x) = second inverse of J
W function W(x) = too complicated to explain


You can download it here: Urfidesh.jar, Urfidesh.jad.
Operators are:
Addition F+G(x) = F(x) + G(x)
Substraction F-G(x) = F(x) - G(x), if F(x) >= G(x)
Composition** F G(x) = F(G(x))
Distance |F-G|(x) = |F(x) - G(x)|
Arith. difference F_G(x) = F(x) - G(x), if F(x) >= G(x)
F_G(x) = 0, otherwise
Product F.G(x) = F(x)G(x)
Division F/G(x) = floor(F(x)/G(x)), if G(x) > 0
Cantor function J(F, G)(x) = (see cantor pairing function)
Iteration from 0 F"(x) = F(F(...(F(F(0)))...)) x-times
Iteration from 1 F^1(x) = F(F(...(F(F(1)))...)) x-times
Iteration from 2 F^2(x) = F(F(...(F(F(2)))...)) x-times
F + I F^+(x) = F(x) + x
F - I F^-(x) = F(x) - x, if F(x) >= x
Inversion F*(x) = min value of y such that F(y) = x holds
Summation F#(x) = F(0) + F(1) + ... + F(x)

(**) Spaces are used only for composition.

Precedence:
1) addition, substraction and arith. difference (left assoc.)
2) product, division (left assoc.)
3) composition
4) unary operators
5) parenthesis

Examples:
Successor function (K^1 K K^1)^+
Square function (S T)"
Half function P Rt (E*-I) S
M function (E S S)"
T function (S+D Q S S S S)"
V function Hf P Rt S D D D
K function I-A V


(back)