import numpy as np
import matplotlib.pyplot as plt

def descartes(ax, ran_x, ran_y, ax_title,x_label = "x", y_label = "y"):
    ax.set_xlabel(x_label, fontsize = 12)
    ax.set_ylabel(y_label, fontsize = 12)
    ax.set_xlim(ran_x[0], ran_x[1])
    ax.set_ylim(ran_y[0], ran_y[1])
    ax.set_title(ax_title, fontsize = 14)
    ax.grid()
    ax.axhline(0, color = "black")
    ax.axvline(0, color = "black")

fig = plt.figure(figsize = (6, 6))
ax = fig.add_subplot(111)

title1 = "Tokyo University 2024 Math qu.4 NO4"
descartes(ax, [-1,5], [-1, 5],title1,x_label = "t")

t=np.linspace(0,4,1000)
y=np.sqrt(-3/8*(t**4)+3/2*(t**3)+3*(t**2)-18*t+23)
ax.plot(t ,y , color = "black")

y1=-3/8*(t**4)+3/2*(t**3)+3*(t**2)-18*t+23
ax.plot(t ,y1 , color = "red")

#y2=[np.sqrt(5)]*len(t)
#ax.plot(t ,y2 , color = "yellow")
plt.show()