Why does this method fail for finding the Fourier series for $cosleft(frac{x}{2}right)$ on the interval $-pi...











up vote
2
down vote

favorite
2












This question is strongly related to this question (that does not have an answer).



From "Riley, Hobson and Bence - Mathematical methods for physics and engineering", Section 12.5 - "Non-periodic functions", page 417



$$a_n=frac{2}{L}int_{x_0}^{x_0+L}f(x)cosleft(frac{2pi nx}{L}right)dxtag{1}$$



similarly $$b_n=frac{2}{L}int_{x_0}^{x_0+L}f(x)sinleft(frac{2pi nx}{L}right)dxtag{2}$$ where $x_0$ is arbitrary but is often taken as $0$ or $-frac{L}{2}$ and $L$ is the period of $f(x)$.



The following question I asked on "Chegg Study" website is here:




Show that the Fourier series of $f(x)=cosleft(frac{x}{2}right)$ for $-pilt x lt pi$ is given by
$$f(x)=frac{2}{pi}+frac{4}{pi}sum_{n=1}^{infty}frac{(-1)^{n-1}cos(nx)}{4n^2 - 1}$$






So my attempt at the finding the Fourier series for $cosleft(frac{x}{2}right)$ on the interval $-pi lt x lt pi$ is by first noting that since $cosleft(frac{x}{2}right)$ is not periodic on $-pi lt x lt pi$,$,$ I must therefore make the function periodic by extending the interval to $-2pi lt x lt 2pi$. By the Dirichlet conditions for convergence the function must be periodic.



Now that the function is symmetric and periodic about $x=0$ the $b_n=0 ,forall ,n in mathbb N$



A plot of the extended function is shown below:



cos(x/2)



Now by $(1)$,
$$begin{align}a_n &=frac{2}{L}int_{x_0}^{x_0+L}f(x)cosleft(frac{2pi nx}{L}right)dx \&=frac{2}{4pi}int_{-2pi}^{2pi}cosleft(frac{x}{2}right)cosleft(frac{2pi nx}{4pi}right)dx\&=frac{1}{2pi}int_{-2pi}^{2pi}cosleft(frac{x}{2}right)cosleft(frac{nx}{2}right)dx\&=0end{align}$$



and this has been verified here by Wolfram Alpha.



All I did was substitute the value of the period $L$ into the argument of the cosine, the limits and the denominator in front of the integral.





Why is this giving me the wrong answer when it clearly works for other functions like $x^2$ on $0 lt x le 2$ as can be seen here "Riley, Hobson and Bence - Mathematical methods for physics and engineering", Section 12.5 - "Non-periodic functions", page 422 and 423?



The method used in the $x^2$ and $cos(x/2)$ case was general and did not specify any restrictions on the function being extended.



So, put in another way, is there some kind of rule that says extending a trigonometric function to a full period is always forbidden since integrating over the period will be zero?










share|cite|improve this question




















  • 1




    seems to me you should not have changed the x range. - you are not looking to find a Fourier Series for cos(x/2) you are looking to fit a portion of the cos(x/2) curve - you should only care about what happens in the range $[-pi,pi]$ and forget the rest of the cos(x/2) function - does that make sense? -- You make the point that it is not periodic in this range, but that does not matter. the function is defined to repeat on the basis that $f(x+2pi)=f(x)$ - it is discontinuous and looks wrong, but it is forced to repeat over $2pi$
    – tom
    Nov 13 at 1:07












  • @tom I cannot "forget the rest of the cos(x/2) function" as by the Dirichlet conditions for convergence, the function being expanded must be periodic in order to have a Fourier series.
    – BLAZE
    Nov 13 at 1:13












  • @tom Okay, have you seen page 422 & 423 of this where they expand $x^2$ on $[0,2]$ by extending the range to [−2,2] to make the function periodic? My question is simple; I would like to know why the method for $x^2$ does not work for $cos(x/2)$?
    – BLAZE
    Nov 13 at 1:36

















up vote
2
down vote

favorite
2












This question is strongly related to this question (that does not have an answer).



From "Riley, Hobson and Bence - Mathematical methods for physics and engineering", Section 12.5 - "Non-periodic functions", page 417



$$a_n=frac{2}{L}int_{x_0}^{x_0+L}f(x)cosleft(frac{2pi nx}{L}right)dxtag{1}$$



similarly $$b_n=frac{2}{L}int_{x_0}^{x_0+L}f(x)sinleft(frac{2pi nx}{L}right)dxtag{2}$$ where $x_0$ is arbitrary but is often taken as $0$ or $-frac{L}{2}$ and $L$ is the period of $f(x)$.



The following question I asked on "Chegg Study" website is here:




Show that the Fourier series of $f(x)=cosleft(frac{x}{2}right)$ for $-pilt x lt pi$ is given by
$$f(x)=frac{2}{pi}+frac{4}{pi}sum_{n=1}^{infty}frac{(-1)^{n-1}cos(nx)}{4n^2 - 1}$$






So my attempt at the finding the Fourier series for $cosleft(frac{x}{2}right)$ on the interval $-pi lt x lt pi$ is by first noting that since $cosleft(frac{x}{2}right)$ is not periodic on $-pi lt x lt pi$,$,$ I must therefore make the function periodic by extending the interval to $-2pi lt x lt 2pi$. By the Dirichlet conditions for convergence the function must be periodic.



Now that the function is symmetric and periodic about $x=0$ the $b_n=0 ,forall ,n in mathbb N$



A plot of the extended function is shown below:



cos(x/2)



Now by $(1)$,
$$begin{align}a_n &=frac{2}{L}int_{x_0}^{x_0+L}f(x)cosleft(frac{2pi nx}{L}right)dx \&=frac{2}{4pi}int_{-2pi}^{2pi}cosleft(frac{x}{2}right)cosleft(frac{2pi nx}{4pi}right)dx\&=frac{1}{2pi}int_{-2pi}^{2pi}cosleft(frac{x}{2}right)cosleft(frac{nx}{2}right)dx\&=0end{align}$$



and this has been verified here by Wolfram Alpha.



All I did was substitute the value of the period $L$ into the argument of the cosine, the limits and the denominator in front of the integral.





Why is this giving me the wrong answer when it clearly works for other functions like $x^2$ on $0 lt x le 2$ as can be seen here "Riley, Hobson and Bence - Mathematical methods for physics and engineering", Section 12.5 - "Non-periodic functions", page 422 and 423?



The method used in the $x^2$ and $cos(x/2)$ case was general and did not specify any restrictions on the function being extended.



So, put in another way, is there some kind of rule that says extending a trigonometric function to a full period is always forbidden since integrating over the period will be zero?










