Question: How to make a recursion return a symbolic output

Please refer to this for the definition(s):

The hy(a,n,b) recursion turns  into the following Maple code:


Unfortunately this code depends on x and y being explicit numeric values (x,y \in N), otherwise the recursion crashes (if I ask for example H(2,x,y) or H(2, x, 2))

Is there any way to transform the code so that the final construct can be shown symbolically?

I don't see anything obvious, especially since if y is not a specific natural number the recursion will crash. Can we maybe force Maple to not evaluate it for natural number arguments and return the final construct as either a sum, product or tower of the symbols for x and y (i.e. symbols of the digits of x and y like a tower of 2's 3's, etc)?

I do remember something about putting primes around functions prevents premature evaluation, but in this case it doesn't do anything like I'd want. This definition is not primitive recursive (like that of the Ackerman function), so I don't expect it to be able to be called abstractly (H(2,x,y) or something else such), but maybe we can turn it into something that shows the structure of the final construct as symbols of the digits of x and y?



PS: One can improve the situation a bit, by implementing the extended definition as:

hy := proc (n, x, y) if n = 0 then y+1 elif n = 1 then x+y else if y = 1 then x else if n = 2 then x*y elif n = 3 then x^y elif n = 4 then x^hy(4, x, y-1) else hy(n-1, x, hy(n, x, y-1)) end if end if end if end proc

(which can be called abstractly for n=0,1,2,3,4 (hy(n,x,m) for natural m), but for higher n it crashes similar to H, since the definition falls back to the previous if n>4.

Please Wait...