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.)
14 November 2009
Why I love Sage in 6 simple lines
Topics:
functional programming,
math,
python,
thesis
Subscribe to:
Post Comments (Atom)
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 !
ReplyDeleteThank you very much and have fun reading. ;)
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete