0
$\begingroup$
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!

$\endgroup$
5
  • 6
    $\begingroup$ 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. $\endgroup$ Commented Feb 7, 2015 at 0:43
  • $\begingroup$ @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. $\endgroup$ Commented Feb 7, 2015 at 0:48
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Feb 7, 2015 at 1:20
  • 1
    $\begingroup$ 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. $\endgroup$
    – Mr.Wizard
    Commented Feb 7, 2015 at 12:45
  • $\begingroup$ @OleksandrR. For the moment, I think I will stick to your Block Power method. I dont want anything unexpected to happen. $\endgroup$ Commented Feb 7, 2015 at 14:20

1 Answer 1

1
$\begingroup$

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}]
$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$ Commented Feb 7, 2015 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.