Create Fourier-Series of f(x) = x if 0 < x < Pi and 0 if Pi < x < 2*Pi












1












$begingroup$


I tried the following to create the Fourier-series of the function:



$$ f(x) = begin{cases} x & 0<x<pi \ 0 & pi < x < 2 pi end{cases}$$



This is what I tried:



$$a_0 = frac{1}{pi}intlimits_0^pi x dx = frac{1}{pi}cdotleft(frac{x^2}{2}|_0^piright) = frac{1}{pi}cdotfrac{pi^2}{2} = frac{pi^2}{2cdotpi} = frac{pi}{2}$$



Is that right?



$$a_n = frac{1}{pi}intlimits_0^pi x cdot cos(nx) dx = frac{1}{pi}cdotleft(frac{x cdot sin(nx)}{n} + frac{cos(nx)}{n^2}right)|_0^pi$$



Assuming that $sin(nx)$ is always $0$ and $cos(nx)$ is $(-1)^n$. Is that ok??



$$ = frac{1}{pi}cdotleft(frac{0}{n} + frac{(-1)^n}{n^2}right) = frac{1}{pi}cdotleft(frac{(-1)^n}{n^2}right) = frac{(-1)^n}{pi n^2}$$



That's already wrong I'm sure!



$$b_n = frac{1}{pi}intlimits_0^pi x sin(nx) dx = frac{1}{pi}cdotleft(frac{x cdot cos(nx)}{n} + frac{sin(nx)}{n^2}right)|_0^pi$$



Assuming that $sin(nx)$ is always $0$ and $cos(nx)$ is $(-1)^n$. Is that ok??



$$ = frac{1}{pi}cdotleft(frac{pi cdot (-1)^n}{n}right) = frac{picdot(-1)^n}{pi n} = frac{(-1)^n}{n}$$ voila, thats wrong again :-)



A solution would be great, but I also need to understand what was my mistake.



Thank you in advance!










share|cite|improve this question











$endgroup$












  • $begingroup$
    This is an old post, but for anyone coming to this now: one issue I see is the integral for a0 at the beginning. It should be done from -pi to pi, not zero to pi.
    $endgroup$
    – Jake
    Dec 5 '18 at 5:05










  • $begingroup$
    @Jake This is obviously not an issue at all.
    $endgroup$
    – Did
    Dec 5 '18 at 7:14
















1












$begingroup$


I tried the following to create the Fourier-series of the function:



$$ f(x) = begin{cases} x & 0<x<pi \ 0 & pi < x < 2 pi end{cases}$$



This is what I tried:



$$a_0 = frac{1}{pi}intlimits_0^pi x dx = frac{1}{pi}cdotleft(frac{x^2}{2}|_0^piright) = frac{1}{pi}cdotfrac{pi^2}{2} = frac{pi^2}{2cdotpi} = frac{pi}{2}$$



Is that right?



$$a_n = frac{1}{pi}intlimits_0^pi x cdot cos(nx) dx = frac{1}{pi}cdotleft(frac{x cdot sin(nx)}{n} + frac{cos(nx)}{n^2}right)|_0^pi$$



Assuming that $sin(nx)$ is always $0$ and $cos(nx)$ is $(-1)^n$. Is that ok??



$$ = frac{1}{pi}cdotleft(frac{0}{n} + frac{(-1)^n}{n^2}right) = frac{1}{pi}cdotleft(frac{(-1)^n}{n^2}right) = frac{(-1)^n}{pi n^2}$$



That's already wrong I'm sure!



$$b_n = frac{1}{pi}intlimits_0^pi x sin(nx) dx = frac{1}{pi}cdotleft(frac{x cdot cos(nx)}{n} + frac{sin(nx)}{n^2}right)|_0^pi$$



Assuming that $sin(nx)$ is always $0$ and $cos(nx)$ is $(-1)^n$. Is that ok??



$$ = frac{1}{pi}cdotleft(frac{pi cdot (-1)^n}{n}right) = frac{picdot(-1)^n}{pi n} = frac{(-1)^n}{n}$$ voila, thats wrong again :-)



A solution would be great, but I also need to understand what was my mistake.



Thank you in advance!










share|cite|improve this question











$endgroup$












  • $begingroup$
    This is an old post, but for anyone coming to this now: one issue I see is the integral for a0 at the beginning. It should be done from -pi to pi, not zero to pi.
    $endgroup$
    – Jake
    Dec 5 '18 at 5:05










  • $begingroup$
    @Jake This is obviously not an issue at all.
    $endgroup$
    – Did
    Dec 5 '18 at 7:14














