Created
June 6, 2011 12:33
-
-
Save jasongrout/1010165 to your computer and use it in GitHub Desktop.
Efficient sum that doesn't try to simplify in Sage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fsum(x,a): | |
g(x) = 1/2 | |
list_of_terms=[2*(((-1)^n-1)/(n*pi)^2*cos(n*pi*x)-(-1)^n/(n*pi)*sin(n*pi*x)) for n in [1..a]] | |
g += sum(list_of_terms) | |
return g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment