// Numbas version: finer_feedback_settings {"name": "Trigonometric form of a Fourier series Evaluate ak & bk", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "

Given the function:

\n

  \\(f(t)=\\left[ \\begin{array}{cc}\\,\\,\\var{a}&\\,\\,-\\var{L}<t<-\\simplify{{L}/2}\\\\\\,\\,\\var{b}&\\,\\,-\\simplify{{L}/2}<t<\\simplify{{L}/2}\\\\\\,\\,\\var{c}&\\,\\,\\simplify{{L}/2}<t<\\var{L}\\end{array}\\right] \\,\\,\\,\\,f(t+\\simplify{2*{L}})=f(t)\\)

", "variablesTest": {"maxRuns": 100, "condition": ""}, "advice": "

 \\(f(t)=\\left[ \\begin{array}{cc}\\,\\,\\var{a}&\\,\\,-\\var{L}<t<-\\simplify{{L}/2}\\\\\\,\\,\\var{b}&\\,\\,-\\simplify{{L}/2}<t<\\simplify{{L}/2}\\\\\\,\\,\\var{c}&\\,\\,\\simplify{{L}/2}<t<\\var{L}\\end{array}\\right] \\,\\,\\,\\,f(t+\\simplify{2*{L}})=f(t)\\)

\n

\n

We derived the formulae for a trigonometric Fourier series of a periodic function having period \\(2L\\)

\n

\\(2L=\\simplify{2*{L}}\\implies L=\\var{L}\\)

\n

We can either evaluate \\(a_0=\\frac{1}{L}\\int_{-L}^{L}f(t)dt\\) or use the shortcut:

\n

\\(\\frac{a_0}{2}=\\) the average value of the wave over one complete cycle \\(=\\frac{Area}{Base}\\)

\n

\\(\\frac{a_0}{2}=\\frac{\\var{a}*\\simplify{{L}/2}+\\var{b}*\\var{L}+\\var{c}*\\simplify{{L}/2}}{\\simplify{2*{L}}}=\\simplify{({a}+2*{b}+{c})/4}\\)

\n

\n

The formula for the Fourier coefficient \\(a_k\\) is given by:  \\(a_k=\\frac{1}{L}\\int_{-L}^{L}f(t)cos\\left(\\frac{{k}\\pi}{L}t\\right)dt\\)

\n

\n

\\(a_k=\\frac{1}{\\var{L}}\\left(\\int_{-\\var{L}}^{-\\frac{\\var{L}}{2}}\\var{a}cos\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)dt+\\int_{-\\frac{\\var{L}}{2}}^{\\frac{\\var{L}}{2}}\\var{b}cos\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)dt+\\int_{\\frac{\\var{L}}{2}}^{\\var{L}}\\var{c}cos\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)dt\\right)\\)

\n

\\(a_k=\\frac{1}{\\var{L}}\\left(\\frac{\\var{a}*\\var{L}}{{k}\\pi}sin\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)|_{-\\var{L}}^{-\\frac{\\var{L}}{2}}+\\frac{\\var{b}*\\var{L}}{{k}\\pi}sin\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)|_{-\\frac{\\var{L}}{2}}^{\\frac{\\var{L}}{2}}+\\frac{\\var{c}*\\var{L}}{{k}\\pi}sin\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)|_{\\frac{\\var{L}}{2}}^{\\var{L}}\\right)\\)

\n

\\(a_k=\\frac{\\var{a}}{{k}\\pi}sin(-\\frac{{k}\\pi}{2})-\\frac{\\var{a}}{{k}\\pi}sin(-{k}\\pi)+\\frac{\\var{b}}{{k}\\pi}sin(\\frac{{k}\\pi}{2})-\\frac{\\var{b}}{{k}\\pi}sin(-\\frac{{k}\\pi}{2})+\\frac{\\var{c}}{{k}\\pi}sin({k}\\pi)-\\frac{\\var{c}}{{k}\\pi}sin(\\frac{{k}\\pi}{2})\\)

\n

\\(a_k=-\\frac{\\var{a}}{{k}\\pi}sin(\\frac{{k}\\pi}{2})+\\frac{\\var{b}}{{k}\\pi}sin(\\frac{{k}\\pi}{2})+\\frac{\\var{b}}{{k}\\pi}sin(\\frac{{k}\\pi}{2})-\\frac{\\var{c}}{{k}\\pi}sin(\\frac{{k}\\pi}{2})\\)

\n

\\(a_k=\\frac{\\simplify{-{a}+2{b}-{c}}}{{k}\\pi}sin(\\frac{{k}\\pi}{2})\\)

\n

\\(a_\\var{k}=\\simplify{(-{a}+2{b}-{c})/({k}*pi)sin({k}*pi/2)}\\)

\n

The formula for the Fourier coefficient \\(b_k\\) is given by:  \\(b_k=\\frac{1}{L}\\int_{-L}^{L}f(t)sin\\left(\\frac{{k}\\pi}{L}t\\right)dt\\)

