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...


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 dramatically18, 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 function


here 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 µ is very small and related to the viscosity of air. With a small value of µ, it becomes difficult to calculate v(x) on a computer. Make a function v(x, mu=1E-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 x values between 0 and 1 in a for loop, let mu be 1E-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 µ = 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.

Nov 22, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here