1












1








1





$begingroup$


I tried the following to create the Fourier-series of the function:



$$ f(x) = begin{cases} x & 0<x<pi \ 0 & pi < x < 2 pi end{cases}$$



This is what I tried:



$$a_0 = frac{1}{pi}intlimits_0^pi x dx = frac{1}{pi}cdotleft(frac{x^2}{2}|_0^piright) = frac{1}{pi}cdotfrac{pi^2}{2} = frac{pi^2}{2cdotpi} = frac{pi}{2}$$



Is that right?



$$a_n = frac{1}{pi}intlimits_0^pi x cdot cos(nx) dx = frac{1}{pi}cdotleft(frac{x cdot sin(nx)}{n} + frac{cos(nx)}{n^2}right)|_0^pi$$



Assuming that $sin(nx)$ is always $0$ and $cos(nx)$ is $(-1)^n$. Is that ok??



$$ = frac{1}{pi}cdotleft(frac{0}{n} + frac{(-1)^n}{n^2}right) = frac{1}{pi}cdotleft(frac{(-1)^n}{n^2}right) = frac{(-1)^n}{pi n^2}$$



That's already wrong I'm sure!



$$b_n = frac{1}{pi}intlimits_0^pi x sin(nx) dx = frac{1}{pi}cdotleft(frac{x cdot cos(nx)}{n} + frac{sin(nx)}{n^2}right)|_0^pi$$



Assuming that $sin(nx)$ is always $0$ and $cos(nx)$ is $(-1)^n$. Is that ok??



$$ = frac{1}{pi}cdotleft(frac{pi cdot (-1)^n}{n}right) = frac{picdot(-1)^n}{pi n} = frac{(-1)^n}{n}$$ voila, thats wrong again :-)



A solution would be great, but I also need to understand what was my mistake.



Thank you in advance!










share|cite|improve this question











$endgroup$




I tried the following to create the Fourier-series of the function:



$$ f(x) = begin{cases} x & 0<x<pi \ 0 & pi < x < 2 pi end{cases}$$



This is what I tried:



$$a_0 = frac{1}{pi}intlimits_0^pi x dx = frac{1}{pi}cdotleft(frac{x^2}{2}|_0^piright) = frac{1}{pi}cdotfrac{pi^2}{2} = frac{pi^2}{2cdotpi} = frac{pi}{2}$$



Is that right?



$$a_n = frac{1}{pi}intlimits_0^pi x cdot cos(nx) dx = frac{1}{pi}cdotleft(frac{x cdot sin(nx)}{n} + frac{cos(nx)}{n^2}right)|_0^pi$$



Assuming that $sin(nx)$ is always $0$ and $cos(nx)$ is $(-1)^n$. Is that ok??



$$ = frac{1}{pi}cdotleft(frac{0}{n} + frac{(-1)^n}{n^2}right) = frac{1}{pi}cdotleft(frac{(-1)^n}{n^2}right) = frac{(-1)^n}{pi n^2}$$



That's already wrong I'm sure!



$$b_n = frac{1}{pi}intlimits_0^pi x sin(nx) dx = frac{1}{pi}cdotleft(frac{x cdot cos(nx)}{n} + frac{sin(nx)}{n^2}right)|_0^pi$$



Assuming that $sin(nx)$ is always $0$ and $cos(nx)$ is $(-1)^n$. Is that ok??



$$ = frac{1}{pi}cdotleft(frac{pi cdot (-1)^n}{n}right) = frac{picdot(-1)^n}{pi n} = frac{(-1)^n}{n}$$ voila, thats wrong again :-)



A solution would be great, but I also need to understand what was my mistake.



Thank you in advance!







fourier-series






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jun 17 '13 at 10:21









Yoni Rozenshein

5,3201634




5,3201634










asked Jun 17 '13 at 10:08









Kevin MuhlerKevin Muhler

1015




1015












  • $begingroup$
    This is an old post, but for anyone coming to this now: one issue I see is the integral for a0 at the beginning. It should be done from -pi to pi, not zero to pi.
    $endgroup$
    – Jake
    Dec 5 '18 at 5:05










  • $begingroup$
    @Jake This is obviously not an issue at all.
    $endgroup$
    – Did
    Dec 5 '18 at 7:14


















  • $begingroup$
    This is an old post, but for anyone coming to this now: one issue I see is the integral for a0 at the beginning. It should be done from -pi to pi, not zero to pi.
    $endgroup$
    – Jake
    Dec 5 '18 at 5:05










  • $begingroup$
    @Jake This is obviously not an issue at all.
    $endgroup$
    – Did
    Dec 5 '18 at 7:14
















