On Wed, Jan 11, 2012 at 7:52 AM, Olivier Grisel <[email protected]>wrote:
> Hi smichr, > > I have updated my original gist: > > https://gist.github.com/1582089 > > Here is a summary: > > """ > import sympy as sp > import numpy as np > > d, n = sp.symbols('d n', real=True, positive=True) > eps = sp.symbols('eps', real=True, positive=True) > > jl_bound = 4 * sp.log(n) / (eps ** 2 / 2 - eps ** 3 / 3) > > # solve the inverted expression as sympy is much faster as finding the > roots of > # a polynomial and the point eps=0 is not interesting to us anyway. > solutions = sp.solve(sp.Equality(1 / d, 1 / jl_bound), eps) > > sol = solutions[1] > > sp.expand(sol, complex=True) > > You solutions contain symbols n and d and they don't appear to cancel as nicely as in the expression that you showed as input to Mathematica. -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
