Constante d’acidité de l’acide éthanoïque
exploitation python des résultats d’un groupe
première méthode
import math
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import math
VA=[5,10,20,25,30,40,45]
VB=[]
for i in range(len(VA)):
VB.append(50-VA[i])
pH=[5.7,5.2,4.9,4.8,4.3,3.83,3.75]
x=[]
for i in range(len(VA)):
x.append(math.log10((VB[i])/VA[i]))
pH=np.array(pH)
x=np.array(x)
slope, intercept, r_value, p_value, std_error = stats.linregress(x,pH)
pHmodel=slope*x+intercept
plt . scatter(x ,pH,s=100,color ='yellow')
plt . plot (x ,pHmodel,marker=".",color ='blue',markersize=1)
plt . ylabel ("pH")
plt . xlabel ("log(VB/VA)")
plt.axis([-1, 1, 0, 14])
plt . grid ()
plt .show()
print("a=",slope)
print("b=",intercept)
print("cofficient de correlmation=",r_value)

deuxième méthode
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
VA=np.array([5,10,20,25,30,40,45])
VB=50-VA
pH=np.array([5.7,5.2,4.9,4.8,4.3,3.83,3.75])
x=np.log10(VB/VA)
slope, intercept, r_value, p_value, std_error = stats.linregress(x,pH)
pHmodel=slope*x+intercept
plt . scatter(x ,pH,s=100,color ='yellow')
plt . plot (x ,pHmodel,marker=".",color ='blue',markersize=1)
plt . ylabel ("pH")
plt . xlabel ("log(VB/VA)")
plt.axis([-1, 1, 0, 14])
plt . grid ()
plt .show()
print("a=",slope)
print("b=",intercept)
print("cofficient de correlmation=",r_value)