$begingroup$
This is an old post, but for anyone coming to this now: one issue I see is the integral for a0 at the beginning. It should be done from -pi to pi, not zero to pi.
$endgroup$
– Jake
Dec 5 '18 at 5:05




$begingroup$
This is an old post, but for anyone coming to this now: one issue I see is the integral for a0 at the beginning. It should be done from -pi to pi, not zero to pi.
$endgroup$
– Jake
Dec 5 '18 at 5:05












$begingroup$
@Jake This is obviously not an issue at all.
$endgroup$
– Did
Dec 5 '18 at 7:14




$begingroup$
@Jake This is obviously not an issue at all.
$endgroup$
– Did
Dec 5 '18 at 7:14










1 Answer
1






active

oldest

votes


















2












$begingroup$

Plugging in $x=0$ and $x=pi$ in $sin (nx)$ indeed gives you $0$.



Plugging in $x=pi$ in $cos (nx)$ indeed gives you $(-1)^n$.



But don't forget that plugging in $x=0$ in $cos (nx)$ gives you $1$.



Also, in the integral for $b_n$, there seems to be a minus sign missing after the integration by parts. Recheck your calculation.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    But don't forget that plugging in x=0 in cos(nx) gives you 1. --> Yes, that was an Issue in the an calculation. Should I correct this finding in the initial question or what would be the proper way on Stackexchange?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:27












  • $begingroup$
    But I don't get where the minus in bn might be missing?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:28










  • $begingroup$
    What is the anti-derivative of $sin x$?
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:13










  • $begingroup$
    Since you asked about a mistake in your calculation, it is better to leave the mistake as-is in the question, so future readers will know what the question and answer were about.
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:14










  • $begingroup$
    Uuups, right, the anti-derivative is: -(x * cos(nx) / n)) + (sin(nx) / n²)
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 13:38













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',
autoActivateHeartbeat: false,
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%2f422646%2fcreate-fourier-series-of-fx-x-if-0-x-pi-and-0-if-pi-x-2pi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2












$begingroup$

Plugging in $x=0$ and $x=pi$ in $sin (nx)$ indeed gives you $0$.



Plugging in $x=pi$ in $cos (nx)$ indeed gives you $(-1)^n$.



But don't forget that plugging in $x=0$ in $cos (nx)$ gives you $1$.



Also, in the integral for $b_n$, there seems to be a minus sign missing after the integration by parts. Recheck your calculation.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    But don't forget that plugging in x=0 in cos(nx) gives you 1. --> Yes, that was an Issue in the an calculation. Should I correct this finding in the initial question or what would be the proper way on Stackexchange?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:27












  • $begingroup$
    But I don't get where the minus in bn might be missing?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:28










  • $begingroup$
    What is the anti-derivative of $sin x$?
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:13










  • $begingroup$
    Since you asked about a mistake in your calculation, it is better to leave the mistake as-is in the question, so future readers will know what the question and answer were about.
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:14










  • $begingroup$
    Uuups, right, the anti-derivative is: -(x * cos(nx) / n)) + (sin(nx) / n²)
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 13:38


















2












$begingroup$

Plugging in $x=0$ and $x=pi$ in $sin (nx)$ indeed gives you $0$.



Plugging in $x=pi$ in $cos (nx)$ indeed gives you $(-1)^n$.



But don't forget that plugging in $x=0$ in $cos (nx)$ gives you $1$.



Also, in the integral for $b_n$, there seems to be a minus sign missing after the integration by parts. Recheck your calculation.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    But don't forget that plugging in x=0 in cos(nx) gives you 1. --> Yes, that was an Issue in the an calculation. Should I correct this finding in the initial question or what would be the proper way on Stackexchange?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:27












  • $begingroup$
    But I don't get where the minus in bn might be missing?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:28










  • $begingroup$
    What is the anti-derivative of $sin x$?
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:13










  • $begingroup$
    Since you asked about a mistake in your calculation, it is better to leave the mistake as-is in the question, so future readers will know what the question and answer were about.
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:14










  • $begingroup$
    Uuups, right, the anti-derivative is: -(x * cos(nx) / n)) + (sin(nx) / n²)
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 13:38
















2












2








2





$begingroup$

Plugging in $x=0$ and $x=pi$ in $sin (nx)$ indeed gives you $0$.



