home

Scientific Computing (Psychology 9040a)

Fall, 2020

A Solution: Radius of a sphere

r = 5.0
v = (4/3) * 3.14 * r**3
print(v)

or using the constant \(\pi\) from NumPy:

import numpy as np
r = 5.0
v = (4/3) * np.pi * r**3
print(v)