# Revision history [back]

### creating a fourier series animation

Hello, I want to create an animation of sum((-1)^(n-1)sin(nx)/n,n,1 , k)

and show that as the number of terms 'k' in the partial sums increase, the sum converges to x/2 i.e looks more and more like the graph of x/2.

My first try is

a = animate([(sum((-1)^(n-1)sin(nx)/n,n,1 , k))] for k in range (1,50,1))

But that returns me an error

Traceback (click to the left of this block for traceback) ... AttributeError: 'int' object has no attribute '_maxima_'

Also I want to include a static graph of x/2 in the background of the animation so that it is easy to observe that the series converges to x/2. how to do this?

 2 retagged niles 4519 ●23 ●71 ●132 http://nilesjohnson.net/

### creating a fourier series animation

Hello, I want to create an animation of sum((-1)^(n-1)sin(nx)/n,n,1 , k)

and show that as the number of terms 'k' in the partial sums increase, the sum converges to x/2 i.e looks more and more like the graph of x/2.

My first try is

a = animate([(sum((-1)^(n-1)sin(nx)/n,n,1 , k))] for k in range (1,50,1))

But that returns me an error

Traceback (click to the left of this block for traceback) ... AttributeError: 'int' object has no attribute '_maxima_'

Also I want to include a static graph of x/2 in the background of the animation so that it is easy to observe that the series converges to x/2. how to do this?