share|cite|improve this question




















  • 1




    seems to me you should not have changed the x range. - you are not looking to find a Fourier Series for cos(x/2) you are looking to fit a portion of the cos(x/2) curve - you should only care about what happens in the range $[-pi,pi]$ and forget the rest of the cos(x/2) function - does that make sense? -- You make the point that it is not periodic in this range, but that does not matter. the function is defined to repeat on the basis that $f(x+2pi)=f(x)$ - it is discontinuous and looks wrong, but it is forced to repeat over $2pi$
    – tom
    Nov 13 at 1:07












  • @tom I cannot "forget the rest of the cos(x/2) function" as by the Dirichlet conditions for convergence, the function being expanded must be periodic in order to have a Fourier series.
    – BLAZE
    Nov 13 at 1:13












  • @tom Okay, have you seen page 422 & 423 of this where they expand $x^2$ on $[0,2]$ by extending the range to [−2,2] to make the function periodic? My question is simple; I would like to know why the method for $x^2$ does not work for $cos(x/2)$?
    – BLAZE
    Nov 13 at 1:36















up vote
2
down vote

favorite
2









up vote
2
down vote

favorite
2






2





This question is strongly related to this question (that does not have an answer).



From "Riley, Hobson and Bence - Mathematical methods for physics and engineering", Section 12.5 - "Non-periodic functions", page 417



$$a_n=frac{2}{L}int_{x_0}^{x_0+L}f(x)cosleft(frac{2pi nx}{L}right)dxtag{1}$$



similarly $$b_n=frac{2}{L}int_{x_0}^{x_0+L}f(x)sinleft(frac{2pi nx}{L}right)dxtag{2}$$ where $x_0$ is arbitrary but is often taken as $0$ or $-frac{L}{2}$ and $L$ is the period of $f(x)$.



The following question I asked on "Chegg Study" website is here:




Show that the Fourier series of $f(x)=cosleft(frac{x}{2}right)$ for $-pilt x lt pi$ is given by
$$f(x)=frac{2}{pi}+frac{4}{pi}sum_{n=1}^{infty}frac{(-1)^{n-1}cos(nx)}{4n^2 - 1}$$






So my attempt at the finding the Fourier series for $cosleft(frac{x}{2}right)$ on the interval $-pi lt x lt pi$ is by first noting that since $cosleft(frac{x}{2}right)$ is not periodic on $-pi lt x lt pi$,$,$ I must therefore make the function periodic by extending the interval to $-2pi lt x lt 2pi$. By the Dirichlet conditions for convergence the function must be periodic.



Now that the function is symmetric and periodic about $x=0$ the $b_n=0 ,forall ,n in mathbb N$



A plot of the extended function is shown below:



cos(x/2)



Now by $(1)$,
$$begin{align}a_n &=frac{2}{L}int_{x_0}^{x_0+L}f(x)cosleft(frac{2pi nx}{L}right)dx \&=frac{2}{4pi}int_{-2pi}^{2pi}cosleft(frac{x}{2}right)cosleft(frac{2pi nx}{4pi}right)dx\&=frac{1}{2pi}int_{-2pi}^{2pi}cosleft(frac{x}{2}right)cosleft(frac{nx}{2}right)dx\&=0end{align}$$



and this has been verified here by Wolfram Alpha.



All I did was substitute the value of the period $L$ into the argument of the cosine, the limits and the denominator in front of the integral.





Why is this giving me the wrong answer when it clearly works for other functions like $x^2$ on $0 lt x le 2$ as can be seen here "Riley, Hobson and Bence - Mathematical methods for physics and engineering", Section 12.5 - "Non-periodic functions", page 422 and 423?



The method used in the $x^2$ and $cos(x/2)$ case was general and did not specify any restrictions on the function being extended.



So, put in another way, is there some kind of rule that says extending a trigonometric function to a full period is always forbidden since integrating over the period will be zero?










share|cite|improve this question















This question is strongly related to this question (that does not have an answer).



From "Riley, Hobson and Bence - Mathematical methods for physics and engineering", Section 12.5 - "Non-periodic functions", page 417



$$a_n=frac{2}{L}int_{x_0}^{x_0+L}f(x)cosleft(frac{2pi nx}{L}right)dxtag{1}$$



similarly $$b_n=frac{2}{L}int_{x_0}^{x_0+L}f(x)sinleft(frac{2pi nx}{L}right)dxtag{2}$$ where $x_0$ is arbitrary but is often taken as $0$ or $-frac{L}{2}$ and $L$ is the period of $f(x)$.



The following question I asked on "Chegg Study" website is here:




Show that the Fourier series of $f(x)=cosleft(frac{x}{2}right)$ for $-pilt x lt pi$ is given by
$$f(x)=frac{2}{pi}+frac{4}{pi}sum_{n=1}^{infty}frac{(-1)^{n-1}cos(nx)}{4n^2 - 1}$$






So my attempt at the finding the Fourier series for $cosleft(frac{x}{2}right)$ on the interval $-pi lt x lt pi$ is by first noting that since $cosleft(frac{x}{2}right)$ is not periodic on $-pi lt x lt pi$,$,$ I must therefore make the function periodic by extending the interval to $-2pi lt x lt 2pi$. By the Dirichlet conditions for convergence the function must be periodic.



Now that the function is symmetric and periodic about $x=0$ the $b_n=0 ,forall ,n in mathbb N$



A plot of the extended function is shown below:



cos(x/2)



Now by $(1)$,
$$begin{align}a_n &=frac{2}{L}int_{x_0}^{x_0+L}f(x)cosleft(frac{2pi nx}{L}right)dx \&=frac{2}{4pi}int_{-2pi}^{2pi}cosleft(frac{x}{2}right)cosleft(frac{2pi nx}{4pi}right)dx\&=frac{1}{2pi}int_{-2pi}^{2pi}cosleft(frac{x}{2}right)cosleft(frac{nx}{2}right)dx\&=0end{align}$$



and this has been verified here by Wolfram Alpha.



All I did was substitute the value of the period $L$ into the argument of the cosine, the limits and the denominator in front of the integral.





Why is this giving me the wrong answer when it clearly works for other functions like $x^2$ on $0 lt x le 2$ as can be seen here "Riley, Hobson and Bence - Mathematical methods for physics and engineering", Section 12.5 - "Non-periodic functions", page 422 and 423?



The method used in the $x^2$ and $cos(x/2)$ case was general and did not specify any restrictions on the function being extended.



So, put in another way, is there some kind of rule that says extending a trigonometric function to a full period is always forbidden since integrating over the period will be zero?







calculus trigonometry fourier-analysis fourier-series trigonometric-integrals






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 19 at 7:08

























asked Nov 13 at 0:40









BLAZE

6,057112754




