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

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

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

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

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. :stuck_out_tongue_winking_eye:

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

>>> 0**0
1

So Julia and Python give the same answer.

julia> 0^0
1
10 Likes

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

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

julia> xor(0,0)
0
2 Likes

Have fun reading this: Zero to the power of zero - Wikipedia !

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

2 Likes

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 :grinning:
But Sagemath also says 1, and Sagemath and Julia are The math standards now, IMHO.

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