On May 27, 12:05 pm, Juan Jaasiel Rodriguez Ornelas
<[email protected]> wrote:
> Well, here's my problem:
>
> I'm finding the first few terms for a Fourier transform for a function. I
> found a_n and b_n. a_n turns out to always be zero (except a_0), but b_n is
> defined as:
>
> (1/pi)-(cos(pi*n)/pi)
>
> When I put this in
>
> sum(b_n*sin(n*x),n,1,5)
>
> To find the sum terms of the function I get:
>
> -1/15*(-5*I*e^(2*I*x) - 15*I*e^(4*I*x) + 15*I*e^(6*I*x) + 5*I*e^(8*I*x)
> + 3*I*e^(10*I*x) - 3*I)*e^(-5*I*x)/pi
>
> I know that that is the representation of the complex form and it is
> equivalent, but I need it in cosine form only.
>

Hmm, this sounds like a Maxima question.  We use the 'simplify_sum'
package for this sort of thing, and assume all variables are complex,
which also will screw things up.

sage: maxima('load(simplify_sum)')
"/Users/karl-dietercrisman/Desktop/sage-4.4.2/local/share/maxima/
5.21.1/share/contrib/solve_rec/simplify_sum.mac"
sage: maxima('simplify_sum(sum(((1-%pi)-cos(%pi/n)/%pi)*sin(n*x),n,
1,5));').sage()
-(pi - 1)*sin(2*x) - (pi - 1/pi - 1)*sin(x) - 1/2*(2*pi + 1/pi -
2)*sin(3*x) - 1/2*(2*pi + sqrt(2)/pi - 2)*sin(4*x) - 1/4*(4*pi +
(sqrt(5) + 1)/pi - 4)*sin(5*x)

I don't know if you will like this any better, but it's one way to get
around it.

- kcrisman

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to