On Mon, Feb 16, 2009 at 9:33 AM, tdanner <[email protected]> wrote:
>
> Yes, sorry about that.  The second example should have been:
>
> import sage.all
> def test(T)
>    A = sage.all.log(T,10)*-15
>    B = 10**A
>    return B
>
> Also, I'm running sage version 3.2.2 on windows vista via vmware.
>

This works:

%cython
import sage.all
from sage.all import Integer
def test(T):
   A = sage.all.log(T,10)*-15
   B = Integer(10)**A
   return B

You will need to work harder to get optimal speed though. If you just
want floating point values out, by the way, you can get a *massive*
speedup using fast_float as below (you can click edit and cut/paste
this into the worksheet exactly as below):

Untitled
system:sage

{{{id=46|
%cython
import sage.all
from sage.all import Integer
def test(T):
   A = sage.all.log(T,10)*-15
   B = Integer(10)**A
   return B
///
}}}

{{{id=45|
timeit('float(test(130))')
///

625 loops, best of 3: 164 µs per loop
}}}

{{{id=47|
f(T) = 10^(log(T,10)*(-15))
///
}}}

{{{id=49|
g = f._fast_float_()
///
}}}

{{{id=50|
timeit('g(130)')
///

625 loops, best of 3: 768 ns per loop
}}}

--~--~---------~--~----~------------~-------~--~----~
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