import numpy as np
import matplotlib.pyplot as plt
import os
import sys

#change directory to current directory
plt.style.use('bmh')


#parametres
def f(x,T):
    return (T-1)*x**2+x**4

x=np.linspace(-1,1,500)


a=f(x,0.5)
b=f(x,1)
c=f(x,1.5)


xlabel = 'M [a.u]'
ylabel = r'$f^\star$ [a.u.]'
legend = 'legend'
title = 'Approche de Landau'


# construction de la figure
fig = plt.figure()
plt.grid(color='w', linestyle='solid')

# décorations
plt.title(title, fontsize=17)
plt.xlabel(xlabel,fontsize=17)
plt.ylabel(ylabel,fontsize=17)


#plot

plt.plot(x, c, label=r'$T>T_C$')
plt.plot(x, b, label=r'$T=T_C$')
plt.plot(x, a, label=r'$T<T_C$')

plt.ylim((-0.1,0.5))

#police des graduations
plt.tick_params(axis='x', labelsize=15)
plt.tick_params(axis='y', labelsize=15)


#affichage du plot
plt.legend(prop={'size': 15})
plt.show()

