Loading text...
Code Executed
Code:
import sympy as sp
x = sp.symbols('x')
f = x**2
area = sp.integrate(f, (x, 0, 3))
print(f"{area=}")
Output:
area=9
STEP 1 • VERIFIED
Loading text...
VIEW STEPS
Code Executed
Code:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-1, 4, 400)
y = x**2
x_fill = np.linspace(0, 3, 100)
y_fill = x_fill**2
plt.figure(figsize=(8, 6))
plt.plot(x, y, label='$y = x^2$', color='blue', linewidth=2)
plt.fill_between(x_fill, y_fill, color='skyblue', alpha=0.4, label='Area = 9')
plt.axhline(0, color='black',linewidth=0.5)
plt.axvline(0, color='black',linewidth=0.5)
plt.title('Area under $y = x^2$ from $x=0$ to $x=3$')
plt.xlabel('x')
plt.ylabel('y')
plt.xlim(-0.5, 3.5)
plt.ylim(-1, 10)
plt.grid(True, linestyle='--', alpha=0.7)
plt.legend()
plt.savefig('plot.png')
plt.show()
Output:
(No output)
Have a Math Question?
Ask your own question to get a step-by-step verified solution instantly.
Ask a Question