2.c) Write the code to find the area of an ellipse by double integration: A = 4 \int_{0}^{a} \int_{0}^{b \sqrt{1 - \frac{x^2}{a^2}}} dy,dx
Answer:
from sympy import symbols, integrate, sqrt, pprint x, y = symbols('x y') a = 4 b = 6 # Define the upper limit of the inner integral properly upper_limit = (b / a) * sqrt(a**2 - x**2) # Compute the area using double integration Area = 4 * integrate(integrate(1, (y, 0, upper_limit)), (x, 0, a)) # Pretty print the result pprint(Area)