The partial sums of the Taylor series approximating a function $f\left(x\right)$ in the vicinity of the computation point ${x}_{0}$ via partial sums of a power series. If one would like to approximate a function over a larger interval one would need terms of very high order. The polynomial obtained by truncating the Taylor series would have to have as least as many turning points as the function. For periodical functions this would be very tedious for intervals larger than the period.

Periodical functions have large practical importance in telecommunications and electrical engineering. For such functions the approximation via the superposition of periodical standard functions (sine and cosine0 is much better suited. On expands the function into a series that consists of the fundamental tone and the overtones, i.e. of the functions $sinnx$ and $cosnx$ with integer values of $n$.

The analogy to the analysis of a vibrating string is immediately obvious: $sinx$ describes the vibration of the fundamental tone, $sin2x$ that of the octave, $sin3x$ that of the fifth above the octave and so on. For a string that is fixed at both ends; the variable $x$ is now the product $\omega t$ of the angular frequency $\omega $ and the time $t$.

$$x=\omega \phantom{\rule{0em}{0ex}}t=2\pi \phantom{\rule{0em}{0ex}}\nu \phantom{\rule{0em}{0ex}}t=2\pi \frac{t}{T};\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\nu \phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\text{frequencyofoscillation;}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}T\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\text{durationofoneperiod}$$

Depending on the shape of $f\left(t\right)$ one superimposes more or fewer of these sine/cosine oscillations with a certain strength and expressed as a number that determines the amplitude. The set of amplitudes of the overtones, i.e. the coefficients of the series expansion represents the spectrum of the periodical oscillation. Spectrum and oscillation form are corresponding representations of the same phenomenon. This representation in terms of superimposed sine and cosine functions is called the Fourier series of $f\left(t\right)$.

While the partial sums of the Taylor series approximate the function in the proximity of a point , the partial sums of the Fourier series are approximations for the entire interval of the fundamental period and therefore also - because of the periodicity of the functions considered - for an unlimited region of the variable $x$. The Fourier series does not have to coincide with the function at any point, while this the case for the Taylor Series at the computation point.

It depends on the properties of $f\left(t\right)$, how many overtones have to be superimposed to approximate the function at nearly all points. If one interprets the notion of convergence not strictly, then Fourier series converge for all functions, even for non continuous ones. The convergence is then not necessarily monotone, i.e. it can be better for some values of $t$ and worse for some other values of $t$ and even fail for some values! At discontinuities one observes overshootings even for higher orders of the series. This is called ringing in telecommunications.

Since the periodical phenomena that we consider here are mostly oscillations in time, the variable is usually $x=\omega t$. To also model the the phases of the individual overtones, we use a sum of terms with $sinnx$ and $cosnx$. Then the sum represents a phase-shifted sine or cosine function. Thus the general Fourier series reads

$$f\left(t\right)=\frac{{a}_{0}}{2}+\sum _{n=1}^{\infty}{a}_{n}cos\left(n\omega t\right)+{b}_{n}sin\left(n\omega t\right).$$

For a given spectrum ${a}_{0},{a}_{i},{b}_{i},i=1,2,\cdots $ one can calculate $f\left(t\right)$. For a given function $f\left(t\right)$ all coefficients can be determined and thus the spectrum is known.

How do we now obtain the coefficients ${a}_{n}$ and ${b}_{n}$?

For the Taylor series we had used the fact, that after differentiation all terms, that still contains the distance $x$ to the point of computation, become zero, such that the coefficient of the corresponding constant term gives up to a factor the corresponding derivative a the point of computation.

For the Fourier series we instead begin by integrating the product of the function and the overtones $cos\left(m\omega \phantom{\rule{0em}{0ex}}t\right)\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}or.\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}sin\left(m\omega \phantom{\rule{0em}{0ex}}t\right)\phantom{\rule{0em}{0ex}};\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}m=1,2,3...$ over one period $T$ of the fundamental frequency ($m=1$)

