14 November 2009

Why I love Sage in 6 simple lines

This is why I love Sage:

e = sqrt(log(4*B) / log(P)) + (5 / (4*d))

g = [P^(a - i) * (x*B - R)^i for i in range(a)]
h = [(x*B - R)^a * (x*B)^i for i in range(d - a)]

m = matrix(Integers(), d, [list(k) + [0] * (d - len(list(k))) for k in g+h]).LLL()

w = sum([x^i * m[0][i] for i in range(d)])

return filter(lambda x: x[0].is_integral() and gcd(P, x[0] - R) < P**e , w.roots())

(That's a crucial part of my thesis.)

3 comments:

  1. Hey ! Must say a beautifully designed and well written blogs ... Loved the way you express yourself... And seeing that you are such a versatile lady, it has only made me want to read more !

    ReplyDelete
  2. Thank you very much and have fun reading. ;)

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete