Reputation: 11
import sympy as sy
x = sy.symbols('x')
def f2(x,t,l):
return 5*sy.log(x)+14388/((273+t)*x)-sy.log((1.1910*10**8)/l+1)
print(sy.solve(f2(x,35,80),x))
Result is:
OverflowError: Python int too large to convert to C long
How to solve this problem?
Upvotes: 0
Views: 1080
Reputation: 19145
Please check your equation. There does not appear to be a solution:
>>> eq=f2(x,35,80);eq
5*log(x) - 14.2134480713559 + 327/(7*x)
There is a minimum in the function and it is convex up at that point and positive:
>>> solve(eq.diff(x))
[327/35]
>>> eq.subs(x,_[0]).n()
1.95961247568333
>>> eq.diff(x,2).subs(x,Rational(327,35))
6125/106929
So if the constant were a little more negative, everything would work:
>>> eq.subs(eq.atoms(Float).pop(),-20)
5*log(x) - 20 + 327/(7*x)
>>> ans=solve(_)
>>> [i.n(2) for i in ans]
[44., 3.3]
Upvotes: 1