import random
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")
    
point=[]
def symmetry(point,swt):
    [a,b]=point
    if swt=='x':
        return [a,-b]
    elif swt=='y':
        return [-a,b]
    elif swt=='yx':
        return [b,a]
    elif swt=='y-x':
        return [-b,-a]
    else:
        return [a,b]


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

title1 = "Tokyo University 2024 Math qu.3 NO3"
tncnt=10
descartes(ax, [-3, tncnt-2], [-1, 1],title1)


#yy=probability
xx = np.arange(2,tncnt,2)
yy = 1/4*((1/3)**(xx)+1)
print(yy)

ax.plot(xx ,yy , color = "blue")
plt.show()