6,057112754








  • 1




    seems to me you should not have changed the x range. - you are not looking to find a Fourier Series for cos(x/2) you are looking to fit a portion of the cos(x/2) curve - you should only care about what happens in the range $[-pi,pi]$ and forget the rest of the cos(x/2) function - does that make sense? -- You make the point that it is not periodic in this range, but that does not matter. the function is defined to repeat on the basis that $f(x+2pi)=f(x)$ - it is discontinuous and looks wrong, but it is forced to repeat over $2pi$
    – tom
    Nov 13 at 1:07












  • @tom I cannot "forget the rest of the cos(x/2) function" as by the Dirichlet conditions for convergence, the function being expanded must be periodic in order to have a Fourier series.
    – BLAZE
    Nov 13 at 1:13












  • @tom Okay, have you seen page 422 & 423 of this where they expand $x^2$ on $[0,2]$ by extending the range to [−2,2] to make the function periodic? My question is simple; I would like to know why the method for $x^2$ does not work for $cos(x/2)$?
    – BLAZE
    Nov 13 at 1:36
















  • 1




    seems to me you should not have changed the x range. - you are not looking to find a Fourier Series for cos(x/2) you are looking to fit a portion of the cos(x/2) curve - you should only care about what happens in the range $[-pi,pi]$ and forget the rest of the cos(x/2) function - does that make sense? -- You make the point that it is not periodic in this range, but that does not matter. the function is defined to repeat on the basis that $f(x+2pi)=f(x)$ - it is discontinuous and looks wrong, but it is forced to repeat over $2pi$
    – tom
    Nov 13 at 1:07












  • @tom I cannot "forget the rest of the cos(x/2) function" as by the Dirichlet conditions for convergence, the function being expanded must be periodic in order to have a Fourier series.
    – BLAZE
    Nov 13 at 1:13












  • @tom Okay, have you seen page 422 & 423 of this where they expand $x^2$ on $[0,2]$ by extending the range to [−2,2] to make the function periodic? My question is simple; I would like to know why the method for $x^2$ does not work for $cos(x/2)$?
    – BLAZE
    Nov 13 at 1:36










1




1




seems to me you should not have changed the x range. - you are not looking to find a Fourier Series for cos(x/2) you are looking to fit a portion of the cos(x/2) curve - you should only care about what happens in the range $[-pi,pi]$ and forget the rest of the cos(x/2) function - does that make sense? -- You make the point that it is not periodic in this range, but that does not matter. the function is defined to repeat on the basis that $f(x+2pi)=f(x)$ - it is discontinuous and looks wrong, but it is forced to repeat over $2pi$
– tom
Nov 13 at 1:07






seems to me you should not have changed the x range. - you are not looking to find a Fourier Series for cos(x/2) you are looking to fit a portion of the cos(x/2) curve - you should only care about what happens in the range $[-pi,pi]$ and forget the rest of the cos(x/2) function - does that make sense? -- You make the point that it is not periodic in this range, but that does not matter. the function is defined to repeat on the basis that $f(x+2pi)=f(x)$ - it is discontinuous and looks wrong, but it is forced to repeat over $2pi$
– tom
Nov 13 at 1:07














@tom I cannot "forget the rest of the cos(x/2) function" as by the Dirichlet conditions for convergence, the function being expanded must be periodic in order to have a Fourier series.
– BLAZE
Nov 13 at 1:13






@tom I cannot "forget the rest of the cos(x/2) function" as by the Dirichlet conditions for convergence, the function being expanded must be periodic in order to have a Fourier series.
– BLAZE
Nov 13 at 1:13














@tom Okay, have you seen page 422 & 423 of this where they expand $x^2$ on $[0,2]$ by extending the range to [−2,2] to make the function periodic? My question is simple; I would like to know why the method for $x^2$ does not work for $cos(x/2)$?
– BLAZE
Nov 13 at 1:36






@tom Okay, have you seen page 422 & 423 of this where they expand $x^2$ on $[0,2]$ by extending the range to [−2,2] to make the function periodic? My question is simple; I would like to know why the method for $x^2$ does not work for $cos(x/2)$?
– BLAZE
Nov 13 at 1:36












4 Answers
4






active

oldest

votes

















up vote
1
down vote



accepted










You want to expand $cos(x/2)$ on $[-pi,pi]$ in a Fourier series. The resulting series will converge to the periodic extension of $cos(x/2)$ from $[-pi,pi]$ to $mathbb{R}$ with period $2pi$. The Fourier coefficients are
$$
a_0 = frac{1}{2pi}int_{-pi}^{pi}cos(x/2)dx \
a_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)cos(n x)dx,;; n ge 1 \
b_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)sin(n x)dx=0,;; n ge 1.
$$

$b_n=0$ because the integrand is odd;
$a_n$ can be computed using the identity
$$
cos(x/2)cos(n x)=frac{1}{2}{cos(x/2+n x)+cos(x/2-n x)} \
%% cos(x/2)sin(n x)=frac{1}{2}{sin(n x+x/2)+sin(n x-x/2)}.
$$

Using this,
$$
a_n = left.frac{1}{2pi}left{frac{sin(x/2+nx)}{1/2+n}+frac{sin(x/2-nx)}{1/2-n}right}right|_{x=-pi}^{pi} \
= frac{(-1)^n}{2pi}left[frac{1}{n+1/2}-frac{1}{n-1/2}right] \
= frac{(-1)^{n+1}}{2pi}frac{1}{n^2-1/4}.
$$






share|cite|improve this answer





















  • Hi there, thank you for your answer. What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:42






  • 1




    @BLAZE The function $cos(x/2)$ being periodic on $-pi < x < pi$ is a statement that doesn't make sense. If you explain that statement, then you'll get at the root of the problem. When you perform a Fourier series, the resulting series will be a $2pi$ periodic function. And your first coefficient formula works for arbitrary $x_0$ only if you have extended the function to a periodic function on $mathbb{R}$ with period $L$.
    – DisintegratingByParts
    Nov 16 at 13:35






  • 1




    @BLAZE : The standard Fourier series works on $2pi$ periodic functions. However, your interval was $[-2pi,2pi]$, which has length $4pi$. That's not the standard Fourier series.
    – DisintegratingByParts
    Nov 16 at 13:37




















up vote
2
down vote













If you "extend the period" you get a rather different looking curve
enter image description here



The question that they are asking seem to be to evaluate.



$a_n = frac 1{2pi}int_{-pi}^{pi} cos frac x2 cos nx dx\
frac {1}{4pi} int_{-pi}^{pi} cos (n+frac 12)x + cos (n-frac 12)x dx\
$






share|cite|improve this answer





















  • Yes, but by the Dirichlet conditions for convergence the function must be periodic. Your function is not periodic on $[-pi, pi]$
    – BLAZE
    Nov 13 at 1:10










  • My answer follows yours, but I have gnuplot setup to produce something similar so it was easy to add the picture - like your answer it explains it better - I added mine just for the picture really - plus one :-)
    – tom
    Nov 13 at 1:28










  • @Doug Is there something special about $cos(x/2)$ why I cannot extend the range of the function to make it periodic?
    – BLAZE
    Nov 13 at 1:38






  • 1




    You have a function that is periodic with period $2pi$ It is not the full period of $cos frac x2$ but instead $|cos frac x2|$
    – Doug M
    Nov 13 at 1:44






  • 1




    @BLAZE Regarding the text on pages 422, 3 of your text. If you only care about the functions' behavior inside the interval, then sometimes it will simplify your calculations if you extend the interval. If are trying to represent a periodic function, or a wave, then don't.
    – Doug M
    Nov 16 at 17:03


















up vote
1
down vote













$a_1=frac{1}{2pi}int_{-2pi}^{2pi}cos^2(frac{x}{2})dx=frac{1}{4pi}int_{-2pi}^{2pi}1dx=1$.






share|cite|improve this answer





















  • In my answer I used the fact that $cos^2(x)+sin^2(x)=1$ and the integrals over the range of $sin^2(x/2)$ and $cos^2(x/2)$ are equal.
    – herb steinberg
    Nov 13 at 0:57




