$$\begin{array}{c}\underset{0}{\overset{T}{\int}}cos\left(m\omega t\right)f\left(t\right)dt=\underset{0}{\overset{T}{\int}}cos\left(m\omega t\right)\left(\frac{{a}_{0}}{2}+\sum _{n=1}^{\infty}{a}_{n}cos\left(n\omega t\right)+{b}_{n}sin\left(n\omega t\right)\right)dt\hfill \\ \underset{0}{\overset{T}{\int}}sin\left(m\omega t\right)f\left(t\right)dt=\underset{0}{\overset{T}{\int}}sin\left(m\omega t\right)\left(\frac{{a}_{0}}{2}+\sum _{n=1}^{\infty}{a}_{n}cos\left(n\omega t\right)+{b}_{n}sin\left(n\omega t\right)\right)dt\hfill \\ \hfill \end{array}$$

This looks initially a bit complicated; however it turns out, that the integral over the constant, i.e. the first term before the sum symbol nearly always vanishes, since the integral over a period of cosine or sine is zero. Only for $m=0$ one obtains a contribution, since we have $cos0=1=$ const. Therefore the following applies:

$$\frac{{a}_{0}}{2}=\frac{1}{T}\underset{0}{\overset{T}{\int}}f\left(t\right)dt\phantom{\rule{0em}{0ex}}.$$

In addition the integral over the product of an overtone $m$ and a second overtone $n$ zero, if $m$ and $n$ are not equal. Thus also applies when a cosine and sine function are multiplied, because of the sine functions are odd while the cosine function are even with respect to $x=0$. Therefore we are left only with the integrals ${cos}^{2}nx$ or ${sin}^{2}nx$ which are both $T\u22152$. Thus the coefficients can be easily written down, but this requires the determination of integrals which necessitates numerical calculations.

$${a}_{n}=\frac{2}{T}\int cos\left(n\omega \phantom{\rule{0em}{0ex}}t\right)f\left(t\right)dt;\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}{b}_{n}=\frac{2}{T}\int sin\left(n\omega \phantom{\rule{0em}{0ex}}t\right)f\left(t\right)dt$$

The simulation in Fig.5.15 visualizes these circumstances that simplify the calculation of the Fourier coefficients. From a selection field a product of periodic functions of the general form that we are interested in is chosen:$cos\left(mx\right)\left(acos\left(nx\right)+bsin\left(nx\right)\right)$. The red curve represents the product of in $cosmx$ and the adjustable overtone $acosnx+bsinnx$, in the figure we have $m=10$ and $n=8$. The blue curve shows the integral, whose final value (definite integral over one period of $f\left(t\right)$) vanishes for $m\ne n$. For $m=n$ we obtain when integrating over $acosmxcosmx$ the result $a\pi $, while the integral over the mixed term $bcosmxsinmx$ vanishes. The integration is started via selecting the corresponding option box.

With slides the parameters $a$ and $b$ and the integers $m$ and $n$ can be chosen. The function is drawn in red. After activating the field entitled Integral the blue integral function is calculated over a period of the fundamental oscillation from $0$ to $2\pi $. The final value is the definite integral of interest to us.

As a first step we convince ourselves, that that integrals over sine and cosine vanish and that the addition of sine and cosine functions results in a phase-shifted sine or cosine function, whose integral also vanishes. The calculation of the integral for the product of the function defined above with an overtone of initially unknown order shows, that indeed all contributions vanish except for the one where the overtones are identical and the function type (sine or cosine) is the same. One realizes, that the symmetry of the different functions with respect to the midpoint of the period on the $x$-axis is the reason for this specific result. Thus we have.

$$\underset{0}{\overset{T}{\int}}cos\left(m\omega t\right)dt=0;\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\underset{0}{\overset{T}{\int}}cos\left(m\omega t\right)sin\left(n\omega t\right)dt=0;$$

$$\underset{0}{\overset{T}{\int}}cos\left(m\omega t\right)cos\left(n\omega t\right)dt=\left\{\begin{array}{c}\hfill 0\text{for}m\ne \phantom{\rule{0em}{0ex}}n\hfill \\ \hfill \phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}T\u22152\phantom{\rule{0em}{0ex}}\text{for}m=n\hfill \\ \hfill \hfill \end{array}\right\}\phantom{\rule{0em}{0ex}}$$

