In: Advanced Math
Given f(x) = sin^2(x) and g(x) = sin^4(x) (give exact answers for all parts): a) Plot the functions on the x-interval [0, π]. Find the volume when the region enclosed by the curve and the x-axis is rotated about the line x = π. b) Find the area of the region. 1?b Aa and y = 1? b 1(f(x)2 −g(x)2)dx. Find the x-coordinate of the center of Aa2 mass of the region. In a print statement, explain why this answer makes sense based on the graph in part a). d) When the region rotates about the line x = π, how far does the center of mass travel? Multiply this value by the area. What do you notice when you compare your answer to part a)?
Python
solution:-
Part A Python Code:
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import simps
# f(x) = sin^2(x)
x = np.arange(0, np.pi, 0.1)
y = np.sin(x)**2
plt.plot(x, y)
#plt.show(x,y)
# g(x) = sin^4(x)
x = np.arange(0, np.pi, 0.1)
y = np.sin(x)**4
plt.plot(x, y)
plt.show()
def f1(x):
return np.pi*(np.sin(x)**2)**2
def f2(x):
return np.pi*(np.sin(x)**4)**2
x = np.arange(0, np.pi, 0.1)
y1 = f1(x)
I1 = simps(y1, x)
print("Volume of f(x) = sin^2(x), [0,pi]:",I1)
y2 = f2(x)
I2 = simps(y2, x)
print("Volume of f(x) = sin^4(x), [0,pi]:",I2)
Part B Python Code:
import numpy as np
from scipy.integrate import simps
def f1(x):
return np.sin(x)**2
def f2(x):
return np.sin(x)**4
x = np.arange(0, np.pi, 0.1)
y1 = f1(x)
I1 = simps(y1, x)
print("area of f(x) = sin^2(x), [0,pi]:",I1)
y2 = f2(x)
I2 = simps(y2, x)
print("area of f(x) = sin^4(x), [0,pi]:",I2)
// Be Careful while copying and running the Python code it requires indentation.