up vote
1
down vote













enter image description here



This was generated with gnuplot - it shows a function that is defined by



$$f(x) = cos(x/2) quad -pi<x<pi$$
and
$$f(x+2pi)=f(x)$$



I think you need to stick to the range of $-pi<x<pi$ - which is what @DougM is saying in his answer





Edit about $x^2$ range extension...



The picture in the reference you gave is helpful here - where it shows the $x^2$ function being 'mirrored' or reflected in the $y$-axis.



So $x^2$ is an even function and so in the Fourier series we will only have contributions from $cos(kx)$ and not $sin(kx)$



This means that the critical integrals of
$$int x^2 cos(kx) dx $$
are even - or at least the $x^2 cos(kx)$ function inside is even.



Now if the function is even then integrating over the range $[0,2]$ will give exactly half the value that you get integrating over $[-2,2]$ - because everything is completely symmetrical about the $y$-axis or the line $x=0$.



In your case of the cos$(x/2)$ you also have an even function, but you are not expanding into the mirror image on the other side of the $y$-axis... instead you are making the range wider and the $cos(x/2)$ function now is negative and things change.



For example - with the extended range the $a_0$ term will be zero, but in the figure above everything is above the $x$-axis so $a_0$ will be positive and non-zero.






share|cite|improve this answer























  • Thanks, this is really helpful stuff. Does it seem that the formulas given in the text book on page 417 are wrong? Since all I did was apply them (as in the $x^2$ case) and got the wrong answer.
    – BLAZE
    Nov 13 at 1:48








  • 1




    No the equations are fine... it is just a case of knowing when to apply which equation. - the pictures in Doug M's answer show that when you change the range for the cos(x/2) the whole shape of the function changes, whereas in the case of x^2 it is just a reflection in the axis and, of course, $x^2$ is symmetrical anyway about the yaxis... the reason the $x^2$ is extended is so that there is not a sudden drop or rise in the function - so that the two ends meet at the same height of +4...
    – tom
    Nov 13 at 1:53










  • Very impressive answer. Would you mind making an answer to this previous (but longer version of this) question and see if you can summarize what you wrote here to make the distinction between the 2 cases where you can and cannot extend the range of the function?
    – BLAZE
    Nov 13 at 1:56








  • 1




    I am afraid that I cannot do that at the moment, sorry - not enough time, but I think a key point about why the $x^2$ function was extended was so that at each end of the range $x^2$ = 4 so that when you make the function periodic and join it up the ends are at the same height - or y value - and touch
    – tom
    Nov 13 at 2:00












  • What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:41











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2996121%2fwhy-does-this-method-fail-for-finding-the-fourier-series-for-cos-left-fracx%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























4 Answers
4






active

oldest

votes








4 Answers
4






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










You want to expand $cos(x/2)$ on $[-pi,pi]$ in a Fourier series. The resulting series will converge to the periodic extension of $cos(x/2)$ from $[-pi,pi]$ to $mathbb{R}$ with period $2pi$. The Fourier coefficients are
$$
a_0 = frac{1}{2pi}int_{-pi}^{pi}cos(x/2)dx \
a_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)cos(n x)dx,;; n ge 1 \
b_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)sin(n x)dx=0,;; n ge 1.
$$

$b_n=0$ because the integrand is odd;
$a_n$ can be computed using the identity
$$
cos(x/2)cos(n x)=frac{1}{2}{cos(x/2+n x)+cos(x/2-n x)} \
%% cos(x/2)sin(n x)=frac{1}{2}{sin(n x+x/2)+sin(n x-x/2)}.
$$

Using this,
$$
a_n = left.frac{1}{2pi}left{frac{sin(x/2+nx)}{1/2+n}+frac{sin(x/2-nx)}{1/2-n}right}right|_{x=-pi}^{pi} \
= frac{(-1)^n}{2pi}left[frac{1}{n+1/2}-frac{1}{n-1/2}right] \
= frac{(-1)^{n+1}}{2pi}frac{1}{n^2-1/4}.
$$






share|cite|improve this answer





















  • Hi there, thank you for your answer. What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:42






  • 1




    @BLAZE The function $cos(x/2)$ being periodic on $-pi < x < pi$ is a statement that doesn't make sense. If you explain that statement, then you'll get at the root of the problem. When you perform a Fourier series, the resulting series will be a $2pi$ periodic function. And your first coefficient formula works for arbitrary $x_0$ only if you have extended the function to a periodic function on $mathbb{R}$ with period $L$.
    – DisintegratingByParts
    Nov 16 at 13:35






  • 1




    @BLAZE : The standard Fourier series works on $2pi$ periodic functions. However, your interval was $[-2pi,2pi]$, which has length $4pi$. That's not the standard Fourier series.
    – DisintegratingByParts
    Nov 16 at 13:37

















up vote
1
down vote



accepted










You want to expand $cos(x/2)$ on $[-pi,pi]$ in a Fourier series. The resulting series will converge to the periodic extension of $cos(x/2)$ from $[-pi,pi]$ to $mathbb{R}$ with period $2pi$. The Fourier coefficients are
$$
a_0 = frac{1}{2pi}int_{-pi}^{pi}cos(x/2)dx \
a_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)cos(n x)dx,;; n ge 1 \
b_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)sin(n x)dx=0,;; n ge 1.
$$

$b_n=0$ because the integrand is odd;
$a_n$ can be computed using the identity
$$
cos(x/2)cos(n x)=frac{1}{2}{cos(x/2+n x)+cos(x/2-n x)} \
%% cos(x/2)sin(n x)=frac{1}{2}{sin(n x+x/2)+sin(n x-x/2)}.
$$

Using this,
$$
a_n = left.frac{1}{2pi}left{frac{sin(x/2+nx)}{1/2+n}+frac{sin(x/2-nx)}{1/2-n}right}right|_{x=-pi}^{pi} \
= frac{(-1)^n}{2pi}left[frac{1}{n+1/2}-frac{1}{n-1/2}right] \
= frac{(-1)^{n+1}}{2pi}frac{1}{n^2-1/4}.
$$






share|cite|improve this answer





















  • Hi there, thank you for your answer. What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:42






  • 1




    @BLAZE The function $cos(x/2)$ being periodic on $-pi < x < pi$ is a statement that doesn't make sense. If you explain that statement, then you'll get at the root of the problem. When you perform a Fourier series, the resulting series will be a $2pi$ periodic function. And your first coefficient formula works for arbitrary $x_0$ only if you have extended the function to a periodic function on $mathbb{R}$ with period $L$.
    – DisintegratingByParts
    Nov 16 at 13:35






  • 1




    @BLAZE : The standard Fourier series works on $2pi$ periodic functions. However, your interval was $[-2pi,2pi]$, which has length $4pi$. That's not the standard Fourier series.
    – DisintegratingByParts
    Nov 16 at 13:37















up vote
1
down vote



accepted







up vote
1
down vote



accepted






