Search code examples
maple

Is there a Kronecker symbol in Maple?


The kronecker-symbol for two integers n,m is defined as 1 if n=m and 0 otherwise.

Is there an inbuilt kronecker-symbol in maple or an easy way to implement it?

Sorry, if I should have overlooked something trivial, the maple-homepage is down at the moment and google did not return anything helpful.

Edit: I Just found something useful here:

restart:
delta := table(symmetric,identity);
simplify(delta[1,2]);
simplify(delta[1,1]);

        delta := TABLE(symmetric, identity, [])
                           0
                           1

However it does not seem to simplify even trivial expressions with symbols:

simplify(delta[n,n]);
simplify(delta[n,n+1]);

                      delta[n, n]
                    delta[n, n + 1]

where one would expect to obtain 1 and 0, respectively.

Edit 2: I also tried it this way:

restart:
delta := proc(n,m):
    if n=m then 1 else 0 fi;
end;
delta(1,2);
delta(1,1);
delta(n,n);

0
1
1

However, this also works poorly for symbols, as

delta(n,m);

returns 0.


Solution

  • Try this delta:= (m,n)-> `if`(evalb(m < n)::truefalse, `if`(m=n,1,0), 'procname'(m,n)) ;