# Julia says 0^0 = 1 while Python says it is 0. Who is right?

**URL:** <https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311>\
**Category:** Offtopic\
**Created:** [August 12, 2021, 11:14pm UTC](https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311 "2021-08-12T23:14:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cybervigilante](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cybervigilante/32/26687_2.png) [@cybervigilante](https://discourse.julialang.org/u/cybervigilante)\
**Post date:** [August 12, 2021, 11:14pm UTC](https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311/1 "2021-08-12T23:14:16Z")

</div>

julia: 0^0 = 1  
Python: 0^0 = 0

Who is right? A plot shows where Python falls down:

```julia
Y = [x^x for x in 1:-.0001:.0001]
X = [x for x in 1:-.0001:.0001]
using Plots
plot(X,Y,title="Death curve of Python")
println(minimum(Y))
println(Y[end])

```

![death curve of python](https://global.discourse-cdn.com/julialang/original/3X/2/4/24269c1464b16c18864d8204253d7fb3d29ee7f9.png)

0.6922006279529819  
0.9990793899844618

x^x does indeed get smaller as x gets smaller, as Python thinks, but then starts to get larger as x gets even smaller, at around x^x = .699

You can see this with Calculus, but after computing reaches the smallest Planck limit ,and it’s obvious this is a digital universe, Calculus will only be taught in history classes, alongside other myths like ancient religions. Newton pulled the wool over everyone’s eyes in order to get where he had to. But millions of math freshmen have suffered from the fantasy of infinitesimals. We will all soon be free of them. 😜

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [August 12, 2021, 11:16pm UTC](https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311/2 "2021-08-12T23:16:56Z")

</div>

In Python, the exponent operator is `**`, not `^`.

```julia
>>> 0**0
1

```

So Julia and Python give the same answer.

```julia
julia> 0^0
1

```

---

<div class="post-metadata">

**Author:** ![cybervigilante](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cybervigilante/32/26687_2.png) [@cybervigilante](https://discourse.julialang.org/u/cybervigilante)\
**Post date:** [August 12, 2021, 11:22pm UTC](https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311/3 "2021-08-12T23:22:35Z")

</div>

I know. I just wanted to poke fun at Calculus. That, or having abandoned Python I forgot they had an awkward exponentiation operator. 😃

---

<div class="post-metadata">

**Author:** ![Jeff\_Emanuel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff_emanuel/32/15440_2.png) [@Jeff\_Emanuel](https://discourse.julialang.org/u/Jeff_Emanuel)\
**Post date:** [August 13, 2021, 3:15pm UTC](https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311/4 "2021-08-13T15:15:13Z")

</div>

To complete the equivalences, Julia gives the same answer for what ^ does in Python:

```julia
julia> xor(0,0)
0

```

---

<div class="post-metadata">

**Author:** ![j\_verzani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_verzani/32/8551_2.png) [@j\_verzani](https://discourse.julialang.org/u/j_verzani)\
**Post date:** [August 14, 2021, 12:10am UTC](https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311/5 "2021-08-14T00:10:22Z")

</div>

Have fun reading this: [Zero to the power of zero - Wikipedia](https://en.wikipedia.org/wiki/Zero_to_the_power_of_zero) !

---

<div class="post-metadata">

**Author:** ![blackeneth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blackeneth/32/10353_2.png) [@blackeneth](https://discourse.julialang.org/u/blackeneth)\
**Post date:** [August 14, 2021, 1:14am UTC](https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311/6 "2021-08-14T01:14:44Z")

</div>

Next, let’s discuss if [1] is a matrix or a scalar.

---

<div class="post-metadata">

**Author:** ![cybervigilante](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cybervigilante/32/26687_2.png) [@cybervigilante](https://discourse.julialang.org/u/cybervigilante)\
**Post date:** [August 14, 2021, 5:18am UTC](https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311/7 "2021-08-14T05:18:49Z")

</div>

Ha ha, looking at that Wiki, and the seesaw back and forth between 0,1, and Undefined, it almost appears that mathematicians sometimes just Make Things Up 😀  
But Sagemath also says 1, and Sagemath and Julia are The math standards now, IMHO.

---

<div class="post-metadata">

**Author:** ![cybervigilante](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cybervigilante/32/26687_2.png) [@cybervigilante](https://discourse.julialang.org/u/cybervigilante)\
**Post date:** [August 14, 2021, 5:20am UTC](https://discourse.julialang.org/t/julia-says-0-0-1-while-python-says-it-is-0-who-is-right/66311/8 "2021-08-14T05:20:14Z")

</div>

Oh, that’s an easy one - I always just defer to Julia:  
julia\> [1]  
1-element Vector{Int64}:  
1