\n

\\(b_k=\\frac{1}{\\var{L}}\\left(\\int_{-\\var{L}}^{-\\frac{\\var{L}}{2}}\\var{a}sin\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)dt+\\int_{-\\frac{\\var{L}}{2}}^{\\frac{\\var{L}}{2}}\\var{b}sin\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)dt+\\int_{\\frac{\\var{L}}{2}}^{\\var{L}}\\var{c}sin\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)dt\\right)\\)

\n

\\(b_k=\\frac{1}{\\var{L}}\\left(-\\frac{\\var{a}*\\var{L}}{{k}\\pi}cos\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)|_{-\\var{L}}^{-\\frac{\\var{L}}{2}}-\\frac{\\var{b}*\\var{L}}{{k}\\pi}cos\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)|_{-\\frac{\\var{L}}{2}}^{\\frac{\\var{L}}{2}}-\\frac{\\var{c}*\\var{L}}{{k}\\pi}cos\\left(\\frac{{k}\\pi}{\\var{L}}t\\right)|_{\\frac{\\var{L}}{2}}^{\\var{L}}\\right)\\)

\n

\\(b_k=-\\frac{\\var{a}}{{k}\\pi}cos(-\\frac{{k}\\pi}{2})+\\frac{\\var{a}}{{k}\\pi}cos(-{k}\\pi)-\\frac{\\var{b}}{{k}\\pi}cos(\\frac{{k}\\pi}{2})+\\frac{\\var{b}}{{k}\\pi}cos(-\\frac{{k}\\pi}{2})-\\frac{\\var{c}}{{k}\\pi}cos({k}\\pi)+\\frac{\\var{c}}{{k}\\pi}cos(\\frac{{k}\\pi}{2})\\)

\n

\\(cos(-\\theta)=cos(\\theta)\\)

\n

\\(b_k=-\\frac{\\var{a}}{{k}\\pi}cos(\\frac{{k}\\pi}{2})+\\frac{\\var{a}}{{k}\\pi}cos({k}\\pi)-\\frac{\\var{b}}{{k}\\pi}cos(\\frac{{k}\\pi}{2})+\\frac{\\var{b}}{{k}\\pi}cos(\\frac{{k}\\pi}{2})-\\frac{\\var{c}}{{k}\\pi}cos({k}\\pi)+\\frac{\\var{c}}{{k}\\pi}cos(\\frac{{k}\\pi}{2})\\)

\n

\\(b_k=\\frac{\\var{c}-\\var{a}}{{k}\\pi}cos(\\frac{{k}\\pi}{2})+\\frac{\\var{a}-\\var{c}}{{k}\\pi}cos({k}\\pi)\\)

\n

\\(b_\\var{k}=\\simplify{({c}-{a})/({k}*pi)cos({k}*pi/2)}+\\simplify{(-{c}+{a})/({k}*pi)cos({k}*pi)}\\)

\n

\n

Recall the amplitude of the \\(\\var{k}\\)th harmonic component is given by \\(\\sqrt{(a_\\var{k})^2+(b_\\var{k})^2}\\)

", "variables": {"k": {"description": "", "name": "k", "definition": "random(5..19#2)", "group": "Ungrouped variables", "templateType": "randrange"}, "c": {"description": "", "name": "c", "definition": "random(6..11#1)", "group": "Ungrouped variables", "templateType": "randrange"}, "L": {"description": "", "name": "L", "definition": "random(2..11#1)", "group": "Ungrouped variables", "templateType": "randrange"}, "b": {"description": "", "name": "b", "definition": "random(12..24#1)", "group": "Ungrouped variables", "templateType": "randrange"}, "a": {"description": "", "name": "a", "definition": "random(1..5#2)", "group": "Ungrouped variables", "templateType": "randrange"}}, "name": "Trigonometric form of a Fourier series Evaluate ak & bk", "extensions": [], "functions": {}, "parts": [{"variableReplacements": [], "customMarkingAlgorithm": "", "unitTests": [], "extendBaseMarkingAlgorithm": true, "scripts": {}, "prompt": "

Calculate the value of the first term of the Fourier series \\(\\frac{a_{0}}{2}\\).

\n

\\(\\frac{a_{0}}{2}\\) = [[0]]

", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "type": "gapfill", "sortAnswers": false, "marks": 0, "showCorrectAnswer": true, "gaps": [{"customMarkingAlgorithm": "", "unitTests": [], "minValue": "({a}/2+{b}+{c}/2)/2", "variableReplacementStrategy": "originalfirst", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "type": "numberentry", "mustBeReducedPC": 0, "precision": "3", "variableReplacements": [], "allowFractions": false, "correctAnswerStyle": "plain", "extendBaseMarkingAlgorithm": true, "scripts": {}, "showPrecisionHint": true, "maxValue": "({a}/2+{b}+{c}/2)/2", "correctAnswerFraction": false, "mustBeReduced": false, "precisionPartialCredit": 0, "marks": 1, "strictPrecision": false, "showCorrectAnswer": true, "precisionType": "dp", "notationStyles": ["plain", "en", "si-en"]}]}, {"variableReplacements": [], "customMarkingAlgorithm": "", "unitTests": [], "extendBaseMarkingAlgorithm": true, "scripts": {}, "prompt": "

Determine an expression for the trigonometric Fourier coefficient \\( a_{k}\\) and hence calculate the value for the value for \\(a_{\\var{k}}\\).

\n

\\( a_{\\var{k}}\\) = [[0]]

", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "type": "gapfill", "sortAnswers": false, "marks": 0, "showCorrectAnswer": true, "gaps": [{"customMarkingAlgorithm": "", "unitTests": [], "minValue": "(-{a}+2*{b}-{c})*sin({k}*pi/2)/(k}*pi)", "variableReplacementStrategy": "originalfirst", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "type": "numberentry", "mustBeReducedPC": 0, "precision": "3", "variableReplacements": [], "allowFractions": false, "correctAnswerStyle": "plain", "extendBaseMarkingAlgorithm": true, "scripts": {}, "showPrecisionHint": true, "maxValue": "(-{a}+2*{b}-{c})*sin({k}*pi/2)/(k}*pi)", "correctAnswerFraction": false, "mustBeReduced": false, "precisionPartialCredit": 0, "marks": "1", "strictPrecision": false, "showCorrectAnswer": true, "precisionType": "dp", "notationStyles": ["plain", "en", "si-en"]}]}, {"variableReplacements": [], "customMarkingAlgorithm": "", "unitTests": [], "extendBaseMarkingAlgorithm": true, "scripts": {}, "prompt": "