You want to expand $cos(x/2)$ on $[-pi,pi]$ in a Fourier series. The resulting series will converge to the periodic extension of $cos(x/2)$ from $[-pi,pi]$ to $mathbb{R}$ with period $2pi$. The Fourier coefficients are
$$
a_0 = frac{1}{2pi}int_{-pi}^{pi}cos(x/2)dx \
a_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)cos(n x)dx,;; n ge 1 \
b_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)sin(n x)dx=0,;; n ge 1.
$$

$b_n=0$ because the integrand is odd;
$a_n$ can be computed using the identity
$$
cos(x/2)cos(n x)=frac{1}{2}{cos(x/2+n x)+cos(x/2-n x)} \
%% cos(x/2)sin(n x)=frac{1}{2}{sin(n x+x/2)+sin(n x-x/2)}.
$$

Using this,
$$
a_n = left.frac{1}{2pi}left{frac{sin(x/2+nx)}{1/2+n}+frac{sin(x/2-nx)}{1/2-n}right}right|_{x=-pi}^{pi} \
= frac{(-1)^n}{2pi}left[frac{1}{n+1/2}-frac{1}{n-1/2}right] \
= frac{(-1)^{n+1}}{2pi}frac{1}{n^2-1/4}.
$$






share|cite|improve this answer












You want to expand $cos(x/2)$ on $[-pi,pi]$ in a Fourier series. The resulting series will converge to the periodic extension of $cos(x/2)$ from $[-pi,pi]$ to $mathbb{R}$ with period $2pi$. The Fourier coefficients are
$$
a_0 = frac{1}{2pi}int_{-pi}^{pi}cos(x/2)dx \
a_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)cos(n x)dx,;; n ge 1 \
b_n = frac{1}{pi}int_{-pi}^{pi}cos(x/2)sin(n x)dx=0,;; n ge 1.
$$

$b_n=0$ because the integrand is odd;
$a_n$ can be computed using the identity
$$
cos(x/2)cos(n x)=frac{1}{2}{cos(x/2+n x)+cos(x/2-n x)} \
%% cos(x/2)sin(n x)=frac{1}{2}{sin(n x+x/2)+sin(n x-x/2)}.
$$

Using this,
$$
a_n = left.frac{1}{2pi}left{frac{sin(x/2+nx)}{1/2+n}+frac{sin(x/2-nx)}{1/2-n}right}right|_{x=-pi}^{pi} \
= frac{(-1)^n}{2pi}left[frac{1}{n+1/2}-frac{1}{n-1/2}right] \
= frac{(-1)^{n+1}}{2pi}frac{1}{n^2-1/4}.
$$







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Nov 14 at 18:44









DisintegratingByParts

57.9k42477




57.9k42477












  • Hi there, thank you for your answer. What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:42






  • 1




    @BLAZE The function $cos(x/2)$ being periodic on $-pi < x < pi$ is a statement that doesn't make sense. If you explain that statement, then you'll get at the root of the problem. When you perform a Fourier series, the resulting series will be a $2pi$ periodic function. And your first coefficient formula works for arbitrary $x_0$ only if you have extended the function to a periodic function on $mathbb{R}$ with period $L$.
    – DisintegratingByParts
    Nov 16 at 13:35






  • 1




    @BLAZE : The standard Fourier series works on $2pi$ periodic functions. However, your interval was $[-2pi,2pi]$, which has length $4pi$. That's not the standard Fourier series.
    – DisintegratingByParts
    Nov 16 at 13:37




















  • Hi there, thank you for your answer. What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:42






  • 1




    @BLAZE The function $cos(x/2)$ being periodic on $-pi < x < pi$ is a statement that doesn't make sense. If you explain that statement, then you'll get at the root of the problem. When you perform a Fourier series, the resulting series will be a $2pi$ periodic function. And your first coefficient formula works for arbitrary $x_0$ only if you have extended the function to a periodic function on $mathbb{R}$ with period $L$.
    – DisintegratingByParts
    Nov 16 at 13:35






  • 1




    @BLAZE : The standard Fourier series works on $2pi$ periodic functions. However, your interval was $[-2pi,2pi]$, which has length $4pi$. That's not the standard Fourier series.
    – DisintegratingByParts
    Nov 16 at 13:37


















Hi there, thank you for your answer. What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
– BLAZE
Nov 16 at 9:42




Hi there, thank you for your answer. What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
– BLAZE
Nov 16 at 9:42




1




1




@BLAZE The function $cos(x/2)$ being periodic on $-pi < x < pi$ is a statement that doesn't make sense. If you explain that statement, then you'll get at the root of the problem. When you perform a Fourier series, the resulting series will be a $2pi$ periodic function. And your first coefficient formula works for arbitrary $x_0$ only if you have extended the function to a periodic function on $mathbb{R}$ with period $L$.
– DisintegratingByParts
Nov 16 at 13:35




@BLAZE The function $cos(x/2)$ being periodic on $-pi < x < pi$ is a statement that doesn't make sense. If you explain that statement, then you'll get at the root of the problem. When you perform a Fourier series, the resulting series will be a $2pi$ periodic function. And your first coefficient formula works for arbitrary $x_0$ only if you have extended the function to a periodic function on $mathbb{R}$ with period $L$.
– DisintegratingByParts
Nov 16 at 13:35




1




1




@BLAZE : The standard Fourier series works on $2pi$ periodic functions. However, your interval was $[-2pi,2pi]$, which has length $4pi$. That's not the standard Fourier series.
– DisintegratingByParts
Nov 16 at 13:37






@BLAZE : The standard Fourier series works on $2pi$ periodic functions. However, your interval was $[-2pi,2pi]$, which has length $4pi$. That's not the standard Fourier series.
– DisintegratingByParts
Nov 16 at 13:37












up vote
2
down vote













If you "extend the period" you get a rather different looking curve
enter image description here



The question that they are asking seem to be to evaluate.



$a_n = frac 1{2pi}int_{-pi}^{pi} cos frac x2 cos nx dx\
frac {1}{4pi} int_{-pi}^{pi} cos (n+frac 12)x + cos (n-frac 12)x dx\
$






share|cite|improve this answer





















  • Yes, but by the Dirichlet conditions for convergence the function must be periodic. Your function is not periodic on $[-pi, pi]$
    – BLAZE
    Nov 13 at 1:10










  • My answer follows yours, but I have gnuplot setup to produce something similar so it was easy to add the picture - like your answer it explains it better - I added mine just for the picture really - plus one :-)
    – tom
    Nov 13 at 1:28










  • @Doug Is there something special about $cos(x/2)$ why I cannot extend the range of the function to make it periodic?
    – BLAZE
    Nov 13 at 1:38






  • 1




    You have a function that is periodic with period $2pi$ It is not the full period of $cos frac x2$ but instead $|cos frac x2|$
    – Doug M
    Nov 13 at 1:44






  • 1




    @BLAZE Regarding the text on pages 422, 3 of your text. If you only care about the functions' behavior inside the interval, then sometimes it will simplify your calculations if you extend the interval. If are trying to represent a periodic function, or a wave, then don't.
    – Doug M
    Nov 16 at 17:03















up vote
2
down vote













If you "extend the period" you get a rather different looking curve
enter image description here



The question that they are asking seem to be to evaluate.



