Untitled

mail@pastecode.io avatar
unknown
plain_text
18 days ago
969 B
1
Indexable
Never
import numpy as np
import matplotlib.pyplot as plt

# Define the function
def u(t):
    return -10 + 30 * np.exp(-0.4 * t)

# Generate values for t
t_values = np.linspace(0, 10, 400)  # Practical domain
u_values = u(t_values)

# Create the plot
plt.figure(figsize=(10, 6))
plt.plot(t_values, u_values, label='$u(t) = -10 + 30e^{-0.4t}$', color='blue')
plt.axhline(y=-10, color='red', linestyle='--', label='Asymptote: $u(t) = -10$')

# Highlighting the practical domain part
plt.fill_between(t_values, u_values, -10, where=(t_values>=0), color='lightblue', alpha=0.5)

# Add points
plt.scatter([0, 1], [20, 10.11], color='green')
plt.text(0, 20, '(0, 20)', fontsize=12, verticalalignment='bottom')
plt.text(1, 10.11, '(1, 10.11)', fontsize=12, verticalalignment='bottom')

# Labels and title
plt.title('Temperature Change of Water in Freezer Over Time')
plt.xlabel('Time (hours)')
plt.ylabel('Temperature (°C)')
plt.legend()
plt.grid(True)
plt.ylim(-15, 25)
plt.show()
Leave a Comment