alex, pythonista does not, as far as i can tell, come with fsolve.
perhaps you can elaborate about what is failing. If you plug your answer back into EOS, does it return something near zero? If so, you have found your root. If not, is it possible that a real root does not exist?
What are you using for x0, and x2 in the code you posted? One problem you may be having: x=0 is a root of your above equation for all y, and in fact is the only root unless x2 is less than -0.8333. Perhaps this is nit the function you meant to be finding roots of (missing parenthesis, etc?)
It might help you to plot these functions vs x.
import matplotlib.pyplot as plt
import numpy as np
x2=-1 #roots only exist if x2 is negative, and <-0.83
def EOS(x,y) :
e11=1.00 ; e22=0.40 ; e12=0.60
return np.log(1.-x)+x**2*(e22*y+ e11*(1-y) + 2*x2*(1-y)*e12)
for i in np.arange(1,99,1) :
y=i*0.01
#ans[i]=fsolve(lambda x: EOS(x,y),x0)
x=np.linspace(-5,1,100)
plt.plot(x,EOS(x,y))
plt.show()