print("N = {}, Pmax = {}, g = {} and σ = {}".format(N,Pmax,g,sigma))
defgraph_2D(n=100,block=False):
"""
Graph le min pour N = 2
"""
# On génère les puissances possibles et on calcule f(P)
X=np.linspace(0,Pmax/2,n)
Y=[f([x,Pmax-x])forxinX]
# On affiche les points
ax=plt.axes()
ax.plot(X,Y)
ax.set_xlabel("P1")
ax.set_ylabel("Somme des BER")
ax.set_title("BER total à N={} utilisateurs en fonction des puissances avec Pmax = {}, g = [{:.3g}, {:.3g}] et σ = [{:.3g}, {:.3g}]".format(N,Pmax,g[0],g[1],sigma[0],sigma[1]))
# On trouve le min et on l'affiche
opti=np.argmin(Y)
P=[X[opti],Pmax-X[opti]]
BERmin=Y[opti]
print("Graphically, min was found for P1 = [{:.2g}, {:.2g}] with BER={:.3g}".format(P[0],P[1],BERmin))
ax.set_title("BER total à N={} utilisateurs en fonction des puissances avec Pmax = {}, g = [{:.3g}, {:.3g}, {:.3g}] et σ = [{:.3g}, {:.3g}, {:.3g}]".format(N,Pmax,g[0],g[1],g[2],sigma[0],sigma[1],sigma[2]))
# On trouve le min et on l'affiche
opti=np.argmin(Z)
P=[X[opti],Y[opti],Pmax-X[opti]-Y[opti]]
BERmin=Z[opti]
print("Graphically, a min was found for P = [{:.2g}, {:.2g}, {:.2g}] with BER={:.3g}".format(P[0],P[1],P[2],BERmin))
ax.set_title("BER total à N={} utilisateurs en fonction des puissances avec Pmax = {}, g = [{:.3g}, {:.3g}, {:.3g}, {:.3g}] et σ = [{:.3g}, {:.3g}, {:.3g}, {:.3g}]".format(N,Pmax,g[0],g[1],g[2],g[3],sigma[0],sigma[1],sigma[2],sigma[3]))
print("Graphically, a min was found for P = [{:.2g}, {:.2g}, {:.2g}, {:.2g}] with BER={:.3g}".format(P[0],P[1],P[2],P[3],BERmin))