Python
import numpy as np
import plotly.graph_objects as go

# Define the function
def f(t):
    return 3 * np.exp(-t) * np.sin(-5 * np.pi * t)

# Generate data points
t = np.linspace(0, 4, 1000)  # Generate 1000 points from 0 to 5
y = f(t)

# Calculate upper and lower bounds
upper_bound = 3 * np.exp(-t)
lower_bound = -3 * np.exp(-t)

# Create the plot
fig = go.Figure()

# Add the main function
fig.add_trace(go.Scatter(x=t, y=y, mode='lines', name='f(t)'))

# Add upper and lower bounds
fig.add_trace(go.Scatter(x=t, y=upper_bound, mode='lines', name='Upper Bound', line=dict(dash='dash')))
fig.add_trace(go.Scatter(x=t, y=lower_bound, mode='lines', name='Lower Bound', line=dict(dash='dash')))

# Update layout
fig.update_layout(
    title='f(t) = 3 * e^(-t) * sin(-5Ï€t) with Bounds',
    xaxis_title='t',
    yaxis_title='f(t)',
    legend_title='Legend'
)

# Show the plot
fig.show()
Click Run or press shift + ENTER to run code.