Comment #19 on issue 1827 by smi...@gmail.com: log eval gives more standard form
http://code.google.com/p/sympy/issues/detail?id=1827
2**15 as elsewhere. Read on... By luck, or malice aforethought, your big number happens to prove difficult to factor. >>> from sympy import * >>> n=37587432954738259473892574389574328905743892057443728194372819473829147389 214738921748392714839271498321 Before checking yours, let's build some numbers that have no factor less than the limit of 2**15 and see when it starts to take more than .2 seconds to return from log with them: >>> from time import time as t >>> bi=b=nextprime(2**15) >>> while 1: ... s=t();f=log(b);e=t()-s ... print e, len(str(b)),f.func ... if e > .2: ... break ... bi=nextprime(bi);b*=bi ... 0.000999927520752 5 log 0.000999927520752 10 log 0.0339999198914 14 log 0.00200009346008 19 log 0.0599999427795 23 log 0.0499999523163 28 log 0.0490000247955 32 log 0.0529999732971 37 log 0.0600001811981 41 log 0.055999994278 46 log 0.0640001296997 50 log 0.0680000782013 55 log 0.0659999847412 59 log 0.069000005722 64 log 0.074000120163 68 log 0.0780000686646 73 log 0.0839998722076 77 log 0.0820000171661 82 log 0.0889999866486 86 log 0.0949997901917 91 log 0.0999999046326 95 log 0.110000133514 100 log 0.111000061035 104 log 0.114000082016 109 log 0.121999979019 113 log 0.124000072479 118 log 0.133000135422 122 log 0.135999917984 127 log 0.145999908447 131 log 0.147000074387 136 log 0.15700006485 141 log 0.173000097275 145 log 0.19000005722 150 log 0.196000099182 154 log 0.197999954224 159 log 0.204999923706 163 log OK, it jumps around but for the most part steadily increases. Now let's build a big square free number with small bases >>> a=primorial(200);s=t();f=log(a);print t()-s,len(str(a)),type(f) 0.00399994850159 513 log That was quick...now yours: >>> a=n;s=t();f=log(a);print t()-s,len(str(a)),type(f) 5.91399979591 104 log That was slow! What is its structure? >>> Integer(a).factors(limit=2**15) {3417039359521659952172052217234029900522172005222157108579347224893558853564976 265613490246803570136211L: 1, 11: 1} >>> d = _;jnk = d.pop(11);isprime(d.keys()[0]) False So you have a large composite there. I'm guessing that what is happening is that one of the random factor-finders is taking a lot of time since it can never find one of the big factors whereas the numbers that have factors greater than 2**15 are found by those other methods and the number is just easy to factor and confirm that it is square-free. So let's disable the special methods and try again: 0.213000059128 498 log # thats the first factors-greater-than-2**15 product that took more than .2 seconds to return from log Here are the previous comparisons: >>> a=primorial(200);s=t();f=log(a);print t()-s,len(str(a)),type(f) 0.00300002098083 513 log >>> a=n;s=t();f=log(a);print t()-s,len(str(a)),type(f) 0.0160000324249 104 log That's better. -- You received this message because you are subscribed to the Google Groups "sympy-issues" group. To post to this group, send email to sympy-issues@googlegroups.com. To unsubscribe from this group, send email to sympy-issues+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy-issues?hl=en.