<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># -*- coding: utf-8 -*-




import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider


Msat = 10
a = 1
b = 1
G0 = 1
Tc = 1000


## POTENTIEL


M = np.linspace(-Msat, Msat, 1000)

# fonction Ã&nbsp; dÃ©finir quand blit=True
# crÃ©e l'arriÃ¨re de l'animation qui sera prÃ©sent sur chaque image


## FONCTION D'ONDE
def G(M,G0,a,b,Tc,T):
    return G0 +a*(T-Tc)*M**2 + b/2*M**4
        
##    

fig, ax = plt.subplots(figsize=(8,8))

T = np.arange(990, 1010, 0.1)
initial_amp = 1000
G_bar = G(M,G0,a,b,Tc,initial_amp)
l, = plt.plot(M, G_bar, lw=2, label='condition de profondeur du puits',color="cornflowerblue")
plt.ylim(-50,50)
plt.xlim(-8,8)
plt.xlabel("M (u.a.)",fontsize=20)
plt.ylabel("G (u.a.)",fontsize=20)


#ax = plt.axis([0,TWOPI,0,TWOPI])

axamp = plt.axes([0.25, .9, 0.50, 0.02])
# Slider
samp = Slider(axamp, 'T', 990, 1010, valinit=initial_amp,color='plum')

def update(val):
    # amp is the current value of the slider
    amp = samp.val
    # update curve
    l.set_ydata(G(M,G0,a,b,Tc,amp))
    # redraw canvas while idle
    fig.canvas.draw_idle()

# call update function on slider value change
samp.on_changed(update)



plt.show()

plt.show()
</pre></body></html>