This property of the functions sine and cosine means, that they are an example of an orthogonal system of functions. Two functions are called orthogonal if the following applies:

$$\underset{0}{\overset{T}{\int}}{f}_{1}\left(t\right){f}_{2}\left(t\right)dt=0\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\text{for}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}{f}_{1}\left(t\right)\ne \phantom{\rule{0em}{0ex}}{f}_{2}\left(t\right)$$

In the description pages of the simulation more detailed instructions and hints for experiments are provided. After opening the simulation you choose the function type and press the enter key. The integration process is animated in order for you to see the difference between the integrals more easily when changing the functions.

The simulation in Fig.5.16 visualizes the calculation of the Fourier coefficients for the fundamental tone and the first nine overtones for the following typical periodical functions: sawtooth, square wave, square-impulse and Gaussian impulse. To this end the product of the functions under the integral sign is determined and drawn in red while definite integral is shown in blue. The final value of the integral is, except for a factor $\pi $ that was suppressed to get more easily readable values, equal to the coefficient of the selected order. The functions are provided with up to three parameters $a,b$ and $c$ that control the amplitude, the point of symmetry and the impulse width. From the simulation the spectra of the functions shown can be obtained in a numerical and experimental manner.

The interactive figure of the simulation shows the situation for the sine coefficients of tenth order of a symmetrical saw tooth. The simulation is started by choosing a function and clicking on the enter key. The description pages and the instructions for experiments contain further details.

In the next interactive examples (Fig.5.17 to Fig.5.19) the calculation of the coefficients takes place in the background. In the window the function is shown in red and the partial sum of the desired order is shown in blue. The function window is interactive such that many more functions can be entered and a few are suggested in the description. In a text window the order of the analysis can be adjusted; with a slider the approximation order $n$ to be used for the partial sum is selected. The simulation allows using very high orders.

The calculation of the Fourier expansion of $n$-th order follows immediately after entering the function. The diagram extends beyond the integration region of $2\pi $ in order to see the periodic continuation in both directions.

In Fig.5.17 the Fourier expansion of order $43$ is shown as approximation for the symmetrical and periodic square-impulse. For the square wave one recognizes very clearly the typical overshooting at discontinuities, which does not vanish even for very high orders.

In Fig.5.18, using the same simulation, the approximation of 17th order is shown for a saw tooth oscillation, that has been modulated in a nonlinear fashion with a sine function of high frequency .

In a second window of the simulation (Fig.5.19) the spectrum is shown. It can be changed between sine (${a}_{n}$)-, cosine (${b}_{n}$) and power spectrum (${s}_{n}^{2}+{b}_{n}^{2}$). This figure shows the spectrum of the modulated sawtooth, which is rich in overtones and has a pronounced formant at the sixth and seventh overtone. In acoustics formants are defined as limited regions of overtones with large amplitude; they significantly determine the tone quality.

The description of the simulation contains further instructions.

In the space of complex numbers the Fourier series can be formulated in a very elegant way:

$$\begin{array}{c}f\left(t\right)=\sum _{n=-\infty}^{\infty}{c}_{n}{e}^{in\omega t}\hfill \\ {c}_{n}=\frac{1}{T}\underset{0}{\overset{T}{\int}}f\left(t\right){e}^{in\omega t}dt\phantom{\rule{0em}{0ex}}.\hfill \\ \hfill \end{array}$$

The connection to the real representation is obtained via reordering the sum and combining, starting with $n=1$ terms with $-n$ and $n$. Taking into account $cos\left(-x\right)=cos\left(x\right);\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}sin\left(-x\right)=-sin\left(x\right)$ we get

$$\begin{array}{c}f\left(t\right)\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}=\sum _{p=-\infty}^{\infty}{c}_{n}{e}^{in\omega t}=\sum _{p=-\infty}^{\infty}{c}_{n}\left(cosn\omega t+isinn\omega t\right)\hfill \\ \phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}={c}_{0}+\left({c}_{1}+{c}_{-1}\right)cos\omega t+i\left({c}_{1}-{c}_{-1}\right)sin\omega t+...\hfill \\ f\left(t\right)={c}_{0}+\sum _{p=1}^{\infty}\left({c}_{n}+{c}_{-n}\right)\left(cosn\omega t+i\left({c}_{n}-{c}_{-n}\right)sinn\omega t\right)\hfill \\ \hfill \end{array}$$

