# Indeterminate expression 0^0 encountered

I'm new to Wolfram Mathematica so the the question may seem quite simple.

I define the following function:

d[i_, j_] :=
Sum[α^(i + j - 2 k) (-1)^(-k) Sqrt[i!] Sqrt[j!]/((i - k)! (j - k)! k!), {k, 0, Min[i, j]}]


Then, when I set α = 0 and try to evaluate d[0, 0] I get the following warning:

Power::indet: Indeterminate expression 0^0 encountered.

How can I input the condition Power[0,0]=1 in my function ?

• Could add alpha as a symbolic parameter, and eval symbolically before substituting a value. d[i_, j_, alf_] := Module[{aa}, Sum[aa^(i + j - 2 k)*(-1)^(-k)*Sqrt[i!] *Sqrt[j!]/((i - k)!*(j - k)!*k!), {k, 0, Min[i, j]}] /. aa->alf] In[16]:= d[0,0,0] Out[16]= 1 Sep 24, 2014 at 20:37
• (8403626) Oct 27, 2014 at 6:19

Although it is best to avoid this when possible, using the undocumented function InternalInheritedBlock you can temporarily add a rule to Power:

α = 0;

d[i_, j_] := InternalInheritedBlock[{Power},
Unprotect[Power];
Power[0, 0] = 1;
Sum[α^(i + j - 2 k) (-1)^(-k) Sqrt[i!] Sqrt[j!]/((i - k)! (j - k)! k!), {k, 0,
Min[i, j]}]
]

d[0, 0]

1


Be aware that user rules for System functions may be ignored when working with packed arrays. See: Block attributes of Equal

Generally better is to use a proxy replacement for Power with your own behavior:

Attributes[myPower] = {Listable};
myPower[0, 0] = 1;
myPower[x_, y_] := x^y;

d[i_, j_] :=
Sum[myPower[α, (i + j - 2 k)] (-1)^(-k) Sqrt[
i!] Sqrt[j!]/((i - k)! (j - k)! k!), {k, 0, Min[i, j]}]


The Listable attribute makes sure that zeroes in vectors and matrices are also handled in the way we defined:

In[2]:= myPower[0, {{1, 1}, {1, 0}}]

Out[2]= {{0, 0}, {0, 1}}

• The OP's coding gives me 1 for d[0,0]. Maybe she or he only had a dirty kernel?
– eldo
Sep 24, 2014 at 20:33
• @eldo I think you forgot to also start with \[Alpha] = 0 as specified. Sep 24, 2014 at 20:37
• Thank you so much for the best answer!
– Suro
Sep 24, 2014 at 20:50
• Since the second part of your post seems to be the definite answer (and the safest) for these kinds of questions (this and this), I've included the more general case. Hope you don't mind it! Oct 31, 2018 at 19:42
• Also, do you have any idea how to make myPower compilable or use it in a CompiledFunction? Oct 31, 2018 at 20:18

Here is a variation of @Daniel's answer from his comment:

α = 0;
Block[{α}, d[0, 0]]


1