William Stein wrote:
> Anybody know the answers?
> 
> 
> ---------- Forwarded message ----------
> From: Anusha Sekar <[EMAIL PROTECTED]>
> Date: Thu, May 1, 2008 at 1:28 PM
> Subject: Question about time output
> To: William Stein <[EMAIL PROTECTED]>
> 
> 
> Prof. Stein,
> 
>  I have a couple of questions about the time command.
 >
 >  1. Is it possible to output more digits, or to output in micro seconds?
 >  2. How do you store the output of the command as a number if you are
 >  trying to plot time versus n for some calculation which involves n?
 >  3. Where can I find the help document for this command? When I type
 >  time?, I get back an error saying that time is not defined. I have
 >  tried looking in the Sage docs as well as the python docs.



If you are using the command line, you can use the %time or %timeit 
commands, which are ipython commands (i.e., they are not Sage-specific). 
   If you are using the notebook, %time works, but %timeit doesn't 
(William, I thought you fixed this a while ago, but it hasn't seemed to 
work).

The help for %time or %timeit (i.e., typing "%time?" or "%timeit?") at 
the command line gives several options.  In particular, %time has an 
option to increase the precision and %timeit generally will report 
things down into the nanosecond range (by running a command several 
times and taking an average time, if I recall right).

Also, %timeit? points to the python timeit module, which sounds like it 
could fulfill the things you want.  See 
http://diveintopython.org/performance_tuning/timeit.html or 
http://docs.python.org/lib/module-timeit.html for examples.



Thanks,

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
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