0
Unprotect[Power];
Power[0|0., 0|0.] = 1 ;
Protect[Power];

Table[0^0, {i, 5}]

No problem at all.

 ParallelTable[0^0, {i, 5}]

becomes a problem.

How can I set this for all kernels?

Thanks!

Chen Stats Yu
  • 4,986
  • 2
  • 24
  • 50
  • 6
    May very seriously break built-in functions or alternatively the rule could magically disappear at any time without warning. I would not recommend this approach. Instead Block Power as some other function with the required behavior. – Oleksandr R. Feb 07 '15 at 00:43
  • @OleksandrR. Is MMA using this Power of 0^0 somewhere as a trick? Why would it seriously break built-in functions? I am a bit curious. As Maple define 0^0 to be 1. So no adjustment is need. I dont want to argue about why this definition is need sometimes. But I can't think of any harm if we simply define 0^0=1. – Chen Stats Yu Feb 07 '15 at 00:48
  • 1
    I think this definition is fine as long as everyone agrees on it. But in reply to your opening question: we simply can't know. So, by all means do this, but preferably not by directly re-defining the built-in Power. – Oleksandr R. Feb 07 '15 at 01:20
  • 1
    Have you tried the method I proposed here?: (60575). I didn't write that with parallel computation in mind but I think it would work, though I have no time to properly test this now. – Mr.Wizard Feb 07 '15 at 12:45
  • @OleksandrR. For the moment, I think I will stick to your Block Power method. I dont want anything unexpected to happen. – Chen Stats Yu Feb 07 '15 at 14:20

1 Answers1

1

Put the protect/unprotect into the table:

ParallelTable[Unprotect[Power]; Power[0 | 0., 0 | 0.] = 1; Protect[Power]; 0^0, {i, 5}]

I'm not sure how to do it globally, but you can make it a bit less painful if ParallelTable has to be called many times:

setPow := (Unprotect[Power]; Power[0 | 0., 0 | 0.] = 1; Protect[Power];);
ParallelTable[setPow; 0^0, {i,5}]
bill s
  • 68,936
  • 4
  • 101
  • 191
  • Thanks. Would there be a more "global" way of doing it? What if I have many calls of such "ParallelTable"? It would not be very efficient to type that for every single call. – Chen Stats Yu Feb 07 '15 at 00:44