On Dec 2, 2008, at 6:27 PM, ggrafendorfer wrote:

> Hi Robert,
>>> Again, if I want performance I could use i^2.,
>>
>> Um... that's *slower*, right?
>
> I really did not expect that i^2. is slower than i^2,
> in my problem I needed performance, for this I wrote
> i = CDF(I)
> in the first line of my script,

Ah, I didn't know that. When sage starts up, i=I. Note that 2. is an  
*mpfr* real number, so will be slower than using 2 (without the dot).  
Mpfr numbers are arbitrary (fixed) precision, and more accurate, but  
one pays for that in speed.

sage: parent(2.)
Real Field with 53 bits of precision


> not just for performance, it can also
> leed to errors if functions expect numbers and not symbolic
> expressions as input, or even worse to extremly slow computation,

I understand completely.

> what I want to say is that I nevertheless don't understand why i^2 is
> not be treated like a symbolic expression ...
> I hope I will sometimes ..:-)


In your case, it's not treated like a symbolic expression because  
it's not a symbolic expression. Basically, it's computing b^a = exp(a  
log b). It would probably be slower to test to see if the exponent is  
something special and do something different in that case, though  
perhaps not slow enough to not make it worth it.

- Robert

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