As connection between real and complex coefficients we obtain

$${a}_{0}=2{c}_{0};\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}{a}_{n}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}={c}_{n}+{c}_{-n};\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}{b}_{n}=i\left({c}_{n}-{c}_{-n}\right)\phantom{\rule{0em}{0ex}}.$$

The complex formulation is especially used in electrical engineering. It has the advantage, that calculations with exponentials are in general easier and more transparent then those with trigonometric function.

For the fast numerical computation of the components of a Fourier series a special algorithm has been developed, which is known as FFT (Fast Fourier Transformation). FFT

In mathematics and physics one often needs to determine the values of a variable, for which a function depending on this variable has certain value $C$. An identical problem

Iteration as far as the computation is concerned is to find the value of the variable at which two functions of one variable have the same value. One solves these problems via looking for the zeros of a function.

$$\begin{array}{c}f\text{wedefine}{y}_{1}=f\left(x\right);\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}{y}_{2}=g\left(x\right)\hfill \\ \text{forwhich}x\text{is}{y}_{1}=C\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}?\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\text{answer:}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}f\left(x\right)-C=0\hfill \\ \text{forwhich}x\text{is}{y}_{1}={y}_{2}?\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\phantom{\rule{0em}{0ex}}\text{answer:}h\left(x\right)\equiv f\left(x\right)-g\left(x\right)=0\hfill \\ \hfill \end{array}$$

An analytical solution for finding zeros of a function can only be found for very simple functions, thus it is an exception. Therefore one needs a numerical method of solution that preferably works for all functions and all parameter values.

This is achieved with iterative methods that present a reversal of the question. One initially takes a value of the variable, that is probably smaller than the estimated first zero in the interval of interest and calculates both the absolute value of the function value and its sign. Then one increases the variable by a given interval (one can of course also start from the right and decrease the variable step by step). Is the new absolute value for the same sign one moves to the next point. If the sign changes one has obviously crossed a zero. Now the direction of the movement is inverted and the step width is multiplied by a factor $<1$. Thus one finds boxes of decreasing size containing the zero until the deviation of the function vale from zero becomes less than a predetermined tolerance. Then one continues with the process in the original direction, until all zeros has been found or until a certain threshold for the value of the variable or of the function itself has been exceeded and thus one is outside the region of interest.

For this iteration process ready made algorithms are available in standard numerical computer codes, that include further refinements. Thus one can, for example, vary the width of the iteration intervals such that the character of the function is taken into account. For example with the Newton method one uses its slope the first derivative to adjust these intervals. Given the speed of today’s computers these refinement do not play matter for simple tasks. The following interactive example in Figure 5.17 determines the zeros of a function that can be entered at will. This function is a preset as a polynomial of fourth degree with irrational roots.

The sequence shows the progression of a very simple iteration algorithm. The speed can be adjusted. The starting point of iteration (magenta) can be dragged with the mouse. The iteration proceeds with a constant step width to larger $x$-values until the sign of the function changes. The initial value is reset to the last value before the sign change and the step width is decreased by a factor of $10$ and the progression to larger $x$-values is resumed. This is repeated until the deviation of the $y$-value from zero falls below a given tolerance. In the simulation one can choose whether it stops after reaching a certain accuracy, or whether all zeros in the variable interval are determined in sequence. In a single calculation the magenta point jumps to the calculated value. while the blue dot shows the first iteration value when determining multiple zeros.

To be able to follow the progressive iteration also for high accuracy already achieved well, a section of the window is shown in detail in a magnifying glass, and the scale adjusts to the increasing accuracy.

From the zoom window of Fig.5.20 you can see that the curve is always nearly linear close the root of the curve. The Regula Falsi uses as the next iteration value for $x$ the intersection of the secant formed from the two previous iteration points with the $x$-axis. It therefore leads quickly to the final solution. We have however chosen the constant step width so that the process can be observed more easily.

Further details and hints for experiments can be found on the description pages of the simulation.

End of chapter 5