# Demonstration Python 3 module # Scientific Computing, Fall 2021, goodman@cims.nyu.edu # convert from double to single precision import numpy as np # Put all the names defined by the module numpy # into a namespace np. import numpy as np print("getting started") dpi = np.pi # should be double precision, 64 bits print("The type of dpi is " + str(type(dpi))) dpi = np.float64(np.pi) print("The type of dpi is " + str(type(dpi))) spi = np.float32(np.pi) print("The type of spi is " + str(type(spi))) dif = dpi - spi print("The type of dif is " + str(type(dif)) + ", and the value is " + str(dif)) sep = np.exp(spi) dep = np.exp(dpi) print("The type of sep is " + str(type(sep)) + ", and the value is " + str(sep)) print("The type of dep is " + str(type(dep)) + ", and the value is " + str(dep)) dif = dep - sep print("The type of dif is " + str(type(dif)) + ", and the value is " + str(dif))