Plugging in $x=pi$ in $cos (nx)$ indeed gives you $(-1)^n$.



But don't forget that plugging in $x=0$ in $cos (nx)$ gives you $1$.



Also, in the integral for $b_n$, there seems to be a minus sign missing after the integration by parts. Recheck your calculation.






share|cite|improve this answer









$endgroup$



Plugging in $x=0$ and $x=pi$ in $sin (nx)$ indeed gives you $0$.



Plugging in $x=pi$ in $cos (nx)$ indeed gives you $(-1)^n$.



But don't forget that plugging in $x=0$ in $cos (nx)$ gives you $1$.



Also, in the integral for $b_n$, there seems to be a minus sign missing after the integration by parts. Recheck your calculation.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Jun 17 '13 at 10:24









Yoni RozensheinYoni Rozenshein

5,3201634




5,3201634












  • $begingroup$
    But don't forget that plugging in x=0 in cos(nx) gives you 1. --> Yes, that was an Issue in the an calculation. Should I correct this finding in the initial question or what would be the proper way on Stackexchange?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:27












  • $begingroup$
    But I don't get where the minus in bn might be missing?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:28










  • $begingroup$
    What is the anti-derivative of $sin x$?
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:13










  • $begingroup$
    Since you asked about a mistake in your calculation, it is better to leave the mistake as-is in the question, so future readers will know what the question and answer were about.
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:14










  • $begingroup$
    Uuups, right, the anti-derivative is: -(x * cos(nx) / n)) + (sin(nx) / n²)
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 13:38




















  • $begingroup$
    But don't forget that plugging in x=0 in cos(nx) gives you 1. --> Yes, that was an Issue in the an calculation. Should I correct this finding in the initial question or what would be the proper way on Stackexchange?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:27












  • $begingroup$
    But I don't get where the minus in bn might be missing?
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 12:28










  • $begingroup$
    What is the anti-derivative of $sin x$?
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:13










  • $begingroup$
    Since you asked about a mistake in your calculation, it is better to leave the mistake as-is in the question, so future readers will know what the question and answer were about.
    $endgroup$
    – Yoni Rozenshein
    Jun 17 '13 at 13:14










  • $begingroup$
    Uuups, right, the anti-derivative is: -(x * cos(nx) / n)) + (sin(nx) / n²)
    $endgroup$
    – Kevin Muhler
    Jun 17 '13 at 13:38


















$begingroup$
But don't forget that plugging in x=0 in cos(nx) gives you 1. --> Yes, that was an Issue in the an calculation. Should I correct this finding in the initial question or what would be the proper way on Stackexchange?
$endgroup$
– Kevin Muhler
Jun 17 '13 at 12:27






$begingroup$
But don't forget that plugging in x=0 in cos(nx) gives you 1. --> Yes, that was an Issue in the an calculation. Should I correct this finding in the initial question or what would be the proper way on Stackexchange?
$endgroup$
– Kevin Muhler
Jun 17 '13 at 12:27














$begingroup$
But I don't get where the minus in bn might be missing?
$endgroup$
– Kevin Muhler
Jun 17 '13 at 12:28




$begingroup$
But I don't get where the minus in bn might be missing?
$endgroup$
– Kevin Muhler
Jun 17 '13 at 12:28












$begingroup$
What is the anti-derivative of $sin x$?
$endgroup$
– Yoni Rozenshein
Jun 17 '13 at 13:13




$begingroup$
What is the anti-derivative of $sin x$?
$endgroup$
– Yoni Rozenshein
Jun 17 '13 at 13:13












$begingroup$
Since you asked about a mistake in your calculation, it is better to leave the mistake as-is in the question, so future readers will know what the question and answer were about.
$endgroup$
– Yoni Rozenshein
Jun 17 '13 at 13:14




$begingroup$
Since you asked about a mistake in your calculation, it is better to leave the mistake as-is in the question, so future readers will know what the question and answer were about.
$endgroup$
– Yoni Rozenshein
Jun 17 '13 at 13:14












$begingroup$
Uuups, right, the anti-derivative is: -(x * cos(nx) / n)) + (sin(nx) / n²)
$endgroup$
– Kevin Muhler
Jun 17 '13 at 13:38






$begingroup$
Uuups, right, the anti-derivative is: -(x * cos(nx) / n)) + (sin(nx) / n²)
$endgroup$
– Kevin Muhler
Jun 17 '13 at 13:38




















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f422646%2fcreate-fourier-series-of-fx-x-if-0-x-pi-and-0-if-pi-x-2pi%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

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen