0
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?

4
  • Python 2 or 3? 32-bit or 64-bit? Commented Nov 13, 2019 at 4:53
  • python 2, 64-bit Commented Nov 13, 2019 at 4:57
  • Possible duplicate of stackoverflow.com/questions/38314118/… Commented Nov 13, 2019 at 5:08
  • In Py3, your calculation results in a crash (isympy session killed). Even when I try to scale down the constants. What sort of solution do you expect? Commented Nov 13, 2019 at 5:54

1 Answer 1

1

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]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.