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")
    
def catp(x):
    return((np.e**x+1/np.e**x)/2)

def catm(x):
    return((np.e**x-1/np.e**x)/2)

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

title1 = "Kyoto University 2024 Math qu.5 NO1"

a=7
last_n=1000
zz=[[]]

for x in np.linspace(0,3,last_n):
    for y in np.linspace(0,a,last_n):
        if y>=catm(x) and y<=catp(x) and y<=a:
            zz.append([x,y])

del zz[0]

zz=np.array(zz)
z1=zz[:,0]
z2=zz[:,1]

descartes(ax, [-1, 5], [-1, a+1],title1)
ax.scatter(z1 ,z2 , color="red",s=5)
plt.show()