Hi,
You do not need a program to find it
primitve of (1/n)sin(nx) Is equal to: -(1/n^2)cos(nx)
then te second integral is: -(1/n^2)[cos(n(pi))-cos(0)]
= -1/n^2 if n is even
= 1/n^2 if n is odd
The first integral is eqal to the second one
I'm trying to code
+
in Matlab. I am using the following: - 1/n*integral(sin(n*x),x,-pi,0) + 1/n*integral(sin(n*x),x,0,pi)
But this is what Matlab thinks I'm putting in:
Why on earth is the first integral messed up but not the second?? And how do I fix the first one?
EDIT: Fixed it. I just needed to add parentheses--i.e., (- 1/n*integral(sin(n*x),x,-pi,0)) + (1/n*integral(sin(n*x),x,0,pi)). But why does this work and the original way doesn't?
Hi,
You do not need a program to find it
primitve of (1/n)sin(nx) Is equal to: -(1/n^2)cos(nx)
then te second integral is: -(1/n^2)[cos(n(pi))-cos(0)]
= -1/n^2 if n is even
= 1/n^2 if n is odd
The first integral is eqal to the second one