Experience overflow in a function.
When an object (ball, car, airplane) moves through the air, there is a very,
very thin layer of air close to the object's surface where the air velocity
varies dramatically \(^{18}\), from the same value as the velocity of the object
at the object's surface to zero a few centimeters away. The change in velocity
is quite abrupt and can be modeled by the functiion
$$
v(x)=\frac{1-e^{x / \mu}}{1-e^{1 / \mu}}
$$
where \(x=1\) is the object's surface, and \(x=0\) is some distance away where one
cannot notice any wind velocity \(v\) because of the passing object \((v=0)\). The
vind velocity coincides with the velocity of the object at \(x=1\), here set to
\(v=1\). The parameter \(\mu\) is very small and related to the viscosity of air.
With a small value of \(\mu\), it becomes difficult to calculate \(v(x)\) on a
computer.
Make a function \(v(x, m u=1 E-6\), exp=math.exp) for calculating the formula
for \(v(x)\) using exp as a possibly user-given exponentional function. Let the
v function return the nominator and denominator in the formula as well as the
fraction (result). Call the v function for various \(\mathrm{x}\) values between
0 and 1 in a for loop, let mu be \(1 \mathrm{E}-3\), and have an inner for loop
over two different exp functions: math. exp and numpy. exp. The output will
demonstrate how the denominator is subject to overflow and how difficult it is
to calculate this function on a computer.
Also plot \(v(x)\) for \(\mu=1,0.01,0.001\) on \([0,1]\) using 10,000 points to see
what the function looks like. Name of program file: boundary_layer_func1.py.