I'm not sure why you did not post to sage-support. Here are some suggestions:
1. Remove the first line of your script (with var()) which serves no purpose. 2. In both functions initialize g by g=1/2, not g(x) = . 3. Expressions like sin(n*pi*x) where both n and z are exact integers will be treated as symbolic expressions, which is not what you want. I suggest forcing to real arithmetic by using pi = RR.pi() or similar. John On Mon, Jun 6, 2011 at 11:34 AM, Ignas Anikevicius <[email protected]> wrote: > Hello, > > This is my first message to this list, but I hope, that I have not > broken any rules here. I am writing because I have noticed a strange > thing, which I think should not happen. > > I needed to test my maths solutions, so I thought I would just use a > loop to get sage generate the first 600 terms of a particular Fourier > series. But then I remembered that sage has a sum function. So I also > tried the sum function. However, I noticed a very big performance > difference which I did not expect. I was wondering if someone could > explain me why there is such a difference in the performance although > the actual result is the same? Or is the native sum function more clever > or what? > > The output of the script and the script itself are attached. Note that I > did not bother to wait for the native sum function to sum 1000 terms, as > it took eternity to finish. > > Cheers, > Ignas A. > > > -- > To post to this group, send an email to [email protected] > To unsubscribe from this group, send an email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/sage-devel > URL: http://www.sagemath.org > -- To post to this group, send an email to [email protected] To unsubscribe from this group, send an email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
