I am trying to graph as a function of r the probability for finding the electron in the ground state of the two dimensional and three-dimensional hydrogen atom. The code I have right now is:
import math
import matplotlib.pyplot as plt
import numpy as np
def three_dimensional(radius):
bohr = (5.2917721067)*10**(-11)
use_radius = []
for i in radius:
new_rad = bohr*i
use_radius.append(new_rad)
answers = []
for i in use_radius:
R_r = (2//(bohr)**(3//2))*math.exp(-i/bohr)
answers.append(R_r)
probability = []
for i in answers:
probs = i^2
probability.append(probs)
print(answers)
return plt.contour(answers, probability)
I am getting the error:
TypeError: unsupported operand type(s) for ^: 'float' and 'int'
What is the best way to fix this?