$a_n = frac 1{2pi}int_{-pi}^{pi} cos frac x2 cos nx dx\
frac {1}{4pi} int_{-pi}^{pi} cos (n+frac 12)x + cos (n-frac 12)x dx\
$






share|cite|improve this answer





















  • Yes, but by the Dirichlet conditions for convergence the function must be periodic. Your function is not periodic on $[-pi, pi]$
    – BLAZE
    Nov 13 at 1:10










  • My answer follows yours, but I have gnuplot setup to produce something similar so it was easy to add the picture - like your answer it explains it better - I added mine just for the picture really - plus one :-)
    – tom
    Nov 13 at 1:28










  • @Doug Is there something special about $cos(x/2)$ why I cannot extend the range of the function to make it periodic?
    – BLAZE
    Nov 13 at 1:38






  • 1




    You have a function that is periodic with period $2pi$ It is not the full period of $cos frac x2$ but instead $|cos frac x2|$
    – Doug M
    Nov 13 at 1:44






  • 1




    @BLAZE Regarding the text on pages 422, 3 of your text. If you only care about the functions' behavior inside the interval, then sometimes it will simplify your calculations if you extend the interval. If are trying to represent a periodic function, or a wave, then don't.
    – Doug M
    Nov 16 at 17:03













up vote
2
down vote










up vote
2
down vote









If you "extend the period" you get a rather different looking curve
enter image description here



The question that they are asking seem to be to evaluate.



$a_n = frac 1{2pi}int_{-pi}^{pi} cos frac x2 cos nx dx\
frac {1}{4pi} int_{-pi}^{pi} cos (n+frac 12)x + cos (n-frac 12)x dx\
$






share|cite|improve this answer












If you "extend the period" you get a rather different looking curve
enter image description here



The question that they are asking seem to be to evaluate.



$a_n = frac 1{2pi}int_{-pi}^{pi} cos frac x2 cos nx dx\
frac {1}{4pi} int_{-pi}^{pi} cos (n+frac 12)x + cos (n-frac 12)x dx\
$







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Nov 13 at 1:03









Doug M

43k31752




43k31752












  • Yes, but by the Dirichlet conditions for convergence the function must be periodic. Your function is not periodic on $[-pi, pi]$
    – BLAZE
    Nov 13 at 1:10










  • My answer follows yours, but I have gnuplot setup to produce something similar so it was easy to add the picture - like your answer it explains it better - I added mine just for the picture really - plus one :-)
    – tom
    Nov 13 at 1:28










  • @Doug Is there something special about $cos(x/2)$ why I cannot extend the range of the function to make it periodic?
    – BLAZE
    Nov 13 at 1:38






  • 1




    You have a function that is periodic with period $2pi$ It is not the full period of $cos frac x2$ but instead $|cos frac x2|$
    – Doug M
    Nov 13 at 1:44






  • 1




    @BLAZE Regarding the text on pages 422, 3 of your text. If you only care about the functions' behavior inside the interval, then sometimes it will simplify your calculations if you extend the interval. If are trying to represent a periodic function, or a wave, then don't.
    – Doug M
    Nov 16 at 17:03


















  • Yes, but by the Dirichlet conditions for convergence the function must be periodic. Your function is not periodic on $[-pi, pi]$
    – BLAZE
    Nov 13 at 1:10










  • My answer follows yours, but I have gnuplot setup to produce something similar so it was easy to add the picture - like your answer it explains it better - I added mine just for the picture really - plus one :-)
    – tom
    Nov 13 at 1:28










  • @Doug Is there something special about $cos(x/2)$ why I cannot extend the range of the function to make it periodic?
    – BLAZE
    Nov 13 at 1:38






  • 1




    You have a function that is periodic with period $2pi$ It is not the full period of $cos frac x2$ but instead $|cos frac x2|$
    – Doug M
    Nov 13 at 1:44






  • 1




    @BLAZE Regarding the text on pages 422, 3 of your text. If you only care about the functions' behavior inside the interval, then sometimes it will simplify your calculations if you extend the interval. If are trying to represent a periodic function, or a wave, then don't.
    – Doug M
    Nov 16 at 17:03
















Yes, but by the Dirichlet conditions for convergence the function must be periodic. Your function is not periodic on $[-pi, pi]$
– BLAZE
Nov 13 at 1:10




Yes, but by the Dirichlet conditions for convergence the function must be periodic. Your function is not periodic on $[-pi, pi]$
– BLAZE
Nov 13 at 1:10












My answer follows yours, but I have gnuplot setup to produce something similar so it was easy to add the picture - like your answer it explains it better - I added mine just for the picture really - plus one :-)
– tom
Nov 13 at 1:28




My answer follows yours, but I have gnuplot setup to produce something similar so it was easy to add the picture - like your answer it explains it better - I added mine just for the picture really - plus one :-)
– tom
Nov 13 at 1:28












@Doug Is there something special about $cos(x/2)$ why I cannot extend the range of the function to make it periodic?
– BLAZE
Nov 13 at 1:38




@Doug Is there something special about $cos(x/2)$ why I cannot extend the range of the function to make it periodic?
– BLAZE
Nov 13 at 1:38




1




1




You have a function that is periodic with period $2pi$ It is not the full period of $cos frac x2$ but instead $|cos frac x2|$
– Doug M
Nov 13 at 1:44




You have a function that is periodic with period $2pi$ It is not the full period of $cos frac x2$ but instead $|cos frac x2|$
– Doug M
Nov 13 at 1:44




1




1




@BLAZE Regarding the text on pages 422, 3 of your text. If you only care about the functions' behavior inside the interval, then sometimes it will simplify your calculations if you extend the interval. If are trying to represent a periodic function, or a wave, then don't.
– Doug M
Nov 16 at 17:03




@BLAZE Regarding the text on pages 422, 3 of your text. If you only care about the functions' behavior inside the interval, then sometimes it will simplify your calculations if you extend the interval. If are trying to represent a periodic function, or a wave, then don't.
– Doug M
Nov 16 at 17:03










up vote
1
down vote













$a_1=frac{1}{2pi}int_{-2pi}^{2pi}cos^2(frac{x}{2})dx=frac{1}{4pi}int_{-2pi}^{2pi}1dx=1$.






share|cite|improve this answer





















  • In my answer I used the fact that $cos^2(x)+sin^2(x)=1$ and the integrals over the range of $sin^2(x/2)$ and $cos^2(x/2)$ are equal.
    – herb steinberg
    Nov 13 at 0:57

















up vote
1
down vote













$a_1=frac{1}{2pi}int_{-2pi}^{2pi}cos^2(frac{x}{2})dx=frac{1}{4pi}int_{-2pi}^{2pi}1dx=1$.






share|cite|improve this answer





















  • In my answer I used the fact that $cos^2(x)+sin^2(x)=1$ and the integrals over the range of $sin^2(x/2)$ and $cos^2(x/2)$ are equal.
    – herb steinberg
    Nov 13 at 0:57















up vote
1
down vote










up vote
1
down vote









$a_1=frac{1}{2pi}int_{-2pi}^{2pi}cos^2(frac{x}{2})dx=frac{1}{4pi}int_{-2pi}^{2pi}1dx=1$.






