M152 code
1A
#start code here
y=sp.symbols('y',real=True)
r_squared=1-y**2
#display(r_squared)
formula_1=sp.pir_squared
Volume_top=sp.integrate(formula_1,(y,0,1))
#display(Volume_top)
r_squared2=(ysp.Rational(1,4))**sp.Rational(2)
#display(r_squared2)
formula_2=sp.pi*r_squared2
Volume_bottom=sp.integrate(formula_2,(y,0,4))
#display(Volume_bottom)
Total_Volume=Volume_top+Volume_bottom
print('The Total Volume of Ice Cream is:', Total_Volume)
1B
#start code here
x=sp.symbols('x',Real=True, positive=True)
vol_top=sp.pi*sp.Rational(2,3)x
vol_bot=sp.pisp.Rational(4,3)*x**2
#display(vol_top+vol_bot)
equation_new=vol_top+vol_bot-14.5
soln=sp.solve(equation_new,x)
#print(soln)
volume_checkingwork=equation_new.subs(x,soln[0])
check=volume_checkingwork+14.5
#print(check.evalf())
print('The radius must be:', *soln , "in order for the volume to be", " " , check.evalf())
3A
#start code here
import math
t=sp.symbols('t',real=True)
bt=3.941109math.e**(0.001199t)
#display(bt)
dt=2.744248math.e**(0.009t)
#display(dt)
areagrowth=sp.integrate(bt,(t,0,5))
areadeath=sp.integrate(dt,(t,0,5))
overall=areagrowth-areadeath
print('The population of the US grew overall by', overall, 'million people')