Why does a SymPy solution return only one, trivial solution?

I want to find all real numbers that satisfy a certain equation. I am not hard to find these values ​​in Mathematica using

Solve[n*9^5 == 10^n-1, n]

which gives both 0 and 5.51257 ; but when I use SymPy (0.7.3; Python 2.7.5)solve

n = sympy.symbols('n')
sympy.solve(n*9**5 - 10**n-1, n)

It seems that I am only getting what looks like 0, and not the second value that I'm really looking for.

How can I get Sympy to create the non-trivial solution I'm looking for? Is there any other function or package that I should use instead?

+4
source share
1 answer

solve , , , . , , SymPy nsolve, Python.

sympy.nsolve(n*9**5 - 10**n-1, n, 5)

, .


solve , , . . WolframAlpha . , SymPy LambertW.

, , , LambertW, solve , mpmath.lambertw. - lambdify:

s = sympy.solve(n*9**5 - 10**n-1, n)    
import sympy.mpmath
# Replace -1 with any integer. -1 gives the other real solution, the one you want
lambdify([], s, [{'LambertW': lambda x: sympy.mpmath.lambertw(x, -1)}, "mpmath"])()

[mpf('5.5125649309411875')].

lambdify LambertW, -1, mpmath. "mpmath" mpmath , .

+4

All Articles