[sage-support] Re: A weird exception?

2009-09-01 Thread Robert Bradshaw
On Aug 29, 2009, at 11:05 PM, Rolandb wrote: Hi, Using math.log has a disadvantage; it is less accurate. sage: print n(math.log(2),100) sage: print n(log(2),100) 0.69314718055994528622676398300 0.69314718055994530941723212146 Yes, it is. Accuracy vs. speed is a common tradeoff one needs

[sage-support] Re: A weird exception?

2009-09-01 Thread Rolandb
On 1 sep, 11:08, Robert Bradshaw rober...@math.washington.edu wrote: On Aug 29, 2009, at 11:05 PM, Rolandb wrote: Hi, Using math.log has a disadvantage; it is less accurate. sage: print n(math.log(2),100) sage: print n(log(2),100) 0.69314718055994528622676398300

[sage-support] Re: A weird exception?

2009-09-01 Thread Robert Bradshaw
On Sep 1, 2009, at 9:23 AM, Rolandb wrote: On 1 sep, 11:08, Robert Bradshaw rober...@math.washington.edu wrote: On Aug 29, 2009, at 11:05 PM, Rolandb wrote: Hi, Using math.log has a disadvantage; it is less accurate. sage: print n(math.log(2),100) sage: print n(log(2),100)

[sage-support] Re: A weird exception?

2009-08-30 Thread Rolandb
Hi, Using math.log has a disadvantage; it is less accurate. sage: print n(math.log(2),100) sage: print n(log(2),100) 0.69314718055994528622676398300 0.69314718055994530941723212146 Rolandb On 30 aug, 06:48, Robert Bradshaw rober...@math.washington.edu wrote: On Aug 29, 2009, at 12:44 PM,

[sage-support] Re: A weird exception?

2009-08-29 Thread Simon King
Hi Roland, indeed strange. I think a reasonable approach is to print some status information, e.g.: sage: def expon(mx,g): : print 'expon' : return floor(log(mx)/log(g))+1 : sage: def heelsnel(reeks,maxum): : print reeks : if len(reeks)==1: return

[sage-support] Re: A weird exception?

2009-08-29 Thread John H Palmieri
On Aug 29, 8:51 am, Simon King simon.k...@nuigalway.ie wrote: Note that expon uses Maxima, because you use the logarithm. So, I reckon that your problem is related withhttp://trac.sagemath.org/sage_trac/ticket/4731 andhttp://trac.sagemath.org/sage_trac/ticket/6818. If not, you might try

[sage-support] Re: A weird exception?

2009-08-29 Thread William Stein
On Sat, Aug 29, 2009 at 8:16 AM, Rolandb rola...@planet.nl wrote: Hi, I came across an amazing difference in execution time. Consider: sage: def heelsnel(reeks,maxum): ... ... def expon(mx,g): return floor(log(mx)/log(g))+1 ... ... if len(reeks)==1: return

[sage-support] Re: A weird exception?

2009-08-29 Thread Simon King
Hi William, On Aug 29, 5:52 pm, William Stein wst...@gmail.com wrote: [...] Can you post a version where I can actually paste in the code?   You probably have this in a file somewhere without the sage: and ... prompts. Is it possible to change the preparser, so that it not only swallows the

[sage-support] Re: A weird exception?

2009-08-29 Thread William Stein
On Sat, Aug 29, 2009 at 10:15 AM, Simon King simon.k...@nuigalway.iewrote: Hi William, On Aug 29, 5:52 pm, William Stein wst...@gmail.com wrote: [...] Can you post a version where I can actually paste in the code? You probably have this in a file somewhere without the sage: and ...

[sage-support] Re: A weird exception?

2009-08-29 Thread Rolandb
On 29 aug, 18:43, John H Palmieri jhpalmier...@gmail.com wrote: On Aug 29, 8:51 am, Simon King simon.k...@nuigalway.ie wrote: Note that expon uses Maxima, because you use the logarithm. So, I reckon that your problem is related withhttp://trac.sagemath.org/sage_trac/ticket/4731

[sage-support] Re: A weird exception?

2009-08-29 Thread Robert Bradshaw
On Aug 29, 2009, at 12:44 PM, Rolandb wrote: On 29 aug, 18:43, John H Palmieri jhpalmier...@gmail.com wrote: On Aug 29, 8:51 am, Simon King simon.k...@nuigalway.ie wrote: Note that expon uses Maxima, because you use the logarithm. So, I reckon that your problem is related