I'd like to solve SymPy expressions to high (arbitrary) precision.  I tried 
`nsolve` with `mpmath.mp.dps = 128`, and filed #8564,
as nsolve is currently limited to double precision.

My current idea is to convert my expression to an lambda involving only 
mpmath objects.  Then call `mpmath.mp.findroot`.  This is essentially what 
nsolve does anyway (except for the part about "only mpmath" objects).

How do I do that?  `lambdify(x, expr, module=mpmath)` is limited to 
double-precision (filed #8818, but not sure if this is by design or a bug).

`mpmath.mpmathify` works for individual floats... 

Best I have so far is something like:

````
d = 128    %  precision desired.
g = sqrt(2) - x   % I want to solve g == 0 for x

% here's my approach
h = g.evalf(d)
f = lambda meh: h.subs(x, meh)   % yuck

q = mpmath.mp.findroot(f, 1.0)

q*q   % should be 2 to 128 digits, looks good:
% 
mpf('2.000000000000000000000000000000000000000000000000000000000000000038')
````

thanks,
Colin

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/bd276484-1f37-4d29-b9b4-2cfbbee3fb5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to