Chinmai Raman

Classwork 3

5.49 Experience Overflow in a Function

Calculates an exponential function and returns the numerator, denominator and the fraction as a 3-tuple


In [5]:
import numpy as np

import boundary_layer_func1 as p1
import matplotlib.pyplot as plt

# Needed only in Jupyter to render properly in-notebook
%matplotlib inline

In [6]:
x = np.linspace(0,1,10000)
y1 = p1.v(x, 1, np.exp)[2]
y2 = p1.v(x, 0.1, np.exp)[2]
y3 = p1.v(x, 0.01, np.exp)[2]

fig = plt.figure(1)
plt.plot(x, y1, 'b')
plt.plot(x, y2, 'r')
plt.plot(x, y3, 'g')
plt.xlabel('x')
plt.ylabel('v(x)')
plt.legend(['(1 - exp(x / mu)) / (1 - exp(1 / mu))'])
plt.axis([x[0], x[-1], min(y3), max(y3)])
plt.title('Math Function')
plt.show(fig)



In [ ]: