algorithm used in sqrt function .

62 views
Skip to first unread message

utpal kumar Jha

unread,
Dec 19, 2014, 7:09:17 AM12/19/14
to sy...@googlegroups.com
hello all i was going through sympy module and while going through the sample tutorial i found sympy.sqrt(x) which in turn would return me a positive integer multiplied by a number whose square root value won't be an integer .. so i took a very big number of the order of 100 digits and it returned me result just too quickly i thought what kind of algorithm goes into internal functionality . If someone could help me out on that i would appreciate it . for now i am just getting myself familiar with this module of python am i heading in right direction my ultimate objective is to apply for Gsoc coming year .. Any answers would be appreciated ..

Aaron Meurer

unread,
Dec 19, 2014, 6:10:08 PM12/19/14
to sy...@googlegroups.com
The algorithm is here
https://github.com/sympy/sympy/blob/2e4e90b1b0243c85949eb1633f0546466b00829f/sympy/core/numbers.py#L1758-L1862.
The workhorse is factorint (Integer.factor()), whose algorithm is at
https://github.com/sympy/sympy/blob/2e4e90b1b0243c85949eb1633f0546466b00829f/sympy/ntheory/factor_.py.

Aaron Meurer
> --
> 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 sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> 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/d0baf370-fe75-4758-8ed9-8e22bba21ba6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

utpal kumar Jha

unread,
Dec 20, 2014, 3:44:14 AM12/20/14
to sy...@googlegroups.com
The second part of the question if you could answer :)

Björn Dahlgren

unread,
Dec 20, 2014, 4:14:07 PM12/20/14
to sy...@googlegroups.com
Hi,

You will need to contribute to the code base before applying for GSoC, you may look at:

https://github.com/sympy/sympy/wiki/introduction-to-contributing

for further information. Good luck!

Best,
/Björn
Reply all
Reply to author
Forward
0 new messages