share|cite|improve this answer












$a_1=frac{1}{2pi}int_{-2pi}^{2pi}cos^2(frac{x}{2})dx=frac{1}{4pi}int_{-2pi}^{2pi}1dx=1$.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Nov 13 at 0:52









herb steinberg

2,2382310




2,2382310












  • In my answer I used the fact that $cos^2(x)+sin^2(x)=1$ and the integrals over the range of $sin^2(x/2)$ and $cos^2(x/2)$ are equal.
    – herb steinberg
    Nov 13 at 0:57




















  • In my answer I used the fact that $cos^2(x)+sin^2(x)=1$ and the integrals over the range of $sin^2(x/2)$ and $cos^2(x/2)$ are equal.
    – herb steinberg
    Nov 13 at 0:57


















In my answer I used the fact that $cos^2(x)+sin^2(x)=1$ and the integrals over the range of $sin^2(x/2)$ and $cos^2(x/2)$ are equal.
– herb steinberg
Nov 13 at 0:57






In my answer I used the fact that $cos^2(x)+sin^2(x)=1$ and the integrals over the range of $sin^2(x/2)$ and $cos^2(x/2)$ are equal.
– herb steinberg
Nov 13 at 0:57












up vote
1
down vote













enter image description here



This was generated with gnuplot - it shows a function that is defined by



$$f(x) = cos(x/2) quad -pi<x<pi$$
and
$$f(x+2pi)=f(x)$$



I think you need to stick to the range of $-pi<x<pi$ - which is what @DougM is saying in his answer





Edit about $x^2$ range extension...



The picture in the reference you gave is helpful here - where it shows the $x^2$ function being 'mirrored' or reflected in the $y$-axis.



So $x^2$ is an even function and so in the Fourier series we will only have contributions from $cos(kx)$ and not $sin(kx)$



This means that the critical integrals of
$$int x^2 cos(kx) dx $$
are even - or at least the $x^2 cos(kx)$ function inside is even.



Now if the function is even then integrating over the range $[0,2]$ will give exactly half the value that you get integrating over $[-2,2]$ - because everything is completely symmetrical about the $y$-axis or the line $x=0$.



In your case of the cos$(x/2)$ you also have an even function, but you are not expanding into the mirror image on the other side of the $y$-axis... instead you are making the range wider and the $cos(x/2)$ function now is negative and things change.



For example - with the extended range the $a_0$ term will be zero, but in the figure above everything is above the $x$-axis so $a_0$ will be positive and non-zero.






share|cite|improve this answer























  • Thanks, this is really helpful stuff. Does it seem that the formulas given in the text book on page 417 are wrong? Since all I did was apply them (as in the $x^2$ case) and got the wrong answer.
    – BLAZE
    Nov 13 at 1:48








  • 1




    No the equations are fine... it is just a case of knowing when to apply which equation. - the pictures in Doug M's answer show that when you change the range for the cos(x/2) the whole shape of the function changes, whereas in the case of x^2 it is just a reflection in the axis and, of course, $x^2$ is symmetrical anyway about the yaxis... the reason the $x^2$ is extended is so that there is not a sudden drop or rise in the function - so that the two ends meet at the same height of +4...
    – tom
    Nov 13 at 1:53










  • Very impressive answer. Would you mind making an answer to this previous (but longer version of this) question and see if you can summarize what you wrote here to make the distinction between the 2 cases where you can and cannot extend the range of the function?
    – BLAZE
    Nov 13 at 1:56








  • 1




    I am afraid that I cannot do that at the moment, sorry - not enough time, but I think a key point about why the $x^2$ function was extended was so that at each end of the range $x^2$ = 4 so that when you make the function periodic and join it up the ends are at the same height - or y value - and touch
    – tom
    Nov 13 at 2:00












  • What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:41















up vote
1
down vote













enter image description here



This was generated with gnuplot - it shows a function that is defined by



$$f(x) = cos(x/2) quad -pi<x<pi$$
and
$$f(x+2pi)=f(x)$$



I think you need to stick to the range of $-pi<x<pi$ - which is what @DougM is saying in his answer





Edit about $x^2$ range extension...



The picture in the reference you gave is helpful here - where it shows the $x^2$ function being 'mirrored' or reflected in the $y$-axis.



So $x^2$ is an even function and so in the Fourier series we will only have contributions from $cos(kx)$ and not $sin(kx)$



This means that the critical integrals of
$$int x^2 cos(kx) dx $$
are even - or at least the $x^2 cos(kx)$ function inside is even.



Now if the function is even then integrating over the range $[0,2]$ will give exactly half the value that you get integrating over $[-2,2]$ - because everything is completely symmetrical about the $y$-axis or the line $x=0$.



In your case of the cos$(x/2)$ you also have an even function, but you are not expanding into the mirror image on the other side of the $y$-axis... instead you are making the range wider and the $cos(x/2)$ function now is negative and things change.



For example - with the extended range the $a_0$ term will be zero, but in the figure above everything is above the $x$-axis so $a_0$ will be positive and non-zero.






share|cite|improve this answer























  • Thanks, this is really helpful stuff. Does it seem that the formulas given in the text book on page 417 are wrong? Since all I did was apply them (as in the $x^2$ case) and got the wrong answer.
    – BLAZE
    Nov 13 at 1:48








  • 1




    No the equations are fine... it is just a case of knowing when to apply which equation. - the pictures in Doug M's answer show that when you change the range for the cos(x/2) the whole shape of the function changes, whereas in the case of x^2 it is just a reflection in the axis and, of course, $x^2$ is symmetrical anyway about the yaxis... the reason the $x^2$ is extended is so that there is not a sudden drop or rise in the function - so that the two ends meet at the same height of +4...
    – tom
    Nov 13 at 1:53










  • Very impressive answer. Would you mind making an answer to this previous (but longer version of this) question and see if you can summarize what you wrote here to make the distinction between the 2 cases where you can and cannot extend the range of the function?
    – BLAZE
    Nov 13 at 1:56








  • 1




    I am afraid that I cannot do that at the moment, sorry - not enough time, but I think a key point about why the $x^2$ function was extended was so that at each end of the range $x^2$ = 4 so that when you make the function periodic and join it up the ends are at the same height - or y value - and touch
    – tom
    Nov 13 at 2:00












  • What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:41













up vote
1
down vote










up vote
1
down vote









enter image description here



This was generated with gnuplot - it shows a function that is defined by



$$f(x) = cos(x/2) quad -pi<x<pi$$
and
$$f(x+2pi)=f(x)$$



I think you need to stick to the range of $-pi<x<pi$ - which is what @DougM is saying in his answer





Edit about $x^2$ range extension...



The picture in the reference you gave is helpful here - where it shows the $x^2$ function being 'mirrored' or reflected in the $y$-axis.



So $x^2$ is an even function and so in the Fourier series we will only have contributions from $cos(kx)$ and not $sin(kx)$



This means that the critical integrals of
$$int x^2 cos(kx) dx $$
are even - or at least the $x^2 cos(kx)$ function inside is even.