Determine an expression for the trigonometric Fourier coefficient \\( b_{k}\\) and hence calculate the value for the value for \\(b_{\\var{k}}\\), correct to three decimal places.

\n

\\( b_{\\var{k}}\\) = [[0]]

", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "type": "gapfill", "sortAnswers": false, "marks": 0, "showCorrectAnswer": true, "gaps": [{"customMarkingAlgorithm": "", "unitTests": [], "minValue": "({c}-{a})cos({k}*pi/2)/({k}*pi)+({a}-{c})cos({k}*pi)/({k}*pi)", "variableReplacementStrategy": "originalfirst", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "type": "numberentry", "mustBeReducedPC": 0, "precision": "3", "variableReplacements": [], "allowFractions": false, "correctAnswerStyle": "plain", "extendBaseMarkingAlgorithm": true, "scripts": {}, "showPrecisionHint": true, "maxValue": "({c}-{a})cos({k}*pi/2)/({k}*pi)+({a}-{c})cos({k}*pi)/({k}*pi)", "correctAnswerFraction": false, "mustBeReduced": false, "precisionPartialCredit": 0, "marks": "1", "strictPrecision": false, "showCorrectAnswer": true, "precisionType": "dp", "notationStyles": ["plain", "en", "si-en"]}]}, {"variableReplacements": [], "customMarkingAlgorithm": "", "unitTests": [], "extendBaseMarkingAlgorithm": true, "scripts": {}, "prompt": "

Calculate the amplitude of the \\(\\var{k}\\)th harmonic component, correct to two decimal places.

\n

Amplitude = [[0]]

", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "type": "gapfill", "sortAnswers": false, "marks": 0, "showCorrectAnswer": true, "gaps": [{"customMarkingAlgorithm": "", "unitTests": [], "minValue": "sqrt(((-{a}+2*{b}-{c})*sin({k}*pi/2)/(k}*pi))^2+(({c}-{a})cos({k}*pi/2)/({k}*pi)+({a}-{c})cos({k}*pi)/({k}*pi))^2)", "variableReplacementStrategy": "originalfirst", "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "type": "numberentry", "mustBeReducedPC": 0, "precision": "3", "variableReplacements": [], "allowFractions": false, "correctAnswerStyle": "plain", "extendBaseMarkingAlgorithm": true, "scripts": {}, "showPrecisionHint": true, "maxValue": "sqrt(((-{a}+2*{b}-{c})*sin({k}*pi/2)/(k}*pi))^2+(({c}-{a})cos({k}*pi/2)/({k}*pi)+({a}-{c})cos({k}*pi)/({k}*pi))^2)", "correctAnswerFraction": false, "mustBeReduced": false, "precisionPartialCredit": 0, "marks": 1, "strictPrecision": false, "showCorrectAnswer": true, "precisionType": "dp", "notationStyles": ["plain", "en", "si-en"]}]}], "metadata": {"description": "

Calculating particular harmonic components of a Fourier series expansion.

", "licence": "Creative Commons Attribution 4.0 International"}, "variable_groups": [], "ungrouped_variables": ["a", "L", "k", "b", "c"], "preamble": {"css": "", "js": ""}, "tags": [], "rulesets": {}, "type": "question", "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}]}