Work: Pumping Liquid from a Tank In this example, we use Python to help us calculate the work done in pumping a liquid from a certain shaped tank. Supposed we have a tank 6 meters long whose ends are in the shape of the bottom half of a semicircle of radius 2m, and the tank is full of water (weight density 9800 N/m^3). We want to pump all the water out of a spout which extends ½ meter at the top. It turns out the only thing we need Python for is to compute the integral we set up by hand. To obtain the integral, we place a coordinate system with the origin at the center of the semicircular end (also calling down positive), then theoretically partition the water vertically so each slice of water is the same distance from the top of the spout. Then the work is just the force (weight) of the slice times the distance required to pump it out of the tank. The dimensions of a slice of water y meters from the top of the semicircle are a length of 6, a width of 2x (since x=0 is at the CENTER of the slice, our width ranges from -x to x), and a height of dy. The force is density times volume, which is 9800(6)(2x)dy. The distance the water travels to leave the spout is y+0.5, so the work required to move the slice out of the tank is 9800(6)(2x)(y+0.5)dy. Now we need a relationship between x and y, which is obtained from the equation of the semicircle: x^2 + y^2 = r^2 (and r is 2), so y=sqrt(4-x^2) (we use the positive square root since we took down to be positive). So the work required to pump all the water out of the tank is the integral of 9800(6)(2sqrt(4-x^2))(y+0.5)dy, where y ranges from 0 (at the top of the tank) to 2 (at the bottom of the tank). Now we simply integrate this function in Python, after importing the sympy package, defining y to be a symbolic variable, and defining an expression dW for our integrand. After printing our result, we can convert to a floating point using the evalf command.