On Sat, Jul 19, 2008 at 1:53 PM, Shing <[EMAIL PROTECTED]> wrote:
>
> Hi,
>   I have tried the standalone Python/Script at
> http://www.sagemath.org/doc/html/tut/node55.html
>
> to factorize a number.
>
> #!/usr/bin/env sage
>
> import sys
> from sage.all import *
>
> if len(sys.argv) != 2:
>    print "Usage: %s <n>"%sys.argv[0]
>    print "Outputs the prime factorization of n."
>    sys.exit(1)
>
> print factor(sage_eval(sys.argv[1]))
>
>
> The script takes about 12s to factories 2006. But in the notebook,
> it takes  less than 1 second.
> I would like to use a standalone script from command line to do some
> computation. Is there a way to speed it up ?
>
> I am using Sage 3.0.3 on a Athlon 3200 64bit PC, running OpenSuse 11.
>
> Thanks in advance for any assistance!
>

The Sage startup time in sage-3.0.5 is better than in 3.0.3, so you might
want to try upgrading.   Are you *just* factoring integers are do you plan
to do much more?  This is fast:

teragon-2:~ was$ time echo "factor(2006)" | sage -gp
                  GP/PARI CALCULATOR Version 2.3.3 (released)
           i386 running darwin (ix86/GMP-4.2.1 kernel) 32-bit version
            compiled: May  4 2008, gcc-4.0.1 (Apple Inc. build 5465)
                (readline v5.2 enabled, extended help available)

                     Copyright (C) 2000-2006 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and
comes WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

parisize = 4000000, primelimit = 500000
%1 =
[2 1]

[17 1]

[59 1]

Goodbye!

real    0m0.388s
user    0m0.033s
sys     0m0.051s


 -- William

--~--~---------~--~----~------------~-------~--~----~
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/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to