Now if the function is even then integrating over the range $[0,2]$ will give exactly half the value that you get integrating over $[-2,2]$ - because everything is completely symmetrical about the $y$-axis or the line $x=0$.



In your case of the cos$(x/2)$ you also have an even function, but you are not expanding into the mirror image on the other side of the $y$-axis... instead you are making the range wider and the $cos(x/2)$ function now is negative and things change.



For example - with the extended range the $a_0$ term will be zero, but in the figure above everything is above the $x$-axis so $a_0$ will be positive and non-zero.






share|cite|improve this answer














enter image description here



This was generated with gnuplot - it shows a function that is defined by



$$f(x) = cos(x/2) quad -pi<x<pi$$
and
$$f(x+2pi)=f(x)$$



I think you need to stick to the range of $-pi<x<pi$ - which is what @DougM is saying in his answer





Edit about $x^2$ range extension...



The picture in the reference you gave is helpful here - where it shows the $x^2$ function being 'mirrored' or reflected in the $y$-axis.



So $x^2$ is an even function and so in the Fourier series we will only have contributions from $cos(kx)$ and not $sin(kx)$



This means that the critical integrals of
$$int x^2 cos(kx) dx $$
are even - or at least the $x^2 cos(kx)$ function inside is even.



Now if the function is even then integrating over the range $[0,2]$ will give exactly half the value that you get integrating over $[-2,2]$ - because everything is completely symmetrical about the $y$-axis or the line $x=0$.



In your case of the cos$(x/2)$ you also have an even function, but you are not expanding into the mirror image on the other side of the $y$-axis... instead you are making the range wider and the $cos(x/2)$ function now is negative and things change.



For example - with the extended range the $a_0$ term will be zero, but in the figure above everything is above the $x$-axis so $a_0$ will be positive and non-zero.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Nov 13 at 1:48

























answered Nov 13 at 1:21









tom

1429




1429












  • Thanks, this is really helpful stuff. Does it seem that the formulas given in the text book on page 417 are wrong? Since all I did was apply them (as in the $x^2$ case) and got the wrong answer.
    – BLAZE
    Nov 13 at 1:48








  • 1




    No the equations are fine... it is just a case of knowing when to apply which equation. - the pictures in Doug M's answer show that when you change the range for the cos(x/2) the whole shape of the function changes, whereas in the case of x^2 it is just a reflection in the axis and, of course, $x^2$ is symmetrical anyway about the yaxis... the reason the $x^2$ is extended is so that there is not a sudden drop or rise in the function - so that the two ends meet at the same height of +4...
    – tom
    Nov 13 at 1:53










  • Very impressive answer. Would you mind making an answer to this previous (but longer version of this) question and see if you can summarize what you wrote here to make the distinction between the 2 cases where you can and cannot extend the range of the function?
    – BLAZE
    Nov 13 at 1:56








  • 1




    I am afraid that I cannot do that at the moment, sorry - not enough time, but I think a key point about why the $x^2$ function was extended was so that at each end of the range $x^2$ = 4 so that when you make the function periodic and join it up the ends are at the same height - or y value - and touch
    – tom
    Nov 13 at 2:00












  • What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:41


















  • Thanks, this is really helpful stuff. Does it seem that the formulas given in the text book on page 417 are wrong? Since all I did was apply them (as in the $x^2$ case) and got the wrong answer.
    – BLAZE
    Nov 13 at 1:48








  • 1




    No the equations are fine... it is just a case of knowing when to apply which equation. - the pictures in Doug M's answer show that when you change the range for the cos(x/2) the whole shape of the function changes, whereas in the case of x^2 it is just a reflection in the axis and, of course, $x^2$ is symmetrical anyway about the yaxis... the reason the $x^2$ is extended is so that there is not a sudden drop or rise in the function - so that the two ends meet at the same height of +4...
    – tom
    Nov 13 at 1:53










  • Very impressive answer. Would you mind making an answer to this previous (but longer version of this) question and see if you can summarize what you wrote here to make the distinction between the 2 cases where you can and cannot extend the range of the function?
    – BLAZE
    Nov 13 at 1:56








  • 1




    I am afraid that I cannot do that at the moment, sorry - not enough time, but I think a key point about why the $x^2$ function was extended was so that at each end of the range $x^2$ = 4 so that when you make the function periodic and join it up the ends are at the same height - or y value - and touch
    – tom
    Nov 13 at 2:00












  • What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
    – BLAZE
    Nov 16 at 9:41
















Thanks, this is really helpful stuff. Does it seem that the formulas given in the text book on page 417 are wrong? Since all I did was apply them (as in the $x^2$ case) and got the wrong answer.
– BLAZE
Nov 13 at 1:48






Thanks, this is really helpful stuff. Does it seem that the formulas given in the text book on page 417 are wrong? Since all I did was apply them (as in the $x^2$ case) and got the wrong answer.
– BLAZE
Nov 13 at 1:48






1




1




No the equations are fine... it is just a case of knowing when to apply which equation. - the pictures in Doug M's answer show that when you change the range for the cos(x/2) the whole shape of the function changes, whereas in the case of x^2 it is just a reflection in the axis and, of course, $x^2$ is symmetrical anyway about the yaxis... the reason the $x^2$ is extended is so that there is not a sudden drop or rise in the function - so that the two ends meet at the same height of +4...
– tom
Nov 13 at 1:53




No the equations are fine... it is just a case of knowing when to apply which equation. - the pictures in Doug M's answer show that when you change the range for the cos(x/2) the whole shape of the function changes, whereas in the case of x^2 it is just a reflection in the axis and, of course, $x^2$ is symmetrical anyway about the yaxis... the reason the $x^2$ is extended is so that there is not a sudden drop or rise in the function - so that the two ends meet at the same height of +4...
– tom
Nov 13 at 1:53












Very impressive answer. Would you mind making an answer to this previous (but longer version of this) question and see if you can summarize what you wrote here to make the distinction between the 2 cases where you can and cannot extend the range of the function?
– BLAZE
Nov 13 at 1:56






Very impressive answer. Would you mind making an answer to this previous (but longer version of this) question and see if you can summarize what you wrote here to make the distinction between the 2 cases where you can and cannot extend the range of the function?
– BLAZE
Nov 13 at 1:56






1




1




I am afraid that I cannot do that at the moment, sorry - not enough time, but I think a key point about why the $x^2$ function was extended was so that at each end of the range $x^2$ = 4 so that when you make the function periodic and join it up the ends are at the same height - or y value - and touch
– tom
Nov 13 at 2:00






I am afraid that I cannot do that at the moment, sorry - not enough time, but I think a key point about why the $x^2$ function was extended was so that at each end of the range $x^2$ = 4 so that when you make the function periodic and join it up the ends are at the same height - or y value - and touch
– tom
Nov 13 at 2:00














What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
– BLAZE
Nov 16 at 9:41




What I am questioning here is the recipe for finding the Fourier series and why it works for some functions (like the $x^2$ case) but not for other functions (the $cos(x/2)$ case). Would you mind taking a look at my edit to the question to see if you can address this?
– BLAZE
Nov 16 at 9:41


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2996121%2fwhy-does-this-method-fail-for-finding-the-fourier-series-for-cos-left-fracx%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...