User:EGM4313.f14.Team1.Linehan/Report 5

=Report 5=

Problem Statement
find the projections (approximations) of each the functions below, defined on the

following two intervals, onto the polynomial basis


 * {| style="width:100%" border="0"

$$ \{ 1, x, x^2, ...., x^n \}$$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

for each of the functions below, plot the exact function and its approximations.

for integration by parts, you may want to consult sec.9d, and then use Wolfram Alpha

or Wolfram integrator to verify your results. for example, here is the exact integration

of x^2 log(1+x).

for numerical integration, you may want to use both GNU Octave / matlab commands trapz

and quad to verify your results; see also the online GNU Octave (type “help trapz”

without quotes, then click “Execute script” or type the shortcut “Ctrl+E” without

quotes). you can also use Wolfram integrator to verify your results when possible.

1. exponential function :. use integration by parts, and verify your results with

Wolfram integrator; provide links to your Wolfram integrator results.


 * {| style="width:100%" border="0"

$$ e^x = \exp(x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

2. same as in Question 1, but the natural logarithm function : log(1+x). try to integrate with

integration by parts first, and and point out the difficulty in your report. when you come to a

deadend with integration by parts, use numerical integration with with both GNU Octave / matlab

commands trapz and quad to verify, and verify again with Wolfram integrator, as mentioned above.

[“log” without a specified base is by default the natural log, also written as “ln”.]

Intervals:

1. interval [0, 2], i.e., a = 0, b = 2 ; plot the exact function and its approximations for

n = 2,4,6 in this interval;

2. interval [-1/2, 2], i.e., a = -1/2, b = 2 ; plot the exact function and its approximations

for n = 2,4,6 on this interval;

3. for each value of n, plot the exact function, its approximation from Question 1, its

approximation from Question 2;

comment on the similarities and differences, e.g., what is the quality of the two approximations

when you restrict yourself to the interval [-1/2, 2] (one approximation coming from Question 1, and

one approximation coming from Question 2). repeat the same for the next value of n.

R4.4
Here is the correct redo of R4.4 for the function:


 * {| style="width:100%" border="0"

$$ f(x)=log(1+x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Following the same steps as the preceding problems, we know that it is necessary to develop the vector, d. We will start by applying the same method of integration by parts.


 * {| style="width:100%" border="0"

$$ \int u dv=uv-\int v du $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For the first integral, we will use u= log(1+x) and dv=1
 * {| style="width:100%" border="0"

$$ \langle x^0,\log(1+x) \rangle = \langle 1,\log(1+x) \rangle = \int_0^1 \log(1+x) dx = x\log(x)-\int_0^1 \frac{x}{1+x} dx $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

In order to solve the integral, we need to make a "U-substitution". We will use u=(1+x) and du=dx:
 * {| style="width:100%" border="0"

$$ x\log(x)-\int_0^1 \frac{x}{1+x} dx= x\log(x)-\int_0^1 \frac{u-1}{u} dx = x\log(x)-\int_0^1 1-\frac{1}{u} dx=x\log(x)-u+\log(u) $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Substituting back in and simplifying:
 * {| style="width:100%" border="0"

$$ x\log(x)-u+\log(u) = x\log(x)-(1+x)+\log(1+x)= (1+x)(\log(x)-1)|_0^1= 2\log(2) \approx 0.38629 $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

http://integrals.wolfram.com/index.jsp?expr=log%281%2Bx%29&random=false

We apply the same integration process for the d_1 except that it quickly gets very complicated:
 * {| style="width:100%" border="0"

$$ \langle x,\log(1+x) \rangle=\int_0^1 x^1 \log(1+x) dx= \frac{x^2\log(1+x)}{2}-\frac{1}{2}\int\frac{x^2}{1+x}dx $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Instead of performing the unnecessary algebra to solve the remaining integrals, we will use the Matlab functions trapz and quad as well as Wolfram:


 * {| style="width:100%" border="0"

$$ \langle x,\log(1+x) \rangle=\int_0^1 x^1 \log(1+x) dx= \frac{1}{4}(2(x^2-1)\log(1 + x)-x(x-2)) = \frac{1}{4} \approx 0.25 $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

http://integrals.wolfram.com/index.jsp?expr=x*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^2,\log(1+x) \rangle=\int_0^1 x^2 \log(1+x) dx= \frac{1}{18}(x(-6 + (3 - 2x)x) + 6(1 + x^3)\log(1 + x))= \frac{2}{3}log(2)-\frac{5}{18}\approx 0.18432 $$     (5)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E2*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^3,\log(1+x) \rangle=\int_0^1 x^3 \log(1+x) dx= \frac{x}{4} - \frac{x^2}{8} + \frac{x^3}{12} -\frac{x^4}{16} - \frac{\log(1 + x)}{4} + \frac{x^4\log(1 + x)}{4}=\frac{7}{48}\approx 0.14583 $$     (6)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E3*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^4,\log(1+x) \rangle=\int_0^1 x^4 \log(1+x) dx= \frac{-x}{5} + \frac{x^2}{10} - \frac{x^3}{15} + \frac{x^4}{20} - \frac{x^5}{25} + \frac{\log(1 + x)}{5} + \frac{1}{5}x^5\log(1 + x) \approx 0.12059 $$     (7)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E4*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^5,\log(1+x) \rangle=\int_0^1 x^5 \log(1+x) dx= \frac{x}{6} - \frac{x^2}{12} + \frac{x^3}{18} - \frac{x^4}{24} + \frac{x^5}{30} - \frac{x^6}{36} - \frac{1}{6}\log(1 + x) + \frac{1}{6}x^6\log(1 + x) \approx 0.10278 $$     (8)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E5*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^6,\log(1+x) \rangle=\int_0^1 x^6 \log(1+x) dx= \frac{-x}{7} + \frac{x^2}{14} - \frac{x^3}{21} +\frac{x^4}{28} - \frac{x^5}{35} + \frac{x^6}{42} - \frac{x^7}{49} + \frac{1}{7}\log(1 + x) + \frac{1}{7}x^7\log(1 + x) \approx 0.089539 $$     (9)
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E6*log%281%2Bx%29&random=false

n=2
The basis is


 * {| style="width:100%" border="0"

$$ \{ 1, x, x^2 \} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

so the function f(x) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx c_0b_0+c_1b_1+c_2b_2=c_0+c_1x+c_2x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Now, determine the known computable right hand side (using the values determined from the quad function in Matlab):
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} \langle x^0,\log(1+x) \rangle \\ \langle x^1,\log(1+x)\rangle\\ \langle x^2,\log(1+x) \rangle \end{bmatrix} = \begin{bmatrix} 0.3863\\0.2500\\0.1843\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using the Hilbert matrix of order 3 calculated prior, we can plug into the equation (1) and solve for c:


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma \mathbf c = \mathbf d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c =  \begin{bmatrix} 0.0057\\   0.9192\\   -0.2370\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Therefore, the function can be approximated by:
 * {| style="width:100%" border="0"

$$ \log(1+x) \approx 0.0057 + 0.9192x - 0.2370x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }



n=4
The basis is


 * {| style="width:100%" border="0"

$$ \{ 1, x, x^2,x^3, x^4 \} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

so the function f(x) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx c_0b_0+c_1b_1+c_2b_2+c_3b_3+c_4b_4=c_0+c_1x+c_2x^2+c_3x^3+c_4x^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Now, determine the known computable right hand side (using the values determined from the quad function in Matlab):
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} \langle x^0,\log(1+x) \rangle \\ \langle x^1,\log(1+x)\rangle\\ \langle x^2,\log(1+x) \rangle \\ \langle x^3,\log(1+x)\rangle \\ \langle x^4,\log(1+x)\rangle \end{bmatrix} = \begin{bmatrix} 0.3863\\ 0.2500\\   0.1843\\    0.1458\\    0.1206 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using the Hilbert matrix of order 5 calculated prior, we can plug into the equation (1) and solve for c:


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma \mathbf c = \mathbf d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c = \begin{bmatrix} -0.0179\\1.3181\\1.8119\\2.2059\\-1.011\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Therefore, the function can be approximated as:
 * {| style="width:100%" border="0"

$$ \log(1+x) \approx -0.0179+1.3181x-1.8119x^2+2.2059x^3-1.011x^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }



n=6
The basis is


 * {| style="width:100%" border="0"

$$ \{ 1, x, x^2,x^3, x^4, x^5, x^6 \} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

so the function f(x) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx c_0b_0+c_1b_1+c_2b_2+c_3b_3+c_4b_4+c_5b_5+c_6b_6=c_0+c_1x+c_2x^2+c_3x^3+c_4x^4+c_5x^5+c_6x^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Now, determine the known computable right hand side (using the values determined from the quad function in Matlab):
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} \langle x^0,\log(1+x) \rangle \\ \langle x^1,\log(1+x)\rangle\\ \langle x^2,\log(1+x) \rangle \\ \langle x^3,\log(1+x)\rangle \\ \langle x^4,\log(1+x)\rangle \\ \langle x^5,\log(1+x)\rangle \\ \langle x^6,\log(1+x)\rangle\end{bmatrix} = \begin{bmatrix} 0.386294334336416\\ 0.250000034521966\\  0.184320336460938\\   0.145833342164217\\   0.120592191814104\\   0.102777809230323\\   0.089538700573044 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using the Hilbert matrix of order 7 calculated prior, we can plug into the equation (1) and solve for c:


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma \mathbf c = \mathbf d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c = \begin{bmatrix}      -0.001634682661461\\ 1.064527996641118\\ -1.116675421362743\\   2.712370300665498\\  -4.568075499963015\\   3.854147227481008\\  -1.252616312238388 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Therefore, the function can be approximated as:
 * {| style="width:100%" border="0"

$$ \log(1+x) \approx -0.00163+1.06453x-1.11668x^2+2.71237x^3-4.56808x^4+3.85414x^5-1.25261x^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }



As you can see, the approximation follows the graph of the exact function very closely and thus, it is a good approximation. The solution achieved in R4.4 did not show this relationship due to rounding errors. This time, long decimals were kept in matlab in order to achieve a better approximation.

General Method
In R4.4, a general method was used to develop approximations for different functions on the polynomial basis. In general, there are two important pieces of information necessary to solve for the approximation: 1) the Gram matrix (or in our special case, the Hilbert matrix) and 2) the matrix d


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} \langle b_1, b_1 \rangle & ... & \langle b_1, b_n \rangle \\

\vdots & \vdots & \vdots \\ \langle b_n, b_1 \rangle & ... & \langle b_n, b_n \rangle \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf d = \lfloor \langle b_1, f \rangle , ... , \langle b_n, f \rangle \rfloor^T = \lfloor d_1 , ..., d_n \rfloor^T $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using this relationship:


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma \mathbf c = \mathbf d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \Gamma \ne 0 \Rightarrow \boldsymbol \Gamma^{-1} \text{ exists} \Rightarrow \mathbf c = \boldsymbol \Gamma^{-1} \mathbf d $$ We can solve for the unknown coefficients, matrix c:
 * style="width:95%" |
 * style="width:95%" |
 *  (1)
 * }
 * {| style="width:100%" border="0"

$$ \mathbf c = \lfloor c_1, ... , c_n \rfloor^T $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

In order to use the Hilbert matrix, we will have to perform a change of variable.

For the interval [0,2], we will use the change:


 * {| style="width:100%" border="0"

$$ \bar x = x / 2 \Rightarrow x = 2 \bar x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

And the interval is now [0,1] since,

the upper bound becomes:
 * {| style="width:100%" border="0"

$$ \bar x = \frac{2}{2} = 1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and the lower bound becomes:
 * {| style="width:100%" border="0"

$$ \bar x = \frac{0}{2} = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Thus, the new functions are
 * {| style="width:100%" border="0"

$$ f(\bar x) = e^{2 \bar x} \text{ with } \bar x \text{ in } [0,1] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and


 * {| style="width:100%" border="0"

$$ f(\bar x) = \log(1+ \bar x) \text{ with } \bar x \text{ in } [0,1] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For the interval [-1/2, 2], we will use the change:


 * {| style="width:100%" border="0"

$$ \bar x = \frac{2x+1}{5} \Rightarrow x = \frac{5 \bar x -1}{2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

And the interval is now [0,1] since,

the upper bound becomes:
 * {| style="width:100%" border="0"

$$ \bar x = \frac{2(2)+1}{5} = 1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and the lower bound becomes:
 * {| style="width:100%" border="0"

$$ \bar x = \frac{2(-1/2)+1}{5} = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Thus, the new functions are
 * {| style="width:100%" border="0"

$$ f(\bar x) = e^{\frac{5 \bar x -1}{2}} \text{ with } \bar x \text{ in } [0,1] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and


 * {| style="width:100%" border="0"

$$ f(\bar x) = \log(1+ \frac{5 \bar x -1}{2}) \text{ with } \bar x \text{ in } [0,1] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

These functions can be approximated on the x bar space as:
 * {| style="width:100%" border="0"

$$ p(\bar x) = \sum_{i=0}^{n} \bar c_i \bar x^i = f(\bar x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The ‘’’d bar’’’ matrix can be written as
 * {| style="width:100%" border="0"

$$ \langle \bar x^j, \sum_{i=0}^{n} \bar c_i \bar x^i \rangle = \langle \bar x^j , f(\bar x) \rangle , \text{ for } j=1,...,n $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \langle \bar x^j, f(\bar x) \rangle = \int_{\bar x = 0}^{\bar x = 1} \bar x^j f(\bar x) d \bar x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will solve the entire problem in the x bar space and then change back to the x space after determining the c bar matrix with Equation (1).

Exponential Function

 * {| style="width:100%" border="0"

$$ f(x)=e^x $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

n=2
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=2

Therefore, we can use the Matlab function: hilb(3) to determine the Hilbert matrix of order 3.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix d bar, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf \bar d = \begin{bmatrix} \langle \bar x^0,e^{2 \bar x} \rangle \\ \langle \bar x^1, e^{2 \bar x} \rangle\\ \langle \bar x^2, e^{2 \bar x} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} e^{2 \bar x} dx \\ \int_{0}^{1} \bar x e^{2 \bar x} dx  \\ \int_{0}^{1} \bar x^2 e^{2 \bar x}  dx  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix.


 * {| style="width:100%" border="0"

$$ \bar d_0 =\langle \bar x^0,e^{2 \bar x} \rangle= \int_{0}^{1} e^{2 \bar x} dx = \frac{1}{2}e^{2 \bar x}|_{0}^{1} = \frac{1}{2}(e^2-1) = 3.1945 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=e%5E%282x%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_1 = \langle \bar x^1, e^{2 \bar x} \rangle=\int_{0}^{1} \bar x e^{2 \bar x}  dx = e^{2 \bar x}(\frac{x}{2}-\frac{1}{4})|_{0}^{1} = \frac{1}{4}(e^2+1) = 2.0973 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=xe%5E%282x%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_2 =\langle \bar x^2,e^{2 \bar x} \rangle= \int_{0}^{1} \bar x^2e^{2 \bar x} dx = \frac{1}{4}e^{2 \bar x}(2 \bar x^2-2 \bar x+1)|_{0}^{1} = \frac{1}{4}(e^2-1)= 1.5973 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E2e%5E%282x%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 3.1945 \\ 2.0973 \\ 1.5973 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...
 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} \begin{bmatrix} 3.1945 \\ 2.0973 \\ 1.5973 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf \bar c \approx \begin{bmatrix}   1.167168296791942\\ 0.164158516040231\\  5.835841483959769\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx 1.1672 + 0.1642 \bar x + 5.8358 \bar x^2 \approx 1.1672 + 0.1642 (\frac{x}{2}) + 5.8358 (\frac{x}{2})^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [0,2]:



n=4
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2 + \bar c_3 \bar x^3 + \bar c_4 \bar x^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * 
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=4

Therefore, we can use the Matlab function: hilb(5) to determine the Hilbert matrix of order 5.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6}\\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} \\ \frac{1}{4} & \frac{1}{5} & \frac{1}{5} & \frac{1}{7} & \frac{1}{8} \\ \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = 10^5 \begin{bmatrix} 0.0002 & -0.0030 &   0.0105  & -0.0140 &   0.0063\\ -0.0030 &  0.0480  & -0.1890 &   0.2688  & -0.1260\\    0.0105  & -0.1890  &  0.7938  & -1.1760  &  0.5670\\   -0.0140 &   0.2688  & -1.1760  &  1.7920 &  -0.8820\\    0.0063  & -0.1260  &  0.5670  & -0.8820  &  0.4410 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix d bar, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf \bar d = \begin{bmatrix} \langle \bar x^0,e^{2 \bar x} \rangle \\ \langle \bar x^1, e^{2 \bar x} \rangle\\ \langle \bar x^2, e^{2 \bar x} \rangle \\ \langle \bar x^3, e^{2 \bar x} \rangle \\ \langle \bar x^4, e^{2 \bar x} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} e^{2 \bar x} dx \\ \int_{0}^{1} \bar x e^{2 \bar x} dx  \\ \int_{0}^{1} \bar x^2 e^{2 \bar x}  dx \\ \int_{0}^{1} \bar x^3 e^{2 \bar x}  dx \\ \int_{0}^{1} \bar x^4 e^{2 \bar x}  dx  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix.


 * {| style="width:100%" border="0"

$$ \bar d_3 =\langle \bar x^3,e^{2 \bar x} \rangle= \int_{0}^{1} \bar x^3 e^{2 \bar x} dx = \frac{1}{8} e^{2 \bar x} (2 \bar x( \bar x(2 \bar x - 3)+3)-3) = \frac{1}{8}(e^2+3) =1.2986 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E3e%5E%282x%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_4 = \langle \bar x^4, e^{2 \bar x} \rangle=\int_{0}^{1} \bar x^4 e^{2 \bar x}  dx = \frac{1}{4} e^{2 \bar x} (2 \bar x( \bar x (( \bar x - 2) \bar x +3)-3)+3) = \frac{1}{4}(e^2-3) = 1.0973 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E4e%5E%282x%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 3.1945 \\ 2.0973 \\ 1.5973\\ 1.2986\\1.0973 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...


 * {| style="width:100%" border="0"

$$ \mathbf c \approx \begin{bmatrix} 1.002738054836072\\  1.920617205296367\\   2.528215831451234\\   0.038041627107305\\   1.896161873584788\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx 1.0027 + 1.9206 \bar x + 2.5282 \bar x^2 + 0.0380 \bar x^3 + 1.8962 \bar x^4 \approx 1.0027 + 1.9206 (\frac{x}{2}) + 2.5282 (\frac{x}{2})^2 + 0.0380 (\frac{x}{2})^3 + 1.8962 (\frac{x}{2})^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [0,2]:



n=6
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2 + \bar c_3 \bar x^3 + \bar c_4 \bar x^4 + \bar c_5 \bar x^5 + \bar c_6 \bar x^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=6

Therefore, we can use the Matlab function: hilb(7) to determine the Hilbert matrix of order 7.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} &\frac{1}{6} &\frac{1}{7}\\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} &\frac{1}{7} &\frac{1}{8}\\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} &\frac{1}{8} &\frac{1}{9} \\ \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} &\frac{1}{9} &\frac{1}{10}\\ \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9} &\frac{1}{10} &\frac{1}{11} \\ \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9} & \frac{1}{10} &\frac{1}{11} &\frac{1}{12} \\ \frac{1}{7} & \frac{1}{8} & \frac{1}{9} & \frac{1}{10} & \frac{1}{11} &\frac{1}{12} &\frac{1}{13}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = 10^8 \begin{bmatrix} 0.0000 & -0.0000 &   0.0001 &  -0.0003 &   0.0005 &  -0.0004  &  0.0001\\   -0.0000   & 0.0004  & -0.0032   & 0.0113  & -0.0194   & 0.0160  & -0.0050\\    0.0001  & -0.0032    &0.0286  & -0.1058   & 0.1871  & -0.1572   & 0.0505\\   -0.0003  &  0.0113  & -0.1058   & 0.4032  & -0.7277   & 0.6209  & -0.2018\\    0.0005   &-0.0194   & 0.1871   &-0.7277   & 1.3340   &-1.1526    &0.3784\\   -0.0004   & 0.0160   &-0.1572  &  0.6209  & -1.1526  &  1.0059  & -0.3330\\    0.0001   &-0.0050    &0.0505 &  -0.2018   & 0.3784 &  -0.3330   & 0.1110\\ \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix d bar, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf \bar d = \begin{bmatrix} \langle \bar x^0,e^{2 \bar x} \rangle \\ \langle \bar x^1, e^{2 \bar x} \rangle\\ \langle \bar x^2, e^{2 \bar x} \rangle \\ \langle \bar x^3, e^{2 \bar x} \rangle \\ \langle \bar x^4, e^{2 \bar x} \rangle \\ \langle \bar x^5, e^{2 \bar x} \rangle \\ \langle \bar x^6, e^{2 \bar x} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} e^{2 \bar x} dx \\ \int_{0}^{1} \bar x e^{2 \bar x} dx  \\ \int_{0}^{1} \bar x^2 e^{2 \bar x}  dx \\ \int_{0}^{1} \bar x^3 e^{2 \bar x}  dx \\ \int_{0}^{1} \bar x^4 e^{2 \bar x}  dx \\ \int_{0}^{1} \bar x^5 e^{2 \bar x}  dx \\ \int_{0}^{1} \bar x^6 e^{2 \bar x}  dx \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix.


 * {| style="width:100%" border="0"

$$ \bar d_5 =\langle \bar x^5,e^{2 \bar x} \rangle= \int_{0}^{1} \bar x^5 e^{2 \bar x} dx = \frac{1}{8} e^{2 \bar x}(4 \bar x^5 -10 \bar x^4 +20 \bar x^3 -30 \bar x^2 +30 \bar x -15) =\frac{1}{8}(15-e^2) = 0.95137 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E5e%5E%282x%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_6 = \langle \bar x^6, e^{2 \bar x} \rangle=\int_{0}^{1} \bar x^6 e^{2 \bar x}  dx = \frac{1}{8}e^{2 \bar x}(4 \bar x^6 -12 \bar x^5 +30 \bar x^4 -60 \bar x^3 + 90 \bar x^2 -90 \bar x +45) = \frac{1}{8}(7e^2-45) = 0.84042 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E4e%5E%282x%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 3.1945 \\ 2.0973 \\ 1.5973 \\ 1.2986 \\ 1.0973 \\ 0.9514 \\ 0.8404 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...


 * {| style="width:100%" border="0"

$$ \mathbf c \approx \begin{bmatrix} 1.000019415463612\\  1.998932265676558\\   2.014073853380978\\   1.257693745195866\\   0.864687852561474\\   0.003828089684248\\   0.249798702076077 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx 1.0000 + 1.9989 \bar x + 2.0141 \bar x^2 + 1.2577 \bar x^3 + 0.8647 \bar x^4 + 0.0038 \bar x^5 + 0.2498 \bar x^6 \approx 1.0000 + 1.9989 (\frac{x}{2}) + 2.0141 (\frac{x}{2})^2 + 1.2577 (\frac{x}{2})^3 + 0.8647 (\frac{x}{2})^4 + 0.0038 (\frac{x}{2})^5 + 0.2498 (\frac{x}{2})^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [0,2]:



n=2
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=2

Therefore, we can use the Matlab function: hilb(3) to determine the Hilbert matrix of order 3.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix ‘’’d bar’’’, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} \langle \bar x^0,e^{\frac{5 \bar x -1}{2}} \rangle \\ \langle \bar x^1, e^{\frac{5 \bar x -1}{2}} \rangle\\ \langle \bar x^2, e^{\frac{5 \bar x -1}{2}} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} e^{\frac{5 \bar x -1}{2}} dx \\ \int_{0}^{1} \bar x e^{\frac{5 \bar x -1}{2}} dx  \\ \int_{0}^{1} \bar x^2 e^{\frac{5 \bar x -1}{2}} dx  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix, d.


 * {| style="width:100%" border="0"

$$ \bar d_0 =\langle \bar x^0, e^{\frac{5 \bar x -1}{2}} \rangle= \int_{0}^{1} e^{\frac{5 \bar x -1}{2}} dx = \frac{2}{5} e^{\frac{5 \bar x -1}{2}} |_{0}^{1} = \frac{2}{5}(e^2-e^{\frac{-1}{2}}) = 2.7130 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E0e%5E%28%285x-1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_1 = \langle \bar x^1, e^{\frac{5 \bar x -1}{2}} \rangle=\int_{0}^{1} \bar x e^{\frac{5 \bar x -1}{2}} dx = \frac{2}{25} e^{\frac{5 \bar x -1}{2}}(5 \bar x -2)|_{0}^{1} = \frac{2(2+3e^{\frac{5}{2}})}{25e^{\frac{-1}{2}}} = 1.8704 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E1e%5E%28%285x-1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_2 = \langle \bar x^2, e^{\frac{5 \bar x -1}{2}} \rangle = \int_{0}^{1} \bar x^2 e^{\frac{5 \bar x -1}{2}}  dx = \frac{2}{125} e^{\frac{5 \bar x -1}{2}} (25 \bar x^2- 20 \bar x+8)|_{0}^{1} = \frac{2(13e^{\frac{5}{2}}-8)}{125e^{\frac{-1}{2}}} = 1.4593 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E2e%5E%28%285x-1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 2.7130\\ 1.8704 \\ 1.4593 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...
 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} \begin{bmatrix} 2.7130\\ 1.8704 \\ 1.4593 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf \bar c \approx \begin{bmatrix}      0.860662610510019\\ -1.219833363827490\\  7.386792741272757\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx 0.8607 - 1.2198 \bar x + 7.3868 \bar x^2 = 0.8607-1.2198(\frac{2x+1}{5}) + 7.3868 (\frac{2x+1}{5})^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [-1/2,2]:



n=4
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2+ \bar c_3 \bar x^3+\bar c_4 \bar x^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=4

Therefore, we can use the Matlab function: hilb(5) to determine the Hilbert matrix of order 5.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6}\\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} \\ \frac{1}{4} & \frac{1}{5} & \frac{1}{5} & \frac{1}{7} & \frac{1}{8} \\ \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = 10^5 \begin{bmatrix} 0.0002 & -0.0030 &   0.0105  & -0.0140 &   0.0063\\ -0.0030 &  0.0480  & -0.1890 &   0.2688  & -0.1260\\    0.0105  & -0.1890  &  0.7938  & -1.1760  &  0.5670\\   -0.0140 &   0.2688  & -1.1760  &  1.7920 &  -0.8820\\    0.0063  & -0.1260  &  0.5670  & -0.8820  &  0.4410 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix ‘’’d bar’’’, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf \bar d = \begin{bmatrix} \langle \bar x^0, e^{\frac{5 \bar x -1}{2}}\rangle \\ \langle \bar x^1, e^{\frac{5 \bar x -1}{2}}\rangle\\ \langle \bar x^2, e^{\frac{5 \bar x -1}{2}}\rangle \\ \langle \bar x^3, e^{\frac{5 \bar x -1}{2}}\rangle \\ \langle \bar x^4, e^{\frac{5 \bar x -1}{2}} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} e^{\frac{5 \bar x -1}{2}} dx \\ \int_{0}^{1} \bar x e^{\frac{5 \bar x -1}{2}}  dx  \\ \int_{0}^{1} \bar x^2 e^{\frac{5 \bar x -1}{2}}dx  \\ \int_{0}^{1} \bar x^3 e^{\frac{5 \bar x -1}{2}}dx  \\ \int_{0}^{1} \bar x^4 e^{\frac{5 \bar x -1}{2}}dx \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix, d.


 * {| style="width:100%" border="0"

$$ \bar d_3 =\langle \bar x^3, e^{\frac{5 \bar x -1}{2}} \rangle= \int_{0}^{1} \bar x^3 e^{\frac{5 \bar x -1}{2}}  dx = \frac{2}{625} e^{\frac{5 \bar x -1}{2}} (125 \bar x^3- 150 \bar x^2 + 120 \bar x -48)|_{0}^{1} = \frac{2(47e^{\frac{5}{2}}+48)}{625e^{\frac{-1}{2}}} = 1.2045 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E3e%5E%28%285x-1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_4 =\langle \bar x^4, e^{\frac{5 \bar x -1}{2}} \rangle = \int_{0}^{1} \bar x^4 e^{\frac{5 \bar x -1}{2}} dx = \frac{2}{3125} e^{\frac{5 \bar x -1}{2}} (625 \bar x^4 -1000 \bar x^3+ 1200 \bar x^2 +- 960 \bar x +384)|_{0}^{1} = \frac{6(83e^{\frac{5}{2}}-128)}{3125e^{\frac{-1}{2}}} = 1.0285 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E4e%5E%28%285x-1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 2.7130\\ 1.8704 \\ 1.4593\\  1.2045\\ 1.0285 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...


 * {| style="width:100%" border="0"

$$ \mathbf \bar c \approx \begin{bmatrix}         0.613042835198712\\ 1.328993754259500\\  3.127775873843348\\  -1.386757277257857\\   3.697839123618905\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx 0.6130 + 1.3290 \bar x + 3.1278 \bar x^2 - 1.3868 \bar x^3 + 3.6978 \bar x^4 = 0.6130 + 1.3290(\frac{2x+1}{5}) + 3.1278 (\frac{2x+1}{5})^2 - 1.3868 (\frac{2x+1}{5})^3 + 3.6978 (\frac{2x+1}{5})^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [-1/2,2]:



n=6
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2+ \bar c_3 \bar x^3+\bar c_4 \bar x^4+ \bar c_5 \bar x^5+ \bar c_6 \bar x^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=6

Therefore, we can use the Matlab function: hilb(7) to determine the Hilbert matrix of order 7.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} &\frac{1}{6} &\frac{1}{7}\\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} &\frac{1}{7} &\frac{1}{8}\\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} &\frac{1}{8} &\frac{1}{9} \\ \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} &\frac{1}{9} &\frac{1}{10}\\ \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9} &\frac{1}{10} &\frac{1}{11} \\ \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9} & \frac{1}{10} &\frac{1}{11} &\frac{1}{12} \\ \frac{1}{7} & \frac{1}{8} & \frac{1}{9} & \frac{1}{10} & \frac{1}{11} &\frac{1}{12} &\frac{1}{13}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = 10^8 \begin{bmatrix} 0.0000 & -0.0000 &   0.0001 &  -0.0003 &   0.0005 &  -0.0004  &  0.0001\\   -0.0000   & 0.0004  & -0.0032   & 0.0113  & -0.0194   & 0.0160  & -0.0050\\    0.0001  & -0.0032    &0.0286  & -0.1058   & 0.1871  & -0.1572   & 0.0505\\   -0.0003  &  0.0113  & -0.1058   & 0.4032  & -0.7277   & 0.6209  & -0.2018\\    0.0005   &-0.0194   & 0.1871   &-0.7277   & 1.3340   &-1.1526    &0.3784\\   -0.0004   & 0.0160   &-0.1572  &  0.6209  & -1.1526  &  1.0059  & -0.3330\\    0.0001   &-0.0050    &0.0505 &  -0.2018   & 0.3784 &  -0.3330   & 0.1110\\ \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix ‘’’d bar’’’, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} \langle \bar x^0,e^{2 \bar x} \rangle \\ \langle \bar x^1, e^{2 \bar x} \rangle\\ \langle \bar x^2, e^{2 \bar x} \rangle \\ \langle \bar x^3, e^{2 \bar x} \rangle \\ \langle \bar x^4, e^{2 \bar x} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} e^{2 \bar x} dx \\ \int_{0}^{1} \bar x e^{2 \bar x}  dx  \\ \int_{0}^{1} \bar x^2 e^{2 \bar x}  dx  \\ \int_{0}^{1} \bar x^3 e^{2 \bar x}  dx  \\ \int_{0}^{1} \bar x^4 e^{2 \bar x}  dx \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix, d.


 * {| style="width:100%" border="0"

$$ \bar d_5 =\langle \bar x^5, e^{\frac{5 \bar x -1}{2}} \rangle= \int_{0}^{1} \bar x^5 e^{\frac{5 \bar x -1}{2}}  dx = \frac{2}{3125} e^{\frac{5 \bar x -1}{2}} (625 \bar x^5 - 1250 \bar x^4 + 2000 \bar x^3 - 2400 \bar x^2 + 1920 \bar x -768)|_{0}^{1} = \frac{2(127e^{\frac{5}{2}}+768)}{3125e^{\frac{-1}{2}}} = 0.89870 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E5e%5E%28%285x-1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_6 =\langle \bar x^6, e^{\frac{5 \bar x -1}{2}} \rangle = \int_{0}^{1} \bar x^6 e^{\frac{5 \bar x -1}{2}} dx = \frac{2}{15625} e^{\frac{5 \bar x -1}{2}} (3125 \bar x^6 -7500 \bar x^5 + 15000 \bar x^4 -24000 \bar x^3+ 28800 \bar x^2 - 23040 \bar x + 9216)|_{0}^{1} = \frac{2(1601e^{\frac{5}{2}}-9216)}{15625e^{\frac{-1}{2}}} = 0.79873 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E6e%5E%28%285x-1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 2.7130\\ 1.8704 \\ 1.4593\\  1.2045\\ 1.0285 \\ 0.89879 \\ 0.79873 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...


 * {| style="width:100%" border="0"

$$ \mathbf \bar c \approx \begin{bmatrix}           0.606602825229857\\ 1.512374598532915\\  1.947214459534734\\   1.303164174780250\\   1.702722638845444\\  -0.439207635819912\\   0.756099797785282\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx 0.6066 + 1.5123 \bar x + 1.9472 \bar x^2 + 1.3032 \bar x^3 + 1.7027 \bar x^4 - 0.4392 \bar x^5 + 0.7561 \bar x^6 = 0.6066 + 1.5123(\frac{2x+1}{5}) + 1.9472 (\frac{2x+1}{5})^2 + 1.3032 (\frac{2x+1}{5})^3 + 1.7027 (\frac{2x+1}{5})^4 - 0.4392 (\frac{2x+1}{5})^5 + 0.7561 (\frac{2x+1}{5})^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [-1/2,2]:



Plots
n=2



Here, we can see that the approximations are most accurate on the interval that they were approximated on. Both the red and blue lines follow the exact curve fairly closely, but the red line becomes less accurate between the values of -0.5 and 0. This is because the red line was an approximation done on the interval [0,2]. Therefore, this curve does not approximate the function well outside of this interval.

n=4



Here, you can see almost no difference between the two curves even though the approximations were done over different intervals. Higher orders make the approximations more and more accurate. Thus, there is almost no difference between the two approximations.

n=6



Again, you can see almost no difference between the two curves even though the approximations were done over different intervals. They both seem to follow the exact curve exactly. Higher orders make the approximations more and more accurate. Thus, there is almost no difference between the two approximations.

Logarithmic Function

 * {| style="width:100%" border="0"

$$ f(x)=\log{(1+x)} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

n=2
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=2

Therefore, we can use the Matlab function: hilb(3) to determine the Hilbert matrix of order 3.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix d bar, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf \bar d = \begin{bmatrix} \langle \bar x^0,\log{\left(2 \bar x+1\right)} \rangle \\ \langle \bar x^1, \log{\left(2 \bar x+1\right)} \rangle\\ \langle \bar x^2, \log{\left(2 \bar x+1\right)} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} \log{\left(2 \bar x+1\right)} d\bar x \\ \int_{0}^{1} \bar x \log{\left(2 \bar x+1\right)} d\bar x  \\ \int_{0}^{1} \bar x^2 \log{\left(2 \bar x+1\right)}  d\bar x  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix.


 * {| style="width:100%" border="0"

$$ \bar d_0 =\langle \bar x^0,\log{\left(2 \bar x+1\right)} \rangle= \int_{0}^{1} \log{\left(2 \bar x+1\right)} d\bar x = \frac{1}{2}\left(2\bar x+1\right)\left(\log{\left(2\bar x+1\right)}-1\right) |_0^1 = \frac{3\log{3}}{2}-1 = 0.6479 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=log%282x%2B1%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_1 = \langle \bar x^1, \log{\left(2 \bar x+1\right)} \rangle=\int_{0}^{1} \bar x \log{\left(2 \bar x+1\right)}  d\bar x = \frac{1}{16}\left(2\bar x+1\right)\left(-2\bar x+\left(4\bar x-2\right)\log{\left(2\bar x+1\right)}+3\right) = \frac{3\log{3}}{8} = 0.4120 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x*log%282x%2B1%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_2 =\langle \bar x^2,\log{\left(2 \bar x+1\right)} \rangle= int_{0}^{1} \bar x^2\log{\left(2 \bar x+1\right)} d\bar x = \frac{1}{72}\left(3\left(8\bar x^3+1\right)\log{\left(2\bar x+1\right)}-2\bar x\left(\bar x\left(4\bar x-3\right)+3\right)\right) |_{0}^{1} = \frac{e\log{3}}{8}-\frac{1}{9} = 0.3009 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E2*log%282x%2B1%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 0.6479 \\ 0.4120 \\ 0.3009 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...
 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} \begin{bmatrix} 0.6479 \\ 0.4120 \\ 0.3009 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf \bar c \approx \begin{bmatrix} 0.026054914182897\\  1.618691710928587\\  -0.562447009935070\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx 0.02605 + 1.6187 \bar x - 0.5624 \bar x^2 \approx f(\frac{x}{2}) \approx 0.026052 + 1.6187 (\frac{x}{2}) - 0.5624 (\frac{x}{2})^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [0,2]:



n=4
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2+ \bar c_3 \bar x^3+\bar c_4 \bar x^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=4

Therefore, we can use the Matlab function: hilb(5) to determine the Hilbert matrix of order 5.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6}\\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} \\ \frac{1}{4} & \frac{1}{5} & \frac{1}{5} & \frac{1}{7} & \frac{1}{8} \\ \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = 10^5 \begin{bmatrix} 0.0002 & -0.0030 &   0.0105  & -0.0140 &   0.0063\\ -0.0030 &  0.0480  & -0.1890 &   0.2688  & -0.1260\\    0.0105  & -0.1890  &  0.7938  & -1.1760  &  0.5670\\   -0.0140 &   0.2688  & -1.1760  &  1.7920 &  -0.8820\\    0.0063  & -0.1260  &  0.5670  & -0.8820  &  0.4410 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix d bar, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf \bar d = \begin{bmatrix} \langle \bar x^0,\log{2 \bar x} \rangle \\ \langle \bar x^1, \log{2 \bar x} \rangle\\ \langle \bar x^2, \log{2 \bar x} \\ \langle \bar x^3, \log{2 \bar x} \rangle \\ \langle \bar x^4, \log{2 \bar x} \rangle \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} \log{2 \bar x} d\bar x \\ \int_{0}^{1} \bar x \log{2 \bar x} d\bar x  \\ \int_{0}^{1} \bar x^2 \log{2 \bar x}  d\bar x  \\ \int_{0}^{1} \bar x^3 \log{2 \bar x}  d\bar x  \\ \int_{0}^{1} \bar x^4 \log{2 \bar x}  d\bar x  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix.


 * {| style="width:100%" border="0"

$$ \bar d_3 = \langle \bar x^3, \log{2 \bar x} \rangle=\int_{0}^{1} \bar x^3 \log{2 \bar x}  d\bar x = \frac{- \bar x^4}{16} + \frac{1}{4} \bar x^4 \log(2 \bar x +1) + \frac{\bar x^3}{24} - \frac{\bar x^2}{32} +\frac{x}{32} - \frac{1}{64} \log(2 \bar x +1) |_{0}^{1}  = \frac{1}{192}(45 \log(3) -4)  = 0.2367 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

https://www.wolframalpha.com/input/?i=integral+from+0+to+1+of+%28x%5E3%29log%282x%2B1%29


 * {| style="width:100%" border="0"

$$ \bar d_4 =\langle \bar x^4,\log{2 \bar x} \rangle= \int_{0}^{1} \bar x^4\log{2 \bar x} d\bar x = \frac{- \bar x^5}{25} + \frac{1}{5} \bar x^5 \log(2 \bar x +1) + \frac{\bar x^4}{4} - \frac{\bar x^3}{60} + \frac{\bar x^2}{80} - \frac{\bar x}{80} + \frac{1}{160}\log(2 \bar x +1) |_{0}^{1} = \frac{495 \log(3) -76}{2400} = 0.1949 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

https://www.wolframalpha.com/input/?i=integral+from+0+to+1+of+%28x%5E4%29log%282x%2B1%29


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 0.6479 \\ 0.4120 \\ 0.3009 \\ 0.2367 \\ 0.1949 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...


 * {| style="width:100%" border="0"

$$ \mathbf c \approx \begin{bmatrix} 0.001444052549559\\  1.950727199565335\\  -1.576061476482209\\   1.042794468296051\\  -0.321170053975948 \end{bmatrix} $$ Now, changing back to the original variable x, we sub in for x bar:
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx 0.00144 + 1.9507 \bar x - 1.5761 \bar x^2 + 1.0428 \bar x^3 - 0.3212 \bar x^4 \approx 0.00144 + 1.9507 (\frac{x}{2}) - 1.5761 (\frac{x}{2})^2 + 1.0428 (\frac{x}{2})^3 - 0.3212 (\frac{x}{2})^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [0,2]:



n=6
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2 + \bar c_3 \bar x^3 + \bar c_4 \bar x^4 + \bar c_5 \bar x^5 + \bar c_6 \bar x^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=6

Therefore, we can use the Matlab function: hilb(7) to determine the Hilbert matrix of order 7.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} &\frac{1}{6} &\frac{1}{7}\\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} &\frac{1}{7} &\frac{1}{8}\\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} &\frac{1}{8} &\frac{1}{9} \\ \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} &\frac{1}{9} &\frac{1}{10}\\ \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9} &\frac{1}{10} &\frac{1}{11} \\ \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9} & \frac{1}{10} &\frac{1}{11} &\frac{1}{12} \\ \frac{1}{7} & \frac{1}{8} & \frac{1}{9} & \frac{1}{10} & \frac{1}{11} &\frac{1}{12} &\frac{1}{13}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = 10^8 \begin{bmatrix} 0.0000 & -0.0000 &   0.0001 &  -0.0003 &   0.0005 &  -0.0004  &  0.0001\\   -0.0000   & 0.0004  & -0.0032   & 0.0113  & -0.0194   & 0.0160  & -0.0050\\    0.0001  & -0.0032    &0.0286  & -0.1058   & 0.1871  & -0.1572   & 0.0505\\   -0.0003  &  0.0113  & -0.1058   & 0.4032  & -0.7277   & 0.6209  & -0.2018\\    0.0005   &-0.0194   & 0.1871   &-0.7277   & 1.3340   &-1.1526    &0.3784\\   -0.0004   & 0.0160   &-0.1572  &  0.6209  & -1.1526  &  1.0059  & -0.3330\\    0.0001   &-0.0050    &0.0505 &  -0.2018   & 0.3784 &  -0.3330   & 0.1110\\ \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix d bar, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf \bar d = \begin{bmatrix} \langle \bar x^0,\log{\left(2 \bar x+1\right)} \rangle \\ \langle \bar x^1, \log{\left(2 \bar x+1\right)} \rangle\\ \langle \bar x^2, \log{\left(2 \bar x+1\right)} \rangle \\ \langle \bar x^3, \log{\left(2 \bar x+1\right)} \rangle \\ \langle \bar x^4, \log{\left(2 \bar x+1\right)} \rangle \\ \langle \bar x^5, \log{\left(2 \bar x+1\right)} \rangle \\ \langle \bar x^6, \log{\left(2 \bar x+1\right)} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} \log{\left(2 \bar x+1\right)} dx \\ \int_{0}^{1} \bar x \log{\left(2 \bar x+1\right)} dx  \\ \int_{0}^{1} \bar x^2 \log{\left(2 \bar x+1\right)}  dx \\ \int_{0}^{1} \bar x^3 \log{\left(2 \bar x+1\right)}  dx \\ \int_{0}^{1} \bar x^4 \log{\left(2 \bar x+1\right)}  dx \\ \int_{0}^{1} \bar x^5 \log{\left(2 \bar x+1\right)}  dx \\ \int_{0}^{1} \bar x^6 \log{\left(2 \bar x+1\right)}  dx \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix.


 * {| style="width:100%" border="0"

$$ \bar d_5 =\langle \bar x^5,\log{\left(2 \bar x+1\right)} \rangle= \int_{0}^{1} \bar x^5 \log{\left(2 \bar x+1\right)} dx =[\frac{-\bar x^6}{36}+\frac{1}{6}\bar x^6 \log{\left(2\bar x+1\right)}+\frac{\bar x^5}{60}-\frac{\bar x^4}{96}+\frac{\bar x^3}{144}-\frac{\bar x^2}{192}+\frac{\bar x}{192}-\frac{1}{384}\log{\left(2\bar x +1\right)}] |_0^1 =\frac{21\log{3}}{128}-\frac{7}{480} =0.1656 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E5*log%282*x%2B1%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_6 = \langle \bar x^6, \log{\left(2 \bar x+1\right)} \rangle =\int_{0}^{1} \bar x^6 \log{\left(2 \bar x+1\right)} dx =[\frac{-\bar x^7}{49}+\frac{1}{7}\bar x^7 \log{\left(2\bar x+1\right)}+\frac{\bar x^6}{84}-\frac{\bar x^5}{140}+\frac{\bar x^4}{224}-\frac{\bar x^3}{336}+\frac{\bar x^2}{48}-\frac{\bar x}{448}+\frac{1}{896}\log{\left(2\bar x +1\right)}] |_0^1 =\frac{129\log{3}}{896}-\frac{111}{7840} =0.1440 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E6*log%282*x%2B1%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 0.6479 \\ 0.4120 \\ 0.3009 \\ 0.2367 \\ 0.1949 \\ 0.1656 \\ 0.1440 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...


 * {| style="width:100%" border="0"

$$ \mathbf c \approx \begin{bmatrix} 0.000087533828719\\  1.994608291424811\\  -1.916677197907120\\   2.099761187098920\\  -1.844738412648439\\   1.010804294608533\\  -0.245285915676504 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx 0.0001 + 1.9946 \bar x - 1.9167 \bar x^2 + 2.0998 \bar x^3 - 1.8447 \bar x^4 + 1.0108 \bar x^5 - 0.2453 \bar x^6 \approx f(\frac{x}{2}) \approx 0.0001 + 1.9946 \left(\frac{x}{2}\right) - 1.9167 \left(\frac{x}{2}\right)^2 + 2.0998 \left(\frac{x}{2}\right)^3 - 1.8447 \left(\frac{x}{2}\right)^4 + 1.0108 \left(\frac{x}{2}\right)^5 - 0.2453 \left(\frac{x}{2}\right)^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [0,2]:



n=2
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=2

Therefore, we can use the Matlab function: hilb(3) to determine the Hilbert matrix of order 3.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix ‘’’d bar’’’, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} \langle \bar x^0,\log{\frac{5 \bar x +1}{2}} \rangle \\ \langle \bar x^1, \log{\frac{5 \bar x +1}{2}} \rangle\\ \langle \bar x^2, \log{\frac{5 \bar x +1}{2}} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} \log{\frac{5 \bar x +1}{2}} dx \\ \int_{0}^{1} \bar x \log{\frac{5 \bar x +1}{2}} dx  \\ \int_{0}^{1} \bar x^2 \log{\frac{5 \bar x +1}{2}} dx  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix, d.


 * {| style="width:100%" border="0"

$$ \bar d_0 =\langle \bar x^0, \log{\left(\frac{5 \bar x +1}{2}\right)} \rangle= \int_{0}^{1} \log{\left(\frac{5 \bar x +1}{2}\right)} dx = \frac{1}{5}(5\bar x+1)(\log{\left(\frac{5\bar x+1}{2}\right)}-1) |_{0}^{1} = \frac{\log{1458}}{5}-1 = 0.45696 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=log%28%285x%2B1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_1 = \langle \bar x^1, \log{\left(\frac{5 \bar x +1}{2}\right)} \rangle=\int_{0}^{1} \bar x \log{\left(\frac{5 \bar x +1}{2}\right)} dx = \frac{1}{100}(5\bar x+1)(-5\bar x+10\bar x \log{\left(\frac{5\bar x+1}{2}\right)}-2\log{\left(5\bar x+1\right)}+3+\log{4}) |_{0}^{1} = \frac{12\log{3}}{25}-\frac{\log{2}}{50}-\frac{3}{20} = 0.36347 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x*log%28%285x%2B1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_2 = \langle \bar x^2, \log{\left(\frac{5 \bar x +1}{2}\right)} \rangle = \int_{0}^{1} \bar x^2 \log{\left(\frac{5 \bar x +1}{2}\right)}  dx = [\frac{-\bar x^3}{9}+\frac{1}{3}\bar x^3\log{\left(\frac{5\bar x+1}{2}\right)}+\frac{\bar x^2}{30}-\frac{\bar x}{75}+\frac{1}{375}\log{\left(5\bar x+1\right)}] |_{0}^{1} = \frac{42\log{3}}{125}+\frac{\log{2}}{375}-\frac{41}{450} = 0.27987 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E2*log%28%285x%2B1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 0.45696 \\ 0.36347 \\ 0.27987 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...
 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \begin{bmatrix}9 & -36 & 30 \\ -36 & 192 & -180 \\ 30 & -180 & 180\end{bmatrix} \begin{bmatrix} 0.45696 \\ 0.36347 \\ 0.27987 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf \bar c \approx \begin{bmatrix}        -0.576146424672284\\ 2.958930914492832\\ -1.339064550181234 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx -0.5761 +  2.9589\bar x - 1.3390\bar x^2 = -0.5761 +2.9589(\frac{2x+1}{5}) -   1.3390(\frac{2x+1}{5})^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [-1/2,2]:



n=4
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2+ \bar c_3 \bar x^3+\bar c_4 \bar x^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=4

Therefore, we can use the Matlab function: hilb(5) to determine the Hilbert matrix of order 5.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} \\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6}\\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} \\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} \\ \frac{1}{4} & \frac{1}{5} & \frac{1}{5} & \frac{1}{7} & \frac{1}{8} \\ \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = 10^5 \begin{bmatrix} 0.0002 & -0.0030 &   0.0105  & -0.0140 &   0.0063\\ -0.0030 &  0.0480  & -0.1890 &   0.2688  & -0.1260\\    0.0105  & -0.1890  &  0.7938  & -1.1760  &  0.5670\\   -0.0140 &   0.2688  & -1.1760  &  1.7920 &  -0.8820\\    0.0063  & -0.1260  &  0.5670  & -0.8820  &  0.4410 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix ‘’’d bar’’’, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf \bar d = \begin{bmatrix} \langle \bar x^0, \log{\frac{5 \bar x +1}{2}}\rangle \\ \langle \bar x^1, \log{\frac{5 \bar x +1}{2}}\rangle\\ \langle \bar x^2, \log{\frac{5 \bar x +1}{2}}\rangle \\ \langle \bar x^3, \log{\frac{5 \bar x +1}{2}}\rangle \\ \langle \bar x^4, \log{\frac{5 \bar x +1}{2}} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} \log{\frac{5 \bar x +1}{2}} dx \\ \int_{0}^{1} \bar x \log{\frac{5 \bar x +1}{2}}  dx  \\ \int_{0}^{1} \bar x^2 \log{\frac{5 \bar x +1}{2}}dx  \\ \int_{0}^{1} \bar x^3 \log{\frac{5 \bar x +1}{2}}dx  \\ \int_{0}^{1} \bar x^4 \log{\frac{5 \bar x +1}{2}}dx \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix, d.


 * {| style="width:100%" border="0"

$$ \bar d_3 =\langle \bar x^3, \log{\frac{5 \bar x +1}{2}} \rangle= \int_{0}^{1} \bar x^3 \log{\frac{5 \bar x +1}{2}}  dx =[\frac{-\bar x^4}{16}+\frac{1}{4}\bar x^4\log{\left(\frac{5\bar x+1}{2}\right)}+\frac{\bar x^3}{60}-\frac{\bar x^2}{200}+\frac{\bar x}{500}-\frac{1}{2500}\log{\left(5\bar x+1\right)}] |_{0}^{1} = \frac{156\log{3}}{625}-\frac{\log{2}}{2500}-\frac{293}{6000} = 0.22510 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E3*log%28%285x%2B1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_4 =\langle \bar x^4, \log{\frac{5 \bar x +1}{2}} \rangle = \int_{0}^{1} \bar x^4 \log{\frac{5 \bar x +1}{2}} dx =[\frac{-\bar x^5}{25}+\frac{1}{5}\bar x^5\log{\left(\frac{5\bar x+1}{2}\right)}+\frac{\bar x^4}{100}-\frac{\bar x^3}{375}+\frac{\bar x^2}{1250}-\frac{\bar x}{3125}+\frac{1}{15625}\log{\left(5\bar x+1\right)}] |_{0}^{1} = \frac{3126\log{3}}{15625}+\frac{\log{2}}{15625}-\frac{1207}{37500} = 0.18765 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E4*log%28%285x%2B1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 0.45696 \\ 0.36347 \\ 0.27987 \\ 0.22510 \\ 0.18765 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...


 * {| style="width:100%" border="0"

$$ \mathbf \bar c \approx \begin{bmatrix}         -0.677077991419253\\ 4.382972902201345\\  -5.963485453277826\\   5.211579136375804\\   -1.862552884191246\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx -0.6771 + 4.3830 \bar x - 5.9635\bar x^2+5.2116\bar x^3 -1.8626\bar x^4 = -0.6771 + 4.3830 (\frac{2x+1}{5}) - 5.9635(\frac{2x+1}{5})^2+5.2116(\frac{2x+1}{5})^3 -1.8626(\frac{2x+1}{5})^4 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [-1/2,2]:



n=6
The function f(x bar) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx \bar c_0+ \bar c_1 \bar x+ \bar c_2 \bar x^2+ \bar c_3 \bar x^3+\bar c_4 \bar x^4+ \bar c_5 \bar x^5+ \bar c_6 \bar x^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Because we are analyzing the functions on the x bar space, the Hilbert matrix remains the same as calculated in R4.4 for n=6

Therefore, we can use the Matlab function: hilb(7) to determine the Hilbert matrix of order 7.


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma = \begin{bmatrix}1 & \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} &\frac{1}{6} &\frac{1}{7}\\ \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} &\frac{1}{7} &\frac{1}{8}\\ \frac{1}{3} & \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} &\frac{1}{8} &\frac{1}{9} \\ \frac{1}{4} & \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} &\frac{1}{9} &\frac{1}{10}\\ \frac{1}{5} & \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9} &\frac{1}{10} &\frac{1}{11} \\ \frac{1}{6} & \frac{1}{7} & \frac{1}{8} & \frac{1}{9} & \frac{1}{10} &\frac{1}{11} &\frac{1}{12} \\ \frac{1}{7} & \frac{1}{8} & \frac{1}{9} & \frac{1}{10} & \frac{1}{11} &\frac{1}{12} &\frac{1}{13}\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Then, using Matlab again, we solve for the inverse of the Hilbert matrix


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma^{-1} = 10^8 \begin{bmatrix} 0.0000 & -0.0000 &   0.0001 &  -0.0003 &   0.0005 &  -0.0004  &  0.0001\\   -0.0000   & 0.0004  & -0.0032   & 0.0113  & -0.0194   & 0.0160  & -0.0050\\    0.0001  & -0.0032    &0.0286  & -0.1058   & 0.1871  & -0.1572   & 0.0505\\   -0.0003  &  0.0113  & -0.1058   & 0.4032  & -0.7277   & 0.6209  & -0.2018\\    0.0005   &-0.0194   & 0.1871   &-0.7277   & 1.3340   &-1.1526    &0.3784\\   -0.0004   & 0.0160   &-0.1572  &  0.6209  & -1.1526  &  1.0059  & -0.3330\\    0.0001   &-0.0050    &0.0505 &  -0.2018   & 0.3784 &  -0.3330   & 0.1110\\ \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can develop the matrix ‘’’d bar’’’, the known computable right hand side:
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} \langle \bar x^0,\log{\frac{5 \bar x +1}{2}} \rangle \\ \langle \bar x^1, \log{\frac{5 \bar x +1}{2}} \rangle\\ \langle \bar x^2, \log{\frac{5 \bar x +1}{2}} \rangle \\ \langle \bar x^3, \log{\frac{5 \bar x +1}{2}} \rangle \\ \langle \bar x^4, \log{\frac{5 \bar x +1}{2}} \rangle \end{bmatrix} = \begin{bmatrix} \int_{0}^{1} \log{\frac{5 \bar x +1}{2}} dx \\ \int_{0}^{1} \bar x \log{\frac{5 \bar x +1}{2}}  dx  \\ \int_{0}^{1} \bar x^2 \log{\frac{5 \bar x +1}{2}}  dx  \\ \int_{0}^{1} \bar x^3 \log{\frac{5 \bar x +1}{2}}  dx  \\ \int_{0}^{1} \bar x^4 \log{\frac{5 \bar x +1}{2}}  dx \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We will need to employ the method of integration by parts to determine the matrix, d.


 * {| style="width:100%" border="0"

$$ \bar d_5 =\langle \bar x^5, \log{\frac{5 \bar x +1}{2}} \rangle= \int_{0}^{1} \bar x^5 \log{\frac{5 \bar x +1}{2}}  dx = [\frac{-\bar x^6}{36}+\frac{1}{6}\bar x^6\log{\left(\frac{5\bar x+1}{2}\right)}+\frac{\bar x^5}{150}-\frac{\bar x^4}{600}+\frac{\bar x^3}{2250}-\frac{\bar x^2}{7500}+\frac{\bar x}{18750}-\frac{1}{93750}\log{\left(5\bar x+1\right)}] |_{0}^{1} = \frac{2604\log{3}}{15625}-\frac{\log{2}}{93750}-\frac{1681}{75000} = 0.16067 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E5*log%28%285x%2B1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \bar d_6 =\langle \bar x^6, \log{\frac{5 \bar x +1}{2}} \rangle = \int_{0}^{1} \bar x^6 \log{\frac{5 \bar x +1}{2}} dx = [\frac{-\bar x^7}{49}+\frac{1}{7}\bar x^7\log{\left(\frac{5\bar x+1}{2}\right)}+\frac{\bar x^6}{210}-\frac{\bar x^5}{875}+\frac{\bar x^4}{3500}-\frac{\bar x^3}{13125}+\frac{\bar x^2}{43750}-\frac{\bar x}{109375}-\frac{1}{546875}\log{\left(5\bar x+1\right)}] |_{0}^{1} = \frac{78126\log{3}}{546875}+\frac{\log{2}}{546875}-\frac{50733}{3062500} = 0.14038 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E6*log%28%285x%2B1%29%2F2%29&random=false


 * {| style="width:100%" border="0"

$$ \mathbf \bar d=\begin{bmatrix} 0.45696 \\ 0.36347 \\ 0.27987 \\ 0.22510 \\ 0.18765 \\ 0.16067 \\ 0.14038 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, we can solve for c bar,


 * {| style="width:100%" border="0"

$$ \mathbf \bar c= \boldsymbol \Gamma^{-1} \mathbf \bar d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Performing matrix multiplication in Matlab...


 * {| style="width:100%" border="0"

$$ \mathbf \bar c \approx \begin{bmatrix} -0.690743092534149\\  4.838149892340880\\  -9.624575953697786\\  17.084938573185354\\ -19.968597986735404\\  12.940636919811368\\  -3.482244871091098\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, changing back to the original variable x, we sub in for x bar:


 * {| style="width:100%" border="0"

$$ f(\bar x) \approx -0.6907 + 4.8381 \bar x -9.6246 \bar x^2 + 17.0849 \bar x^3 -19.9686 \bar x^4 + 12.9406 \bar x^5 -3.4822 \bar x^6 = -0.6907 + 4.8381 (\frac{2x+1}{5}) -9.6246 (\frac{2x+1}{5})^2 + 17.0849 (\frac{2x+1}{5})^3 -19.9686 (\frac{2x+1}{5})^4 + 12.9406 (\frac{2x+1}{5})^5 -3.4822 (\frac{2x+1}{5})^6 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

This results in the following plot on the interval [-1/2,2]:



n=2


The first approximation is slightly more accurate than the second, but only on the interval [0,2] for which is was approximated. The second approximation becomes more accurate between [-0.5, 0]. This shows that an approximation is only accurate for the interval for which is was approximated. You cannot use either of these functions to approximate log(1+x) on the interval [0,10] or [-10,0].

n=4


For this plot, the blue curve is more accurate, since it it follows the exact curve closely on the entire interval of [-0.5, 2]. The red curve is very accurate but deviates at x values less than 0.

n=6


There is hardly a difference between the two approximations because higher order approximations become more and more accurate.

Problem Statement
Solve the 2-DOF system under the log excitation using the result in R4.4 and the partial

solution in my lecture notes, but now with the time-dependent function


 * {| style="width:100%" border="0"

$$ h(t) = \log(1+t)$$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

see the excitation Case 2 in sec.53f, Eq.(4) p.53-48.

Use the same initial conditions, i.e, everything is the same as in my lecture notes,

except for the above time function.

Of course, the method is to replace the advanced function log(1+t) over the interval [0,1]

by its successively more accurate approximations that you obtained in R4.4 so that you

would obtain successively more accurate solution for the 2-DOF system in my lecture notes.

To reduce the work, use only the 1st and the 3rd approximations, i.e, with n = 2, 6.

for each approximation to log(1+t) over the interval [0,1], you could use the method

described in sec.7b, sec.7c.

For each modal equation and modal initial condition, verify the correctness of your modal

displacement solution by verifying that it satisfies the modal initial conditions, and

that it satisfies the modal L2-ODE-CC.

hint: the homogeneous solution for each modal equation is the same as in my example;

you only need to solve for the particular solution for each approximation.

Solution
Resolving R4.4 to use function approximation


 * {| style="width:100%" border="0"

$$ f(x)=log(1+x) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Following the same steps as the preceding problems, we know that it is necessary to develop the vector, d. We will start by applying the same method of integration by parts.


 * {| style="width:100%" border="0"

$$ \int u dv=uv-\int v du $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

For the first integral, we will use u= log(1+x) and dv=1
 * {| style="width:100%" border="0"

$$ \langle x^0,\log(1+x) \rangle = \langle 1,\log(1+x) \rangle = \int_0^1 \log(1+x) dx = x\log(x)-\int_0^1 \frac{x}{1+x} dx $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

In order to solve the integral, we need to make a "U-substitution". We will use u=(1+x) and du=dx:
 * {| style="width:100%" border="0"

$$ x\log(x)-\int_0^1 \frac{x}{1+x} dx= x\log(x)-\int_0^1 \frac{u-1}{u} dx = x\log(x)-\int_0^1 1-\frac{1}{u} dx=x\log(x)-u+\log(u) $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Substituting back in and simplifying:
 * {| style="width:100%" border="0"

$$ x\log(x)-u+\log(u) = x\log(x)-(1+x)+\log(1+x)= (1+x)(\log(x)-1)|_0^1= 2\log(2) = 0.38629436111 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

http://integrals.wolfram.com/index.jsp?expr=log%281%2Bx%29&random=false

We apply the same integration process for the d1 except that it quickly gets very complicated:
 * {| style="width:100%" border="0"

$$ \langle x,\log(1+x) \rangle=\int_0^1 x^1 \log(1+x) dx= \frac{x^2\log(1+x)}{2}-\frac{1}{2}\int\frac{x^2}{1+x}dx $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Instead of performing the unnecessary algebra to solve the remaining integrals


 * {| style="width:100%" border="0"

$$ \langle x,\log(1+x) \rangle=\int_0^1 x^1 \log(1+x) dx= \frac{1}{4}(2(x^2-1)\log(1 + x)-x(x-2)) = \frac{1}{4} = 0.25 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

http://integrals.wolfram.com/index.jsp?expr=x*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^2,\log(1+x) \rangle=\int_0^1 x^2 \log(1+x) dx= \frac{1}{18}(x(-6 + (3 - 2x)x) + 6(1 + x^3)\log(1 + x))= \frac{2}{3}log(2)-\frac{5}{18} = 0.184320342595519 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E2*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^3,\log(1+x) \rangle=\int_0^1 x^3 \log(1+x) dx= \frac{x}{4} - \frac{x^2}{8} + \frac{x^3}{12} -\frac{x^4}{16} - \frac{\log(1 + x)}{4} + \frac{x^4\log(1 + x)}{4}=\frac{7}{48} = 0.145833333 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E3*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^4,\log(1+x) \rangle=\int_0^1 x^4 \log(1+x) dx= \frac{-x}{5} + \frac{x^2}{10} - \frac{x^3}{15} + \frac{x^4}{20} - \frac{x^5}{25} + \frac{\log(1 + x)}{5} + \frac{1}{5}x^5\log(1 + x) = 0.120592205 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E4*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^5,\log(1+x) \rangle=\int_0^1 x^5 \log(1+x) dx= \frac{x}{6} - \frac{x^2}{12} + \frac{x^3}{18} - \frac{x^4}{24} + \frac{x^5}{30} - \frac{x^6}{36} - \frac{1}{6}\log(1 + x) + \frac{1}{6}x^6\log(1 + x) = 0.102775 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E5*log%281%2Bx%29&random=false


 * {| style="width:100%" border="0"

$$ \langle x^6,\log(1+x) \rangle=\int_0^1 x^6 \log(1+x) dx= \frac{-x}{7} + \frac{x^2}{14} - \frac{x^3}{21} +\frac{x^4}{28} - \frac{x^5}{35} + \frac{x^6}{42} - \frac{x^7}{49} + \frac{1}{7}\log(1 + x) + \frac{1}{7}x^7\log(1 + x) = 0.0895386 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

http://integrals.wolfram.com/index.jsp?expr=x%5E6*log%281%2Bx%29&random=false

Solving with n = 2
Determine the function approximation used for n = 2 The basis is


 * {| style="width:100%" border="0"

$$ \{ 1, x, x^2 \} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

so the function f(x) can be approximated as


 * {| style="width:100%" border="0"

$$ f(x) \approx c_0b_0+c_1b_1+c_2b_2=c_0+c_1x+c_2x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Now, determine the known computable right hand side (using the values determined from the quad function in Matlab):
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} \langle x^0,\log(1+x) \rangle \\ \langle x^1,\log(1+x)\rangle\\ \langle x^2,\log(1+x) \rangle \end{bmatrix} = \begin{bmatrix} 0.386294361119\\0.2500\\0.184320342595\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using the Hilbert matrix of order 3 calculated prior, we can plug into the equation (1) and solve for c:


 * {| style="width:100%" border="0"

$$ \boldsymbol \Gamma \mathbf c = \mathbf d $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \mathbf c =  \begin{bmatrix} 0.0062577\\   0.91575\\   -0.233517\end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Therefore, the function can be approximated by:
 * {| style="width:100%" border="0"

$$ \log(1+x) \approx 0.0062577 + 0.91575x - 0.233517x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

modal Equations and initial conditions

Modal Equation #1:
 * {| style="width:100%" border="0"

$$ y_1'' + \frac12 \, y_1' + 4 \, y_1 = 2log(t+1) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_1(0) = 1, \ y'_1(0) = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Modal Equation #2:
 * {| style="width:100%" border="0"

$$ y_2'' + 6 \, y_2' + 9 \, y_2 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_2(0) = 0, \ y'_2(0) = 1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

a1. Find the particular solution

 * {| style="width:100%" border="0"

$$ y_1'' + \frac12 \, y_1' + 4 \, y_1 = 2log(t+1) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_1(0) = 1, \ y'_1(0) = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Solution for modal coordinate $$ y_1(t) $$ is the summation of

the homogeneous and particular solutions


 * {| style="width:100%" border="0"

$$ y_1(t) = y_{h1}(t) + y_{P1}(t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To find homogeneous solution we assume trial solution


 * {| style="width:100%" border="0"

$$ y_{h1}(t) = e^{\lambda_{1} t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

in which we retrieve the characteristic equation


 * {| style="width:100%" border="0"

$$ \lambda_1^2 + \frac12 \,\lambda_1 + 4 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

which generates the following complex-conjugate roots


 * {| style="width:100%" border="0"

$$ \lambda_{11} = -\frac14 + i \frac{3 \sqrt7}{4} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \lambda_{12} = -\frac14 - i \frac{3 \sqrt7}{4} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

to which the homogeneous solution then takes the form


 * {| style="width:100%" border="0"

$$ y_{h1}=e^{-\frac14 t}[C_{11}cos(\frac{3 \sqrt7}{4}t)+C_{12}sin(\frac{3 \sqrt7}{4}t)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Now, to find the particular solution $$ y_{P1} $$

The particular solution needs to be subbed in to modal equation 1 and set equal to the new approximation solved for in R4.4


 * {| style="width:100%" border="0"

$$ y_{P1}'' + \frac{1}{2}y_{P1}' + 4y_{P1} = 2log(1+t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Sub in the logarithmic approximation from R4.4
 * {| style="width:100%" border="0"

$$ y_{P1}'' + \frac{1}{2}y_{P1}' + 4y_{P1} = 2[-0.233517t^2 + 0.91575t + 0.0062577] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To solve for the particular solution, it must be split up in to three

smaller particular solutions. The sum of three equals the total particular solution

by the sum rule.


 * {| style="width:100%" border="0"

$$ y_{P1} = y_{P11} + y_{P12} + y_{P13} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We use this L2-ODE-CC to solve for $$ y_{P11} $$ with a particular

solution guess.


 * {| style="width:100%" border="0"

$$ y_{P11}'' + \frac{1}{2}y_{P11}' + 4y_{P11} = 2(0.0062577) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Particular Solution Guess:


 * {| style="width:100%" border="0"

$$ y_{P11} = A $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Take the first and second derivative to plug back in to the modal equation


 * {| style="width:100%" border="0"

$$ y_{P11}' = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_{P11}'' = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

$$ y_{P11}'' + \frac{1}{2}y_{P11}' + 4y_{P11} = 2(0.0062577) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ 0 + \frac{1}{2}(0) + 4A = 2(0.0062577) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ 4A = 2(0.0062577) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ A = 0.00312885 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Get particular solution $$ y_{P11} $$


 * {| style="width:100%" border="0"

$$ y_{P11} = 0.00312885 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Solve for $$ y_{P12} $$

We use this L2-ODE-CC to solve for $$ y_{P12} $$ with a particular

solution guess.


 * {| style="width:100%" border="0"

$$ y_{P12}'' + \frac{1}{2}y_{P12}' + 4y_{P12} = 2(0.91575t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Particular Solution Guess:


 * {| style="width:100%" border="0"

$$ y_{P12} = K_1t + K_0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Take the first and second derivative to plug back in to the modal equation


 * {| style="width:100%" border="0"

$$ y_{P12}' = K_1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_{P12}'' = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plug back in to the modal equation
 * {| style="width:100%" border="0"

$$ y_{P12}'' + \frac{1}{2}y_{P12}' + 4y_{P12} = 2(0.91575t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ 0 + \frac{1}{2}(K_1) + 4(K_1t + K_0) = 1.8315t $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \frac{1}{2}K_1 + 4(K_1t + K_0) = 1.8315t $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \frac{1}{2}K_1 + 4K_1t + 4K_0 = 1.8315t $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Solve for the coefficients
 * {| style="width:100%" border="0"

$$ 4K_1t = 1.8315t $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ K_1 = 0.457875 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \frac{1}{2}K_1 + 4K_0 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plug in $$ K_1 $$
 * {| style="width:100%" border="0"

$$ \frac{1}{2}(0.457875) + 4K_0 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ K_0 = -0.0572344 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Get particular solution $$ y_{P12} $$


 * {| style="width:100%" border="0"

$$ y_{P12} = 0.457875t - 0.0572344 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Solve for $$ y_{P13} $$

We use this L2-ODE-CC to solve for $$ y_{P13} $$ with a particular

solution guess.


 * {| style="width:100%" border="0"

$$ y_{P13}'' + \frac{1}{2}y_{P13}' + 4y_{P13} = 2(-0.233517t^2) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Particular Solution Guess:


 * {| style="width:100%" border="0"

$$ y_{P13} = F_2t^2 + F_1t + F_0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Take the first and second derivative to plug back in to the modal equation


 * {| style="width:100%" border="0"

$$ y_{P13}' = 2F_2t + F_1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_{P12}'' = 2F_2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plug back in to the modal equation
 * {| style="width:100%" border="0"

$$ y_{P13}'' + \frac{1}{2}y_{P13}' + 4y_{P13} = 2(-0.233517t^2) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ 2F_2 + \frac{1}{2}(2F_2t + F_1) + 4(F_2t^2 + F_1t + F_0) = -0.467034t^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ 2F_2 + F_2t + \frac{1}{2}F_1 + 4F_2t^2 + 4F_1t + 4F_0 = -0.467034t^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Solve for the Coefficients

$$ F_2 $$
 * {| style="width:100%" border="0"

$$ 4F_2t^2 = -0.467034t^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ F_2 = -0.1167585 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

$$ F_1 $$
 * {| style="width:100%" border="0"

$$ F_2t + 4F_1t = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ F_2 + 4F_1 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ (-0.1167585) + 4F_1 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ F_1 = 0.029189625 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

$$ F_0 $$


 * {| style="width:100%" border="0"

$$ 2F_2 + \frac{1}{2}F_1 + 4F_0 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ 2(-0.1167585) + \frac{1}{2}(0.029189625) + 4F_0 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ F_0 = 0.05473055 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Get particular solution $$ y_{P13} $$


 * {| style="width:100%" border="0"

$$ y_{P13} = -0.1167585t^2 + 0.029189625t + 0.05473055 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plug $$ y_{P11} $$, $$ y_{P12} $$, and $$ y_{p13} $$ back in to solve for $$ y_{P1} $$


 * {| style="width:100%" border="0"

$$ y_{P1} = y_{P11} + y_{P12} + y_{P13} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_{P1} = (0.00312885) + (0.457875t - 0.0572344) + (-0.1167585t^2 + 0.029189625t + 0.05473055) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Final Particular Solution


 * {| style="width:100%" border="0"

$$ y_{P1} = -0.1167585t^2 + 0.487064625t + 0.000625 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

a2. Verify Correctness of Particular Solution

 * {| style="width:100%" border="0"

$$ y_{P1} = -0.1167585t^2 + 0.487064625t + 0.000625 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Take first and second derivative of the particular solution


 * {| style="width:100%" border="0"

$$ y_{P1}' = -0.233517t + 0.487064625 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_{P1}'' = -0.233517 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plug values back in to Modal Equation 1 and set equal to excitation approximation


 * {| style="width:100%" border="0"

$$ y_{P1}'' + \frac{1}{2}y_{P1}' + 4y_{P1} = 2[-0.233517t^2 + 0.91575t + 0.0062577] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ -0.233517 + \frac{1}{2}(-0.233517t + 0.487064625) + 4(-0.1167585t^2 + 0.487064625t + 0.000625) = 2[-0.233517t^2 + 0.91575t + 0.0062577] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ -0.233517 + (-0.1167585t + 0.2435323125) + (-0.467034t^2 + 1.9482585t + 0.0025) = -0.467034t^2 + 1.8315t + 0.0123154 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Verify Correctness mathematically


 * {| style="width:100%" border="0"

$$ -0.467034t^2 + 1.8315t + 0.0125153 \approx  -0.467034t^2 + 1.8315t + 0.0123154  \checkmark $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Verify Correctness graphically



a3. Modal displacement and Correctness
Plug $$ y_{P1} $$ and $$ y_{h1} $$ into the equation for $$ y_1 $$
 * {| style="width:100%" border="0"

$$ y_{1} = y_{h1} + y_{P1} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_{1} = e^{-\frac14 t}[C_{11}cos(\frac{3 \sqrt7}{4}t)+C_{12}sin(\frac{3 \sqrt7}{4}t)] + (-0.1167585t^2 + 0.487064625t - 0.27302773) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plug in initial conditions to get $$ C_{11} $$


 * {| style="width:100%" border="0"

$$ 1 = e^{-\frac14(0}[C_{11}cos(\frac{3 \sqrt7}{4}(0))+C_{12}sin(\frac{3 \sqrt7}{4}(0))] + (-0.1167585(0)^2 + 0.487064625(0) - 0.27302773) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ 1 = 1[C_{11}(1))] - 0.27302773 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ C_{11} = 1.27302773 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Take the first derivative and plug in initial conditions to get $$ C_{12} $$


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

y_{1}' = e^{-\frac14 t}[-(\frac{3 \sqrt7}{4})C_{11}sin(\frac{3 \sqrt7}{4}t)+(\frac{3 \sqrt7}{4})C_{12}cos(\frac{3 \sqrt7}{4}t)] + (-\frac14)e^{-\frac14 t}[C_{11}cos(\frac{3 \sqrt7}{4}t)+C_{12}sin(\frac{3 \sqrt7}{4}t)] -0.233517t + 0.487064625

$$
 * }
 * }


 * {| style="width:100%" border="0"

$$ \begin{align} 0 = e^{-\frac14 (0)}[-(\frac{3 \sqrt7}{4})C_{11}sin(\frac{3 \sqrt7}{4}(0))+(\frac{3 \sqrt7}{4})C_{12}cos(\frac{3 \sqrt7}{4}(0))] \\ + (-\frac14)e^{-\frac14 (0)}[C_{11}cos(\frac{3 \sqrt7}{4}(0))+C_{12}sin(\frac{3 \sqrt7}{4}(0))] -0.233517(0) + 0.487064625 \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ 0 = (1)[(\frac{3 \sqrt7}{4})C_{12}cos(\frac{3 \sqrt7}{4}(0))] + (-\frac14)(1)[C_{11}cos(\frac{3 \sqrt7}{4}(0)] + 0.487064625 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ 0 = (1)[(\frac{3 \sqrt7}{4})C_{12}(1)] + (-\frac14)(1)[(1.27302773)(1)] + 0.487064625 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ C_{12} = -0.0850710807 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plug $$ C_{11} $$ and $$ C_{12} $$ back in to $$ y_1 $$


 * {| style="width:100%" border="0"

$$ y_{1} = e^{-\frac14 t}[1.27302773cos(\frac{3 \sqrt7}{4}t) - 0.0850710807)sin(\frac{3 \sqrt7}{4}t)] + (-0.1167585t^2 + 0.487064625t - 0.27302773) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plot the function to see if it fulfills initial conditions.




 * {| style="width:100%" border="0"

$$ y_1(0) = 1 \checkmark $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_1(0)' = 0 \checkmark $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

b1. Find the particular solution
Solution for the modal coordinate $$ y_{2} $$ is the summation of the homogeneous

and the particular. But Modal Equation 2 is already homogenous so there is no need for a particular solution.

b2. Verify Correctness of Particular Solution
We had said there is no particular solution to modal equation 2 and this is correct.

If you were to plug in zero for $$ p_2 $$ and its first and second derivatives

in to modal equation 2, you would see that it solves to zero which is correct.

b3. Modal Displacement and Correctness
To find the modal displacement, we just need to find the homogenous solution.


 * {| style="width:100%" border="0"

$$ y_2(t) = y_{h2}(t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To find homogeneous solution we assume trial solution


 * {| style="width:100%" border="0"

$$ y_{h2}(t) = e^{\lambda_{2} t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

in which we retrieve the characteristic equation


 * {| style="width:100%" border="0"

$$ \lambda_2^2 + 6 \,\lambda_2 + 9 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and the eigenvalues retrieved come out to be


 * {| style="width:100%" border="0"

$$ \lambda_{1,2}=-3 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

since the eigenvalues recovered are a double real root the solution takes the form


 * {| style="width:100%" border="0"

$$ y_2=P_{21}e^{-3t}+P{22}te^{-3t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and thus the modal velocity takes the form


 * {| style="width:100%" border="0"

$$ y_2=-3P_{21}e^{-3t}-3P_{22}te^{-3t}+P_{22}e^{-3t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

to find the undetermined coefficients we must satisfy the modal initial conditions


 * {| style="width:100%" border="0"

$$ y_2(0) = 0 \Rightarrow P_{21} = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y'_2(0) = 1 \Rightarrow -3 P_{21} + P_{22} = 1 \Rightarrow P_{22} = 1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and thus the modal displacement is


 * {| style="width:100%" border="0"

$$ y_2(t) = t e^{-3 t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Check Plot to see if Modal Displacement equation matches initial conditions




 * {| style="width:100%" border="0"

$$ y_2(0) = 0 \checkmark $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_2(0)' = 1 \checkmark $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

b4. Plot modal displacements

 * {| style="width:100%" border="0"

$$ y_{1} = e^{-\frac14 t}[1.27302773cos(\frac{3 \sqrt7}{4}t) - 0.0850710807)sin(\frac{3 \sqrt7}{4}t)] + (-0.1167585t^2 + 0.487064625t - 0.27302773) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_2 = t e^{-3 t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }



$$ y_{1} $$ approaches infinity as it goes to infinity and $$ y_{2} $$ approaches zero as it goes to infinity

c. Complete Solution
Obtain displacements in original coordinate system by multiplying by the eigenvectors


 * {| style="width:100%" border="0"

$$ \mathbf d(t) = \bar{\boldsymbol \Phi} \, \mathbf y(t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

then,


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\mathbf d(t)=\begin{bmatrix} \frac{1}{\sqrt{5}} & \sqrt{\frac{3}{10}} \\ \sqrt{\frac{6}{5}} & \frac{-2}{\sqrt{5}} \end{bmatrix} \begin{bmatrix} y_1 \\ y_2 \end{bmatrix}

$$
 * }
 * }


 * {| style="width:100%" border="0"

$$ \begin{align} d_1 = \frac{1}{\sqrt{5}}(e^{-\frac14 t}[1.27302773cos(\frac{3 \sqrt7}{4}t) - 0.0850710807)sin(\frac{3 \sqrt7}{4}t)]  + (-0.1167585t^2 + 0.487064625t - 0.27302773)) + \\ \sqrt{\frac{3}{10}}( t e^{-3 t}) \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \begin{align} d_2 =  \sqrt{\frac{6}{5}}(e^{-\frac14 t}[1.27302773cos(\frac{3 \sqrt7}{4}t) - 0.0850710807)sin(\frac{3 \sqrt7}{4}t)]  + (-0.1167585t^2 + 0.487064625t - 0.27302773)) + \\ \frac{-2}{\sqrt{5}}(t e^{-3 t}) \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }



$$ d_1 $$ goes to infinity and $$ d_2 $$ goes to negative infinity.

Both displacements level out to a constant slope.

Problem Statement
Solve the 2-DOF system under the log excitation using the result in R4.5 and the partial

solution in my lecture notes, but now with the time-dependent function


 * {| style="width:100%" border="0"

$$ h(t) = \log(1+t)$$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

see the excitation Case 2 in sec.53f, Eq.(4) p.53-48.

Use the same initial conditions, i.e, everything is the same as in my lecture notes,

except for the above time function.

Of course, the method is to replace the advanced function log(1+t) over the interval [0,1]

by its successively more accurate approximations that you obtained in R4.5 so that you

would obtain successively more accurate solution for the 2-DOF system in my lecture notes.

To reduce the work, use only the 1st, i.e, with n = 2.

For each approximation to log(1+t) over the interval [0,1], you could use the method

described in sec.7b, sec.7c.

For each modal equation and modal initial condition, verify the correctness of your modal

displacement solution by verifying that it satisfies the modal initial conditions, and

that it satisfies the modal L2-ODE-CC.

hint: the homogeneous solution for each modal equation is the same as in my example;

you only need to solve for the particular solution for each approximation.

Solution
General approximation projected on the above basis:
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

f(x) \approx \sum_{j=1}^n c_j b_j(x) $$ find $$c_j$$ using Gram matrix as with vectors
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\{ b_i(x), \, i=1,...n \} $$ to obtain
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\sum_{j=1}^n c_j \langle b_i, b_j \rangle = \langle b_i , f \rangle , \ i=1,...,n $$ Gram matrix:
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} \langle b_1, b_1 \rangle & ... & \langle b_1, b_n \rangle \\

\vdots & \vdots & \vdots \\ \langle b_n, b_1 \rangle & ... & \langle b_n, b_n \rangle \end{bmatrix} $$
 * }
 * }

Unknown coefficients that need to be solve:
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\mathbf c = \lfloor c_1, ... , c_n \rfloor^T $$ Known components
 * }
 * }
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\mathbf d = \lfloor \langle b_1, f \rangle , ... , \langle b_n, f \rangle \rfloor^T = \lfloor d_1 , ..., d_n \rfloor^T $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\boldsymbol \Gamma \mathbf c = \mathbf d $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma \ne 0 \Rightarrow \boldsymbol \Gamma^{-1} \text{ exists} \Rightarrow \mathbf c = \boldsymbol \Gamma^{-1} \mathbf d $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_i, b_j \rangle = \int_{a}^{b} b_i b_j dx $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_i, b_j \rangle =\langle b_j , b_i \rangle $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_1 \rangle = \int_{0}^{1} 1 dx = 1 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_2 \rangle = \int_{0}^{1}  \cos( \pi x) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_3 \rangle = \int_{0}^{1}  \cos( 2\pi x) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_4 \rangle = \int_{0}^{1}  \cos( 3\pi x) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_1, b_5 \rangle = \int_{0}^{1}  \cos( 4\pi x) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_1 \rangle = \int_{0}^{1}  \cos( \pi x) ( 1 ) dx = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_2 \rangle = \int_{0}^{1}  \cos( \pi x) \cos( \pi x) dx = .5 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%28pi*x%29%29%28cos%28pi*x%29%29+dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_3 \rangle = \int_{0}^{1}  \cos( \pi x) \cos( 2\pi x) dx = 0 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%28pi*x%29%29%28cos%282pi*x%29%29+dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_4 \rangle = \int_{0}^{1}  \cos( \pi x) \cos( 3\pi x) dx = 0 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%28pi*x%29%29%28cos%283pi*x%29%29+dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_2, b_5 \rangle = \int_{0}^{1}  \cos( \pi x) \cos( 4\pi x) dx = 0 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%28pi*x%29%29%28cos%284pi*x%29%29+dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_1 \rangle = \langle b_0 , b_2 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_2 \rangle = \langle b_1 , b_2 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_3 \rangle = \int_{0}^{1}  \cos( 2\pi x) \cos( 2\pi x) dx = .5 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%282pi*x%29%29%28cos%282pi*x%29%29+dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_4 \rangle = \int_{0}^{1}  \cos( 2\pi x) \cos( 3\pi x) dx = 0 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%282pi*x%29%29%28cos%283pi*x%29%29+dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_3, b_5 \rangle = \int_{0}^{1}  \cos( 2\pi x) \cos( 4\pi x) dx = 0 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%282pi*x%29%29%28cos%284pi*x%29%29+dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_1 \rangle = \langle b_0 , b_3 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_2 \rangle = \langle b_1 , b_3 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_3 \rangle = \langle b_2 , b_3 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_4 \rangle = \int_{0}^{1}  \cos( 3\pi x) \cos( 3\pi x) dx = .5 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%283pi*x%29%29%28cos%283pi*x%29%29+dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_4, b_5 \rangle = \int_{0}^{1}  \cos( 3\pi x) \cos( 4\pi x) dx = 0 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%283pi*x%29%29%28cos%284pi*x%29%29+dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_1 \rangle = \langle b_0 , b_4 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_2 \rangle = \langle b_1 , b_4 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_3 \rangle = \langle b_2 , b_4 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_4 \rangle = \langle b_3 , b_4 \rangle = 0 $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\langle b_5, b_5 \rangle = \int_{0}^{1}  \cos( 4\pi x) \cos( 4\pi x) dx = .5 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%284pi*x%29%29%28cos%284pi*x%29%29+dx+from+0+to+1
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+%28cos%284pi*x%29%29%28cos%284pi*x%29%29+dx+from+0+to+1

Part 1

 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & .5 & 0  \\ 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\Gamma^{-1} (\{ b_i \}) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & .5 & 0  \\ 0 & 0 & .5 \end{bmatrix} $$
 * }
 * }

Compute known components on rhs
 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix} d_1 \\ d_2  \\ d_3  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_i = \langle b_i, f \rangle = \int_{a}^{b} b_i f dx $$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_1 = \langle b_1, f \rangle = \int_{0}^{1} 1 \log(1+x) dx = 0.38629 $$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+log%281%2Bx%29dx+from+0+to+1
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ d_2 = \langle b_2, f \rangle = \int_{0}^{1} \cos(\pi x) \log(1+x) dx = -0.138078 $$
 * style="width:95%" |
 * style="width:95%" |
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+cos%28pi*x%29log%281%2Bx%29dx+from+0+to+1
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+cos%28pi*x%29log%281%2Bx%29dx+from+0+to+1


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

d_3 = \langle b_3, f \rangle = \int_{0}^{1} \cos(2\pi x) \log(1+x) dx =  -0.011779

$$
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+cos%282pi*x%29log%281%2Bx%29dx+from+0+to+1
 * }Verified at http://www.wolframalpha.com/input/?i=integrate+cos%282pi*x%29log%281%2Bx%29dx+from+0+to+1


 * {| style="width:100%" border="0"

$$ \mathbf d = \begin{bmatrix}  0.38629 \\  -0.138078  \\ -0.011779 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Recall that
 * {| style="width:100%" border="0"

$$ \mathbf c = \boldsymbol \Gamma^{-1} \mathbf d $$ Substituting in to solve for the unknowns:
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }
 * {| style="width:100%" border="0"

$$ \begin{bmatrix} c_1 \\ c_2 \\ c_3  \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0  \\ 0 & .5 & 0  \\ 0 & 0 & .5 \end{bmatrix}^{-1} \begin{bmatrix} 0.38629 \\  -0.138078  \\ -0.011779  \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

And so
 * {| style="width:100%" border="0"

$$ \begin{bmatrix} c_1 \\ c_2 \\ c_3 \end{bmatrix} = \begin{bmatrix} 0.38629 \\ -0.276156 \\ -0.023558 \end{bmatrix} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The approximation on the Fourier basis is:


 * {| style="width:100%" border="0"

$$ f(x) = e^x \approx c_1 b_1(x) + c_2 b_2(x) + c_3 b_3(x)
 * style="width:95%" |
 * style="width:95%" |

$$
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ = (0.38629)(1) + (-0.276156)(\cos(\pi x)) + (-0.023558)(\cos(2\pi x)) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }



Modal Equations and initial conditions

Modal Equation #1:
 * {| style="width:100%" border="0"

$$ y_1'' + \frac12 \, y_1' + 4 \, y_1 = 2log(t+1) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_1(0) = 1, \ y'_1(0) = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Modal Equation #2:
 * {| style="width:100%" border="0"

$$ y_2'' + 6 \, y_2' + 9 \, y_2 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_2(0) = 0, \ y'_2(0) = 1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Modal Equation 1
Solution for modal coordinate $$ y_1(t) $$ is the summation of

the homogeneous and particular solutions


 * {| style="width:100%" border="0"

$$ y_1(t) = y_{h1}(t) + y_{p1}(t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To find homogeneous solution we assume trial solution


 * {| style="width:100%" border="0"

$$ y_{h1}(t) = e^{\lambda_{1} t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

in which we retrieve the characteristic equation


 * {| style="width:100%" border="0"

$$ \lambda_1^2 + \frac12 \,\lambda_1 + 4 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

which generates the following complet-conjugate roots


 * {| style="width:100%" border="0"

$$ \lambda_{11} = -\frac14 + i \frac{3 \sqrt7}{4} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \lambda_{12} = -\frac14 - i \frac{3 \sqrt7}{4} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

to which the homogeneous solution then takes the form


 * {| style="width:100%" border="0"

$$ y_{h1}=e^{-\frac14 t}[C_{11}cos(\frac{3 \sqrt7}{4}t)+C_{12}sin(\frac{3 \sqrt7}{4}t)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The particular solution must satisfy the following L2-ODE-CC


 * {| style="width:100%" border="0"

$$ y_{p1}'' + \frac12 \, y_{p1}' + 4 \, y_{p1} = 2log(t+1) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Inputting the approximate solution obtained previously for the time dependent excitation

we retrieve.


 * {| style="width:100%" border="0"

$$ \begin{align} y_{p1}'' + \frac12 \, y_{p1}' + 4 \, y_{p1} = 2[(0.38629) + (-0.276156)(\cos(\pi t))\\ + (-0.023558)(\cos(2\pi t))] \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We now note that the excitation r(t) can be resolved as the linear combination of two independent excitations.

Therefore we can find two particular solutions $$ y_{p_1}, y_{p_2} $$ and using the sum rule

for particular solutions add together the two determined particular solutions to get the actual particular solution


 * {| style="width:100%" border="0"

$$ y_{p1}=y_{p11}+y_{p12}+y_{p13} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To determine the first particular solution y_{p11}  we look at the following L2-ODE-CC:


 * {| style="width:100%" border="0"

$$ y_{p11}'' + \frac12 \, y_{p11}' + 4 \, y_{p11} = 2[(0.38629)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Guessing a particular solution of the form


 * {| style="width:100%" border="0"

$$ y_{p11}= A $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore


 * {| style="width:100%" border="0"

$$ y_{p11}'= y_{p11}''= 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

plugging back into the ODE we get the relation


 * {| style="width:100%" border="0"

$$ 4A = 2[(0.38629)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore


 * {| style="width:100%" border="0"

$$ y_{p11} = A = 0.193145 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To determine the second particular solution y_{p12}  we look at the following L2-ODE-CC:


 * {| style="width:100%" border="0"

$$ y_{p12}'' + \frac12 \, y_{p12}' + 4 \, y_{p12} = 2(-0.276156)(\cos(\pi t)) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Guessing a particular solution of the form


 * {| style="width:100%" border="0"

$$ y_{p12}= Acos(\pi t)+Bsin(\pi t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where


 * {| style="width:100%" border="0"

$$ y_{p12}'= -A\pi sin(\pi t)+B\pi cos(\pi t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_{p12}''= -A\pi^2cos(\pi t)-B\pi^2sin(\pi t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

thus plugging into the ODE


 * {| style="width:100%" border="0"

$$ \begin{align} -A\pi^2cos(\pi t)-B\pi^2sin(\pi t) + \frac12(-A\pi sin(\pi t)+B\pi cos(\pi t))\\ + 4(Acos(\pi t)+Bsin(\pi t)) = 2(-0.276156)(\cos(\pi t)) \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

rearranging to be more digestible


 * {| style="width:100%" border="0"

$$ \begin{align} (-A\pi^2+4A+\frac12 B\pi)cos(\pi t) + (-B\pi^2+4B-\frac12 A\pi)sin(\pi t)\\ = 2(-0.276156)(\cos(\pi t)) \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore equating coefficients we uncover two equations


 * {| style="width:100%" border="0"

$$ -A\pi^2+4A+\frac12 B\pi= 2(-0.276156) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ -B\pi^2+4B-\frac12 A\pi =0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

solving the system of equations we recover that


 * {| style="width:100%" border="0"

$$ A = 0.087808 and B = -0.023499 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

thus our second particular solution becomes


 * {| style="width:100%" border="0"

$$ y_{p12}= 0.087808cos(\pi t)-0.023499sin(\pi t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To determine the third particular solution we look at the following ODE


 * {| style="width:100%" border="0"

$$ y_{p13}'' + \frac12 \, y_{p13}' + 4 \, y_{p13} = 2(-0.023558)\cos(2\pi t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Guessing a particular solution of the form


 * {| style="width:100%" border="0"

$$ y_{p13}= Acos(2\pi t)+Bsin(2\pi t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where


 * {| style="width:100%" border="0"

$$ y_{p12}'= -2A\pi sin(2\pi t)+2B\pi cos(2\pi t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_{p12}''= -4A\pi^2cos(2\pi t)-4B\pi^2sin(2\pi t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

thus plugging into the ODE


 * {| style="width:100%" border="0"

$$ \begin{align} -4A\pi^2cos(2\pi t)-4B\pi^2sin(2\pi t) + \frac12(-2A\pi sin(2\pi t)+2B\pi cos(2\pi t))\\ + 4(Acos(2\pi t)+Bsin(2\pi t)) = 2(-0.023558)\cos(2\pi t) \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

rearranging to be more digestible


 * {| style="width:100%" border="0"

$$ \begin{align} -4A\pi^2+4A+B\pi)cos(2\pi t) + (-4B\pi^2+4B-A\pi)sin(2\pi t)\\ = 2(-0.023558)\cos(2\pi t) \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore equating coefficients we uncover two equations


 * {| style="width:100%" border="0"

$$ -4A\pi^2+4A+B\pi= 2(-0.023558) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ -4B\pi^2+4B-A\pi =0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

solving the system of equations we recover that


 * {| style="width:100%" border="0"

$$ B = -0.00011668, A = 0.0013177 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

thus our third particular solution becomes


 * {| style="width:100%" border="0"

$$ y_{p13}= 0.0013177cos(2\pi t)-0.00011668sin(2\pi t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

the full particular solution is thus


 * {| style="width:100%" border="0"

$$ \begin{align} y_{p1}= 0.193145 + 0.087808cos(\pi t)-0.023499sin(\pi t)\\ + 0.0013177cos(2\pi t)-0.00011668sin(2\pi t) \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

checking if the particular solution satisfies the modal equation thus


 * {| style="width:100%" border="0"

$$ \begin{align} y_{p1}'' + \frac12 \, y_{p1}' + 4 \, y_{p1} = 2[(0.38629) + (-0.276156)(\cos(\pi t))\\ + (-0.023558)(\cos(2\pi t))] \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using Desmos plotting tool to check if the left side of equation matches the right side or given excitation.

https://www.desmos.com/calculator/4ibtz9ibwm



thus our solution becomes the sum of the homogeneous and particular solutions


 * {| style="width:100%" border="0"

$$ y_{1}= y_{h1}+y_{p11}+y_{p12}+y_{p13} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

which becomes


 * {| style="width:100%" border="0"

$$ \begin{align} y_{1} = e^{-\frac14 t}[C_{11}cos(\frac{3 \sqrt7}{4}t)+C_{12}sin(\frac{3 \sqrt7}{4}t)] + 0.193145\\ + 0.087808cos(\pi t)-0.023499sin(\pi t) + 0.0013177cos(2\pi t)-0.00011668sin(2\pi t) \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

now we must solve for the two unknown constants using the initial conditions of the problem.


 * {| style="width:100%" border="0"

$$ y_{1}(0)=1, y_{1}'(0)=0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore from y_{1}(0)=1


 * {| style="width:100%" border="0"

$$ C_{11} = 0.717729 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and for y_{1}'(0)=0


 * {| style="width:100%" border="0"

$$ C_{12} = 0.125988 C_{11}+0.0375734 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

therefore


 * {| style="width:100%" border="0"

$$ C_{12} = 0.127999 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and thus full solution


 * {| style="width:100%" border="0"

$$ \begin{align} y_{1} = e^{-\frac14 t}[0.717729cos(\frac{3 \sqrt7}{4}t)+0.127999sin(\frac{3 \sqrt7}{4}t)]\\ + 0.193145 + 0.087808cos(\pi t)-0.023499sin(\pi t) + 0.0013177cos(2\pi t)\\ -0.00011668sin(2\pi t) \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using Wolfram Alpha's graphical tool to check that the initial conditions are met:



and thus we see they are.

Modal Equation 2
Solution for the modal coordinate $$ y_{2} $$ is the summation of the homogeneous

and particular solutions however there is no excitation in this modal equation thus we declare the

particular solution to be zero and thus the solution to the modal coordinate is simply the homogeneous

solution.


 * {| style="width:100%" border="0"

$$ y_2(t) = y_{h2}(t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

To find homogeneous solution we assume trial solution


 * {| style="width:100%" border="0"

$$ y_{h2}(t) = e^{\lambda_{2} t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

in which we retrieve the characteristic equation


 * {| style="width:100%" border="0"

$$ \lambda_2^2 + 6 \,\lambda_2 + 9 = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and the eigenvalues retrieved come out to be


 * {| style="width:100%" border="0"

$$ \lambda_{1,2}=-3 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

since the eigenvalues recovered are a double real root the solution takes the form


 * {| style="width:100%" border="0"

$$ y_2=C_1e^{-3t}+C_2te^{-3t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and thus the modal velocity takes the form


 * {| style="width:100%" border="0"

$$ y_2=-3C_1e^{-3t}-3C_2te^{-3t}+C_2e^{-3t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

to find the undetermined coefficients we must satisfy the modal initial conditions


 * {| style="width:100%" border="0"

$$ y_2(0) = 0 \Rightarrow C_{1} = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y'_2(0) = 1 \Rightarrow -3 C_{1} + C_{2} = 1 \Rightarrow C_{2} = 1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and thus the modal displacement is


 * {| style="width:100%" border="0"

$$ y_2(t) = t e^{-3 t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Modal Displacements
We have obtained two modal displacement functions


 * {| style="width:100%" border="0"

$$ \begin{align} y_{1} = e^{-\frac14 t}[0.717729cos(\frac{3 \sqrt7}{4}t)+0.127999sin(\frac{3 \sqrt7}{4}t)] + 0.193145\\ + 0.087808cos(\pi t)-0.023499sin(\pi t) + 0.0013177cos(2\pi t)-0.00011668sin(2\pi t)\\ \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ y_2(t) = t e^{-3 t} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

plotting them together



The long term response for the second modal displacement decays to zero. However the first modal displacement decays to a non-zero value of around 0.193.

Complete Solution
We can now project the modal solutions back into the original coordinate system.


 * {| style="width:100%" border="0"

$$ \mathbf d(t) = \bar{\boldsymbol \Phi} \, \mathbf y(t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where


 * {| style="width:100%" border="0"

$$
 * style="width:95%" |
 * style="width:95%" |

\mathbf d(t)=\begin{bmatrix} \frac{1}{\sqrt{5}} & \sqrt{\frac{3}{10}} \\ \frac{1}{\sqrt{5}} \cdot \sqrt{6} & \sqrt{\frac{3}{10}} \cdot \frac{-4}{\sqrt{6}} \end{bmatrix} \begin{bmatrix} y_1 \\ y_2 \end{bmatrix}

$$
 * }
 * }


 * {| style="width:100%" border="0"

$$ \begin{align} d_{1} = \frac{1}{\sqrt{5}}e^{-\frac14 t}[0.717729cos(\frac{3 \sqrt7}{4}t)\\ +0.127999sin(\frac{3 \sqrt7}{4}t)] + 0.193145 + 0.087808cos(\pi t)-0.023499sin(\pi t) \\ + 0.0013177cos(2\pi t)-0.00011668sin(2\pi t) + \sqrt{\frac{3}{10}}t e^{-3 t} \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \begin{align} d_{2} = \frac{1}{\sqrt{5}} \cdot \sqrt{6}e^{-\frac14 t}[0.717729cos(\frac{3 \sqrt7}{4}t)\\ + 0.127999sin(\frac{3 \sqrt7}{4}t)] + 0.193145 + 0.087808cos(\pi t)-0.023499sin(\pi t)\\ + 0.0013177cos(2\pi t)-0.00011668sin(2\pi t) + \sqrt{\frac{3}{10}} \cdot \frac{-4}{\sqrt{6}}t e^{-3 t} \end{align} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

plotting these solutions



we see that as time goes to infinity both displacements approach around the same value, ~0.185

Problem Statement
Referring back to R4.6, in which the Fourier series expansions were found for the following

functions (Problem #11 and Problem #12, respectively):


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = x^2 \text{ with } (-1 < x < 1), p = 2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = 1 - \frac{x^2}{4} \text{ with } (-2 < x < 2), p = 4 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

1. Put the Fourier series of each of the above 2 functions in compact summation form so you can

code up these Fourier series in desmos, and you can vary the maximum number of terms to show

convergence.

2. Plot the original function and 3 truncated Fourier series with 3, 6, 9 (non-zero) terms.

Provide a plot with 50 (non-zero) terms, with zoomed-in view at the kinks.


 * Provide links to your desmos plots for verification.

Part 1
"Problem #11"

The following is the function given with period, p, equal to 2.


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = x^2 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

on the interval (-1 < x < 1).

The Fourier Series is defined, in general, as


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = a_0 + \sum_{n=1}^\infty [a_n \cos n \omega x + b_n \sin n \omega x] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The three coefficients are defined, in general as


 * {| Italic textstyle="width:100%" border="0"

$$ a_0 = \frac{1}{p} \int_{-l}^{l} f(x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ a_n = \frac{2}{p} \int_{-l}^{l} f(x) \cos(n \omega x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ b_n = \frac{2}{p} \int_{-l}^{l} f(x) \sin(n \omega x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in the values and function given yields the following results


 * {| Italic textstyle="width:100%" border="0"

$$ a_0 = \frac{1}{2} \int_{-1}^{1} x^{2} dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{1}{2} [\frac{1}{3} x^{3}]_{-1}^{1} = \frac{1}{3} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ a_n = \frac{2}{2} \int_{-1}^{1} x^{2} \cos(n \pi x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = [\frac{x^2}{n \pi} \sin(n \pi x)]_{-1}^{1} - \int_{-1}^{1} \frac{2x}{n \pi} \sin(n \pi x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = [\frac{x^2}{n \pi} \sin(n \pi x)]_{-1}^{1} + [\frac{2x}{n^2 \pi^2} cos(n \pi x)]_{-1}^{1} - \int_{-1}^{1} \frac{2}{n^3 \pi^3} \cos(n \pi x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = [\frac{x^2}{n \pi} \sin(n \pi x) + \frac{2x}{n^2 \pi^2} cos(n \pi x) - \frac{2}{n^3 \pi^3} \sin(n \pi x)]_{-1}^{1} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ \text{Since sine of any integer times } \pi \text{ equals zero, these terms can be omitted.} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = [\frac{2x}{n^2 \pi^2} \cos(n \pi x)]_{-1}^{1} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{2}{n^2 \pi^2} \cos(n \pi) + \frac{2}{n^2 \pi^2} \cos(-n \pi) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{4}{n^2 \pi^2} \cos(n \pi) = \frac{4}{n^2 \pi^2} (-1)^{n} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ b_n = \frac{2}{2} \int_{-1}^{1} x^{2} \sin(n \pi x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{-x^2}{n \pi} \cos(n \pi x) - \int_{-1}^{1} \frac{-2x}{n \pi} \cos(n \pi x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{-x^2}{n \pi} \cos(n \pi x) + \frac{2x}{\pi^2 n^2} \sin(n \pi x) - \int_{-1}^{1} \frac{-2x}{n^2 \pi^2} \sin(n \pi x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Putting these values into the Fourier Series equation and cancelling out terms that come out

to zero yields:


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = \frac{1}{3} + \sum_{n=1}^{\infty}[\frac{4}{n^2 \pi^2} (-1)^n \cos(n \pi x)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

"Problem #12"

The following is the function given with period, p, equal to 4.


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = 1 - \frac{x^2}{4} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

on the interval (-2 < x <2).

The Fourier Series is defined, in general, as


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = a_0 + \sum_{n=1}^\infty [a_n \cos n \omega x + b_n \sin n \omega x] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The three coefficients are defined, in general as


 * {| Italic textstyle="width:100%" border="0"

$$ a_0 = \frac{1}{p} \int_{-l}^{l} f(x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ a_n = \frac{2}{p} \int_{-l}^{l} f(x) \cos(n \omega x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ b_n = \frac{2}{p} \int_{-l}^{l} f(x) \sin(n \omega x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in the values and function given yields the following results


 * {| Italic textstyle="width:100%" border="0"

$$ a_0 = \frac{1}{4} \int_{-2}^{2} 1 - \frac{x^{2}}{4} dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{1}{4} [x - \frac{1}{12} x^{3}]_{-2}^{2} = \frac{2}{3} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ a_n = \frac{1}{2} \int_{-2}^{2} (1 - \frac{x^{2}}{4}) \cos(n \frac{\pi}{2} x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{-4}{n^2 \pi^2} sin(n \frac{\pi}{2} x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = \frac{-4}{n^2 \pi^2} (-1)^n $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$ b_n = \frac{1}{2} \int_{-2}^{2} (1 - \frac{x^{2}}{4}) \sin(n \frac{\pi}{2} x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| Italic textstyle="width:100%" border="0"

$$   = 0 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Putting these values into the Fourier Series equation and cancelling out terms that come out

to zero yields:


 * {| Italic textstyle="width:100%" border="0"

$$ f(x) = \frac{2}{3} + \sum_{n=1}^{\infty}[\frac{-4}{n^2 \pi^2} (-1)^n \cos(n \frac{\pi}{2} x)] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Part 2
"Problem 11 Plots"
 * The following graphs for the summation from Problem 11 were produced

by the following desmos plot (see link below).

https://www.desmos.com/calculator/wh2tk1t3cw

The original function:

Fourier series with 3 non-zero terms:



With 6 non-zero terms:



With 9 non-zero terms:



With 50 non-zero terms:



You can see from the previous plots that the Fourier series is an approximation and

so never truly equals the original equation, as seen by how the plots never come to

a true kink like the original equation. But, as the number of non-zero terms used in

the Fourier series summation increases, the approximation does get closer and closer

to the original function.

"Problem 12 Plots"
 * The following graphs for the summation from Problem 12 were produced

by the following desmos plot (see link below).

https://www.desmos.com/calculator/smqwzxj9sc

The original function:

With 3 non-zero terms:



With 6 non-zero terms:



With 9 non-zero terms:



With 50 non-zero terms:



Similar results can be seen from the plots of problem 12 compared to those from problem

11. It can be seen in the plots above that the Fourier series is an approximation and

so approaches the original equation, but never meets it, as seen by how the plots never

come to a true kink. But, as the number of non-zero terms used in the Fourier series

summation increases, the approximation varies by a lesser amount each time.

Problem Statement


1. Put each of the two Fourier series of each of the above 2 functions in compact summation form

so you can code up these Fourier series in desmos, and you can vary the maximum number of terms

to show convergence.

2. Plot the original function and 3 truncated Fourier series with 3, 6, 9 (non-zero) terms.

Provide a plot with 50 (non-zero) terms, with zoomed-in view at the kinks.


 * Provide links to your desmos plots/animations for verification

Problem 26 Part A
The general form of Fourier cosine series is given as


 * {| style="width:100%" border="0"

$$ f(x) = a_0 + \sum_{n=1}^\infty a_n \cos \frac{\pi n}{L} x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where


 * {| style="width:100%" border="0"

$$ \pi = L $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and


 * {| style="width:100%" border="0"

$$ a_0 = \frac{1}{L} \int_{0}^{L} f(x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ a_n = \frac{2}{L} \int_{0}^{L} f(x) \cos n x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

From the graph for problem 26


 * {| style="width:100%" border="0"

$$ f(x) = x \text{ from }  0 < x < \frac{\pi}{2}  \text{ and }  \frac{\pi}{2} \text{ from } \frac{\pi}{2} < x <\pi $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values for f(x) and integrating.


 * {| style="width:100%" border="0"

$$ a_0 = \frac{1}{\pi} \int_{0}^{\pi/2} x dx + \frac{1}{\pi} \int_{\pi/2}^{\pi} \frac{\pi}{2} dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Evaluating over intervals.


 * {| style="width:100%" border="0"

$$ a_0 = \frac{1}{\pi} \left[\frac{1}{2}x^2 \right ]_{0}^{\frac{\pi}{2}} + \frac{1}{\pi} \left[\frac{\pi}{2}x \right ]_{\frac{\pi}{2}}^{\pi} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ a_0 = \frac{1}{\pi} \left[\frac{\pi^2}{8} + \frac{\pi^2}{4} \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ a_0 = \frac{3}{8}\pi $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values of f(x) to find a_n.


 * {| style="width:100%" border="0"

$$ a_n = \frac{2}{\pi} \int_{0}^{\pi/2} x\cos nx dx + \frac{2}{\pi} \int_{\pi/2}^{\pi} \frac{\pi}{2}\cos nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Integrating the second expression of a_n.


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \int_{\pi/2}^{\pi} \frac{\pi}{2}\cos nx dx = \frac{2}{\pi} \left[\frac{\pi}{2n}\sin nx \right ]_{\frac{\pi}{2}}^{\pi} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[\frac{\pi}{2n}\sin nx \right ]_{\frac{\pi}{2}}^{\pi} = \left[\frac{1}{n}\sin \pi n - \frac{1}{n}\sin \frac{\pi}{2} n \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Integration of the first expression of a_n was performed using integration by parts


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \int_{0}^{\pi/2} x\cos nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Following the form


 * {| style="width:100%" border="0"

$$ uv - \int vdu $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using the form mentioned above we were given the expression


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[\frac{x}{n}\sin nx \right ]_{0}^{\frac{\pi}{2}} - \frac{2}{\pi} \int_{0}^{\pi/2} \frac{1}{n}\sin nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Yielding


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[\frac{x}{n}\sin nx \right ]_{0}^{\frac{\pi}{2}} - \frac{2}{\pi} \left[\frac{-1}{n^2}\cos nx \right ]_{0}^{\frac{\pi}{2}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ = \left[\frac{1}{n}\sin \frac{\pi}{2} n - \frac{1}{n}\sin 0n + \frac{2}{\pi n^2}\cos \frac{\pi}{2} n - \frac{2}{\pi n^2}\cos 0n \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Summing all the a_n terms together we have


 * {| style="width:100%" border="0"

$$ a_n = \left[\frac{1}{n}\sin \frac{\pi}{2} n - \frac{1}{n}\sin 0n + \frac{2}{\pi n^2}\cos \frac{\pi}{2} n - \frac{2}{\pi n^2}\cos 0n + \frac{1}{n}\sin \pi n - \frac{1}{n}\sin \frac{\pi}{2} n \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

which reduces down to


 * {| style="width:100%" border="0"

$$ a_n = -\frac{2(-1)^{n+1}}{\pi n^2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Recall the general form of the Fourier cosine series


 * {| style="width:100%" border="0"

$$ f(x) = a_0 + \sum_{n=1}^\infty a_n \cos \frac{\pi n}{L} x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values for a_0 and a_n we receive the Fourier cosine series in compact summation form.


 * {| style="width:100%" border="0"

$$ f(x) = \frac{3}{8}\pi + \sum_{n=1}^\infty -\frac{2(-1)^{n+1}}{\pi n^2} \cos n x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Below are plots of the Fourier series calculated and the original function.

The original function



A plot of the series with 3 terms.



A plot of the series with 6 terms.



A plot of the series with 9 terms.



A plot of the series with 50 terms.



A zoomed in view of the kinks in the 50 term plot.



All plots can be found were created on the following link.

https://www.desmos.com/calculator/mwpl6n3wmg

Problem 26 Part B
The general form of Fourier sine series is given as


 * {| style="width:100%" border="0"

$$ f(x) = \sum_{n=1}^\infty b_n \sin \frac{\pi n}{L} x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where


 * {| style="width:100%" border="0"

$$ \pi = L $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and


 * {| style="width:100%" border="0"

$$ b_n = \frac{2}{L} \int_{0}^{L} f(x) \sin nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

From the graph for problem 26


 * {| style="width:100%" border="0"

$$ f(x) = x \text{ from }  0 < x < \frac{\pi}{2}  \text{ and }  \frac{\pi}{2} \text{ from } \frac{\pi}{2} < x <\pi $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values for f(x) and integrating.


 * {| style="width:100%" border="0"

$$ b_n = \frac{2}{\pi} \int_{0}^{\pi/2} x \sin nx dx + \frac{2}{\pi} \int_{\pi/2}^{\pi} \frac{\pi}{2} \sin nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Integrating the second expression of b_n.


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \int_{\pi/2}^{\pi} \frac{\pi}{2} \sin nx dx = \frac{2}{\pi} \left[\frac{-\pi}{2n}\cos nx \right ]_{\frac{\pi}{2}}^{\pi} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[\frac{-\pi}{2n}\cos nx \right ]_{\frac{\pi}{2}}^{\pi} = \left[\frac{-1}{n}\cos \pi n + \frac{1}{n}\cos \frac{\pi}{2} n \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Integration of the first expression of b_n was performed using integration by parts


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \int_{0}^{\pi/2} x \sin nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Following the form


 * {| style="width:100%" border="0"

$$ uv - \int vdu $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using the form mentioned above we were given the expression


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[\frac{-x}{n}\cos nx \right ]_{0}^{\frac{\pi}{2}} - \frac{2}{\pi} \int_{0}^{\pi/2} \frac{-1}{n}\cos nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Yielding


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[\frac{-x}{n}\cos nx \right ]_{0}^{\frac{\pi}{2}} + \frac{2}{\pi} \left[\frac{1}{n^2}\sin nx \right ]_{0}^{\frac{\pi}{2}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ = \left[\frac{-1}{n}\cos \frac{\pi}{2} n + \frac{-1}{n}\cos 0n + \frac{2}{\pi n^2}\sin \frac{\pi}{2} n - \frac{2}{\pi n^2}\sin 0n \right ] $$ Summing all the b_n terms together we have
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ b_n = \left[\frac{-1}{n}\cos \frac{\pi}{2} n + \frac{-1}{n}\cos 0n + \frac{2}{\pi n^2}\sin \frac{\pi}{2} n - \frac{2}{\pi n^2}\sin 0n - \frac{1}{n}\cos \pi n + \frac{1}{n}\cos \frac{\pi}{2} n \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

which reduces down to


 * {| style="width:100%" border="0"

$$ b_n = \frac{2}{\pi n^2} - \frac{(-1)^n}{n} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Recall the general form of the Fourier sine series


 * {| style="width:100%" border="0"

$$ f(x) = \sum_{n=1}^\infty b_n \sin \frac{\pi n}{L} x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values for b_n we receive the Fourier sine series in compact summation form.


 * {| style="width:100%" border="0"

$$ f(x) = \sum_{n=1}^\infty \left(\frac{2}{\pi n^2} - \frac{(-1)^n}{n} \right ) \sin n x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Below are plots of the Fourier series calculated and the original function.

The original function



A plot of the series with 3 terms.



A plot of the series with 6 terms.



A plot of the series with 9 terms.



A plot of the series with 50 terms.



A zoomed in view of the kinks in the 50 term plot.



All plots can be found were created on the following link.

https://www.desmos.com/calculator/kq2aw2t62a

Problem 27 Part A
The general form of Fourier cosine series is given as


 * {| style="width:100%" border="0"

$$ f(x) = a_0 + \sum_{n=1}^\infty a_n \cos \frac{\pi n}{L} x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where


 * {| style="width:100%" border="0"

$$ \pi = L $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and


 * {| style="width:100%" border="0"

$$ a_0 = \frac{1}{L} \int_{0}^{L} f(x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ a_n = \frac{2}{L} \int_{0}^{L} f(x) \cos n x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

From the graph for problem 26


 * {| style="width:100%" border="0"

$$ f(x) = \frac{\pi}{2} \text{ from }  0 < x < \frac{\pi}{2}  \text{ and }  (\pi - x) \text{ from } \frac{\pi}{2} < x <\pi $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values for f(x) and integrating.


 * {| style="width:100%" border="0"

$$ a_0 = \frac{1}{\pi} \int_{0}^{\pi/2} \frac{\pi}{2} dx + \frac{1}{\pi} \int_{\pi/2}^{\pi} (\pi - x) dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Evaluating over intervals.


 * {| style="width:100%" border="0"

$$ a_0 = \frac{1}{\pi} \left[\frac{\pi}{2}x \right ]_{0}^{\frac{\pi}{2}} + \frac{1}{\pi} \left[\pi x -\frac{1}{2}x^2 \right ]_{\frac{\pi}{2}}^{\pi} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ a_0 = \frac{1}{\pi} \left[\frac{\pi^2}{4} \right ] + \frac{1}{\pi} \left[\frac{\pi^2}{8}  \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ a_0 = \frac{3}{8}\pi $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values of f(x) to find a_n.


 * {| style="width:100%" border="0"

$$ a_n = \frac{2}{\pi} \int_{0}^{\pi/2} \frac{\pi}{2} \cos nx dx + \frac{2}{\pi} \int_{\pi/2}^{\pi} (\pi - x)\cos nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Integrating the first expression of a_n.


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \int_{0}^{\pi/2} \frac{\pi}{2} \cos nx dx = \frac{2}{\pi} \left[\frac{\pi}{2n}\sin nx \right ]_{0}^{\frac{\pi}{2}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[\frac{\pi}{2n}\sin nx \right ]_{0}^{\frac{\pi}{2}} = \left[\frac{1}{n}\sin \frac{\pi}{2} n - \frac{1}{n}\sin 0n \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Integration of the second expression of a_n was performed using integration by parts


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \int_{\pi/2}^{\pi} (\pi - x)\cos nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Following the form


 * {| style="width:100%" border="0"

$$ uv - \int vdu $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using the form mentioned above we were given the expression


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[(\pi-x)\frac{1}{n}\sin nx \right ]_{\frac{\pi}{2}}^{\pi} - \frac{2}{\pi} \int_{\frac{\pi}{2}}^{\pi} \frac{-1}{n}\sin nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Yielding


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[(\pi-x)\frac{1}{n}\sin nx \right ]_{\frac{\pi}{2}}^{\pi} - \frac{2}{\pi} \left[\frac{1}{n^2}\cos nx \right ]_{\frac{\pi}{2}}^{\pi} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ = \left[(\pi - \pi) \frac{1}{n}\sin \pi n - (\pi - \frac{\pi}{2})\frac{1}{n}\sin \frac{\pi}{2} n - \frac{2}{n^2 \pi}\cos \pi n + \frac{2}{n^2 \pi}\cos \frac{\pi}{2} n \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Summing all the a_n terms together we have


 * {| style="width:100%" border="0"

$$ a_n = \left[\frac{1}{n}\sin \frac{\pi}{2} n - \frac{1}{n}\sin 0n + \frac{1}{n}\sin \pi n - \frac{1}{n}\sin \frac{\pi}{2} n - \frac{2}{n^2 \pi}\cos \pi n + \frac{2}{n^2 \pi}\cos \frac{\pi}{2} n  \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

which reduces down to


 * {| style="width:100%" border="0"

$$ a_n = -\frac{2(-1)^n}{\pi n^2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Recall the general form of the Fourier cosine series


 * {| style="width:100%" border="0"

$$ f(x) = a_0 + \sum_{n=1}^\infty a_n \cos \frac{\pi n}{L} x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values for a_0 and a_n we receive the Fourier cosine series in compact summation form.


 * {| style="width:100%" border="0"

$$ f(x) = \frac{3}{8}\pi + \sum_{n=1}^\infty -\frac{2(-1)^n}{\pi n^2} \cos n x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Below are plots of the Fourier series calculated and the original function.

The original function



A plot of the series with 3 terms.



A plot of the series with 6 terms.



A plot of the series with 9 terms.



A plot of the series with 50 terms.



A zoomed in view of the kinks in the 50 term plot.



All plots can be found were created on the following link.

https://www.desmos.com/calculator/qpccvbk9x6

Problem 27 Part B
The general form of Fourier sine series is given as


 * {| style="width:100%" border="0"

$$ f(x) = \sum_{n=1}^\infty b_n \sin \frac{\pi n}{L} x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where


 * {| style="width:100%" border="0"

$$ \pi = L $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

and


 * {| style="width:100%" border="0"

$$ b_n = \frac{2}{L} \int_{0}^{L} f(x) \sin nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

From the graph for problem 26


 * {| style="width:100%" border="0"

$$ f(x) = \frac{\pi}{2} \text{ from }  0 < x < \frac{\pi}{2}  \text{ and }  (\pi - x) \text{ from } \frac{\pi}{2} < x <\pi $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values for f(x) and integrating.


 * {| style="width:100%" border="0"

$$ b_n = \frac{2}{\pi} \int_{0}^{\pi/2} \frac{\pi}{2} \sin nx dx + \frac{2}{\pi} \int_{\pi/2}^{\pi} (\pi - x) \sin nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Integrating the first expression of b_n.


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \int_{0}^{\pi/2} \frac{\pi}{2} \sin nx dx = \frac{2}{\pi} \left[\frac{-\pi}{2n}\cos nx \right ]_{0}^{\frac{\pi}{2}} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[\frac{-\pi}{2n}\cos nx \right ]_{0}^{\frac{\pi}{2}} = \left[\frac{-1}{n}\cos \frac{\pi}{2} n + \frac{1}{n}\cos 0n \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Integration of the second expression of b_n was performed using integration by parts


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \int_{\pi/2}^{\pi} (\pi -x) \sin nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Following the form


 * {| style="width:100%" border="0"

$$ uv - \int vdu $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Using the form mentioned above we were given the expression


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[(\pi - x) \frac{-1}{n}\cos nx \right ]_{\frac{\pi}{2}}^{\pi} - \frac{2}{\pi} \int_{\pi/2}^{\pi} \frac{1}{n}\cos nx dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Yielding


 * {| style="width:100%" border="0"

$$ \frac{2}{\pi} \left[(\pi - x) \frac{-1}{n}\cos nx \right ]_{\frac{\pi}{2}}^{\pi} - \frac{2}{\pi} \left[\frac{1}{n^2}\sin nx \right ]_{\frac{\pi}{2}}^{\pi} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * {| style="width:100%" border="0"
 * {| style="width:100%" border="0"

$$ = \left[0 - \frac{1}{n^2}\sin \pi n + \frac{1}{n^2}\sin \frac{\pi}{2} n \right ] $$ Summing all the b_n terms together we have
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ b_n = \left[\frac{-1}{n}\cos \frac{\pi}{2} n + \frac{1}{n}\cos 0n - \frac{1}{n^2}\sin \pi n + \frac{1}{n^2}\sin \frac{\pi}{2} n \right ] $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

which reduces down to


 * {| style="width:100%" border="0"

$$ b_n = \frac{2}{\pi n^2} + \frac{1}{n} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Recall the general form of the Fourier sine series


 * {| style="width:100%" border="0"

$$ f(x) = \sum_{n=1}^\infty b_n \sin \frac{\pi n}{L} x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Plugging in values for b_n we receive the Fourier sine series in compact summation form.


 * {| style="width:100%" border="0"

$$ f(x) = \sum_{n=1}^\infty \left(\frac{2}{\pi n^2} + \frac{(1)^n}{n} \right ) \sin n x dx $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Below are plots of the Fourier series calculated and the original function.

The original function



A plot of the series with 3 terms.



A plot of the series with 6 terms.



A plot of the series with 9 terms.



A plot of the series with 50 terms.



A zoomed in view of the kinks in the 50 term plot.



All plots can be found were created on the following link.

https://www.desmos.com/calculator/2stapk3fqp

Problem Statement
In all questions below, provide screenshots of everything you did as in my lecture notes.

1. install Audacity, and follow my lecture notes sec.25d to set up your computer to record audio

signals from the sound card.

2. pure tones (sine waves). go to the Berkeley music scale site (course EECS 20N, Signals and

systems). in my lecture notes sec.25d, i recorded the pure tone of the note A4 = A440 from this

site, and provided a detailed explanation on the resulting FFT spectrum, both in graphical format

and in numerical format in a spreadsheet. i also explain the A Major triad mentioned in this web

page. this web page uses Java, so you may need to add the Berkeley site URL

(http://ptolemy.eecs.berkeley.edu) as a safe site in your Java Control Panel; follow my directions in

Manual: Java update in firefox and chrome.

record the pure tone of note E5 from the Berkeley music scale site, and do an FFT analysis to verify

the fundamental frequency as done in sec.25d.

generate the pure tone using sine wave for E5 in Audacity, do FFT analysis, and compare to the FFT

spectrum obtained from the sound of E5 from the Berkeley music scale site.

calibrate your spreadsheet formula for music note detection: download the FFT spectrum in numerical

format into a spreadsheet to detect the note using your spreadsheet formulas, which should work by

row, and not by column.

3. real piano tone.

real A4 sound from a Kawai piano (vibrationdata.com). record this sound in Audacity, run FFT

analysis, export FFT spectrum in numerical format into a spreadsheet to detect the relevant frequency

components (peaks) and music notes up to C#7.

compare the results to those for the FFT spectrum of the A4 note generated by a music software; in

particular, comment on the amount of inharmonicity, and thus the quality of the software sound.

4. triads of pure tones.

4.1. find the Fourier series for the A Major triad (A4, C#5, E5) of pure tones (sine waves) in the

Berkeley music scale site, i.e., put the following sum of 3 sine functions with fundamental

frequencies of the A4, C#5, E5 notes into Fourier series format and identify the music note of the

fundamental frequency.

the frequency of the pure tone A4 is exactly 440 Hz; at this site, the pure tones for C#5 and E5 are

at frequencies 554 Hz and 659 Hz, respectively.


 * {| style="width:100%" border="0"

$$ f_{A4} = 440 \text{ Hz}, \ f_{C\#5} = 554 \text{ Hz} , \ f_{E5} = 659 \text{ Hz}$$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

comparing the last 2 frequencies to the spreadsheet in R4.7, you see that they are not exactly on

the 12-Tone Equal Termpered scale (12-TET), but rounded up.

the A Major triad with the 3 pure tones A4, C#5, E5 can then be expressed as a sum of 3 sine

functions


 * {| style="width:100%" border="0"

$$ s(t) = \sin(2 \pi f_{A4} \, t) + \sin (2 \pi f_{C\#5} \, t) + \sin (2 \pi f_{E5} \, t)$$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

use the GNU Octave / matlab gcd command (Greatest Common Divisor) to find the fundamental frequency

for the 3 frequencies of the above A4, C#5, C5 pure tones, such that


 * {| style="width:100%" border="0"

$$ f_{A4} = n_{A4} f_1, \ f_{C\#5} = n_{C\#5} f_1 , \ f_{E5} = n_{E5} f_1$$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

where


 * {| style="width:100%" border="0"

$$ n_{A4}, \ n_{C\#5} ,\ n_{E5}$$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

are all integers.

4.2. record the audio signal for the A Major triad (A4, C#5, E5) of pure tones (sine waves) in the

Berkeley music scale site, run FFT analysis, and use only the FFT graphical user interface of

Audacity to detect and confirm the frequencies of A4, C#5, E5. provide screenshots of your work as

in my lecture notes.

5. piano-chord detection.

record the audio signal and run FFT to detect the music notes in the 2nd chord of this piano

classical music piece.

provide FFT spectrum in both graphical format (use smallest FFT size of 16384 for quick analysis,

screenshots) and numerical format (use largest FFT size of 65536 for accurate analysis, spreadsheet

with precise music note detection). comment on the inharmonicity of the strings of this piano.

see my lecture notes for the use of the smallest and largest FFT size.

from the Audacity Preferences page, you can read :

FFT Size - The size of the Fast Fourier Transform (FFT) affects how much vertical (frequency) detail

you see. Larger FFT sizes give you more bass resolution and less temporal (timing) resolution, and

they are slower.

list in a table the frequency components within 20 dB from the peak; you can copy and paste from your

spreadsheet with music note detection (see my lecture notes).

select the 6 or 7 most plausible notes in the chord, following the rules of thumb in my lecture

notes.

below are some tools you can use to find out which notes are in a chord. recall from my lecture

notes sec.25e that the C minor chord (C, D#, G) is used to describe sad events, and is used in the

first chord of this piano classical music piece.

you could use Musical Chords and Scales to help identify whether to use a note as it may form a

chord with other notes. for example, you may wonder which note may go with C and G, just type in

the box “c g” to see that C major (Cmaj) is formed with C, E, G, while C minor (Cm) is formed

with C, D#, G, etc.

you could also use the Interactive Piano Chord Visualizer to see the notes in a chord, say with root

C, and hear these chords. you can hear the C minor chord; try to record and analyze the sound of

the C minor chord with Audacity to confirm the notes, and observe the overtones (or harmonics).

read more from wikipedia about major chord and minor chord; chords are combinations of a root note

(e.g., A note in the A major chord, or C note in the C minor chord) and different overtones (or

harmonics, e.g, C# and E in the A major chord, or D# and G in the C minor chord) that sound good

together.

Solution
This problem requires the use of a spreadsheet to be able to take the FFT analysis from Audacity and report the notes that are being played. Every frequency within the top 20 dB of the FFT analysis is being considered, as everything under the 20 dB limit is noise.

The spreadsheet written in Excel works with seven columns: Column A: Frequency (Hz), Column B: Level (dB), Column C: "status," Column D: no. of keys from A0, Column E: octave key no., Column F: note name, and Column G: octave no. The Frequency and Level columns come from Audacity. The data in the "status" column comes from the formula

IF(B2<MAX(B:B)-20,"noise",IF(B2=MAX(B:B),"maximum",IF(AND(MAX(B:B)-20<B2,B2<MAX(B:B))=TRUE,"not noise")))

In this case, "B2" is the value in row 2 of Column B (Level (dB)), but the row number is whatever row being considered. The "status" column decides whether the frequency is noise or not. The first case is if the value in column B is less than the peak minus 20 dB, which would make it noise. The second case is if the value in column B is the peak, which would make it the maximum value. The third case decides if the value in column B is between the noise limit and the peak, which would give it a status of "not noise." A filter is added on Column C to let of the values that aren't noise be considered. The data in Column D comes from the formula

12*LN(A2/27.5)/LN(2)

In this case, "A2" is the value in row 2 of Column A (Frequency (Hz)), but the row number is whatever row being considered. The formula for Column D comes from the equation for frequency given the number of keys from A0. Column D just works in reverse. The data in Column E comes from the formula

MOD(ROUND(D2,0),12)+1

In this case, as before, "D2" is the respective value in Column D, with the row number dependent on the row being considered. This formula first rounds the value in Column D to 0 decimal places, then takes the remainder of dividing the rounded number by 12, and adds one. For example, if the value in cell D24 was 14.05, the rounded value would be 14. Dividing 14 by 12 gives a remainder of 2, and adding 1 gives a value in cell E24 of 3. In other words, the key that gave the frequency and level in cells A24 and B24, respectively, is located 3 keys away from A0. Columns F and G will automatically take the values in Column E and, together, give the note name and octave number.

The formula for Column F is a series of nested if statements that decide what note is being played: a value of 1 in Column E will give a value of "A" in Column F, a value of 2 in E will give a value of "A#/B♭" in F, and so on, up to a value of 11 in E giving a value of "G#/A♭" in F. The data in Column G comes from the formula

IF(E2<4,QUOTIENT(ROUND(D2,0),12),QUOTIENT(ROUND(D2,0),12)+1)

Again, E2 and D2 are the respective values in columns E and D for the row being considered. The formula takes into account the fact that the octave numbering doesn't start at A; it starts at C, the fourth note from A. The QUOTIENT function does the opposite of the MOD function: instead of taking the remainder, it takes the integer part of dividing the rounded value in Column D by 12. Using the same example as before, the value in cell D24 is 14.05 and the value in cell E24 is 3. Because E24<4, the IF statement in Column G reports TRUE, and the first case in the formula is considered. Because the integer portion of dividing 14 by 12 is 1, the octave number is 1. In fact, the note in this particular row is B1. For values in E greater than 4, the note is above C, so 1 is added to the value from the QUOTIENT function.

With the formulas set up, the spreadsheet is ready to use.

E5 Berkeley/Wolfram
Because the applet on the Berkeley website wasn't working, due to a Java incompatibility, an equivalent applet from Wolfram was used.

The below picture is the Wolfram applet. Clicking the right note makes the applet play the requested noise. We want note E5, which is marked in the image.



Once we have the right pitch being played, we want to record the pitch in Audacity so we can do the FFT.



We run the "Plot Spectrum" command in Audacity, as shown below.



And, after choosing the right plot size and logarithmic axes, this is the graph we get.



Hovering the cursor near the peak of the graph shows that the peak is note E5.



We want to export the data, so we click on the "Export" button and save the resulting .txt file...



And this is the file we get. The amount of rows of data is half of the size of the plot. Because the size was 16384, there are 8192 rows of data in the .txt file.



To analyze the data, it is pasted into the Excel spreadsheet previously described.



Because we don't want the noise, we use the filter placed on Column C to hide all of the rows that are below the peak level minus 20 dB...



And the remaining three rows are the maximum and two immediately surrounding rows. All three rows are E5, which is what we expected.



E5 Audacity
Audacity has a function that can generate a tone at a given frequency.



From the spreadsheet in R4.7, the Berkeley applet, and the Wolfram applet, we know that the frequency of E5 is 659 Hz, which is inputted in the Tone Generator window...



Which generates this spectrum.



We run the "Plot Spectrum" command in Audacity, as shown below.



And, after choosing the right plot size and logarithmic axes, this is the graph we get.



Hovering the cursor near the peak of the graph shows that the peak is note E5.



We want to export the data, so we click on the "Export" button and save the resulting .txt file...



And this is the file we get. The amount of rows of data is half of the size of the plot. Because the size was 16384, there are 8192 rows of data in the .txt file.



To analyze the data, it is pasted into the Excel spreadsheet previously described.



Because we don't want the noise, we use the filter placed on Column C to hide all of the rows that are below the peak level minus 20 dB...



And the remaining three rows are the maximum and two immediately surrounding rows. All three rows are E5, which is what we expected.



Problem 3: A4 From Piano
Now we want to do the same FFT analysis on a tone from an actual piano, and not from a computer generated sine function.

First, we need to record the piano tone in Audacity.



The desired portion of the spectrum is selected...



The Plot Spectrum command is run...



And this is the spectrum that we get. The four highest frequencies to the right of the peak frequency are labeled. Due to the harmonics of the piano strings, when the A4 key is pressed, the sound heard is not a pure A4 tone. There is some amount of other notes that can be noticed by a computer. The notes that have been labeled (A4, A5, E6, A6, and C#7), are all notes in the A Major triad. When a piece of music software, such as Sibelius or Finale, tries to emulate a piano being played, it will simulate a plot spectrum similar to the one below.



As before, we export the data to a .txt file...



And this is the file that we get.



Pasting into the spreadsheet...



Filtering out the noise...



And this is the data that we are left with. Because the sound that was recorded was from an actual piano, and not a computer generated sine wave, the remaining data is more complex, due to the harmonics of the piano strings. Four of the data rows, including the maximum, are for A4...



Three of the rows are for A5...



Two are for E6...



And two are for A6.



The four remaining notes in the spreadsheet are the four highest peaks in the plot spectrum as labeled above. If the spreadsheet considered a wider range of levels, then the next note in the spreadsheet would be C#7, rounding out the notes in the A Major triad.

Problem 4.1: Fourier Series of A Major Triad
From the problem statement, we know that the frequencies of A4, C#5, and E5 are


 * {| style="width:100%" border="0"

$$ f_{A4} = 440 \text{ Hz}, \ f_{C\#5} = 554 \text{ Hz} , \ f_{E5} = 659 \text{ Hz} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

We also know that the function that represents a chord is the sum of the sine functions of its notes. So, the function for the A Major triad is


 * {| style="width:100%" border="0"

$$ s(t) = \sin(2 \pi f_{A4} \, t) + \sin (2 \pi f_{C\#5} \, t) + \sin (2 \pi f_{E5} \, t) $$ (1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

The frequencies of each note can be rewritten as


 * {| style="width:100%" border="0"

$$ f_{A4} = n_{A4} f_1, \ f_{C\#5} = n_{C\#5} f_1 , \ f_{E5} = n_{E5} f_1 $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Where


 * {| style="width:100%" border="0"

$$ n_{A4}, \ n_{C\#5} ,\ n_{E5} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

Are all integers and $$f_1$$ is the fundamental frequency of the A Major triad. $$f_1$$ is the greatest common divisor of the frequencies we're interested in. However, 659 is a prime number, so the greatest common divisor of 440, 554, and 659 is 1. So, for this problem, we will be using an approximation as described below.

A major triad is made up of a root and two notes: one a perfect fifth above the root and another a major third above the root. A perfect fifth is made up of seven semitones and a major third is made up of four semitones. In other words, on a piano keyboard, if the root has a key number $$n$$, the other note in the perfect fifth will have a key number $$n+7$$ and the other note in the major third will have a key number $$n+4$$.

On a piano, the frequency of a note located $$n-1$$ keys from A0 is


 * {| style="width:100%" border="0"

$$ f_{n-1}=f_{A0} \left( \sqrt[12]{2} \right) ^{n-1} $$     (2)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

where $$f_{A0}$$ is the frequency of A0. It follows that the note that will make a perfect fifth has the frequency


 * {| style="width:100%" border="0"

$$ f_{P5}=f_{A0} \left( \sqrt[12]{2} \right) ^{n+7-1}=f_{A0} \left( \sqrt[12]{2} \right) ^{n+6} $$     (3)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

And the note that makes a major third has the frequency


 * {| style="width:100%" border="0"

$$ f_{M3}=f_{A0} \left( \sqrt[12]{2} \right) ^{n+4-1}=f_{A0} \left( \sqrt[12]{2} \right) ^{n+3} $$     (4)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

If we wanted to know the factor between the two notes in a perfect fifth, we would have to divide (3) by (2).


 * {| style="width:100%" border="0"

$$ \frac{\cancel{f_{A0}} \left( \sqrt[12]{2} \right) ^{n+6}}{\cancel{f_{A0}} \left( \sqrt[12]{2} \right) ^{n-1}}= \frac{ \cancel{ \left(\sqrt[12]{2} \right) ^n } \left( \sqrt[12]{2} \right) ^6}{\cancel{\left(\sqrt[12]{2}\right)^n} \left(\sqrt[12]{2}\right)^{-1}}= \left(\sqrt[12]{2}\right)^7=1.4983... \approx \frac{3}{2} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

So, the frequencies between the two notes in a perfect fifth is about 3/2. We can do a similar operation with (4) and (2).


 * {| style="width:100%" border="0"

$$ \frac{\cancel{f_{A0}} \left( \sqrt[12]{2} \right) ^{n+3}}{\cancel{f_{A0}} \left( \sqrt[12]{2} \right) ^{n-1}}= \frac{ \cancel{ \left(\sqrt[12]{2} \right) ^n } \left( \sqrt[12]{2} \right) ^3}{\cancel{\left(\sqrt[12]{2}\right)^n} \left(\sqrt[12]{2}\right)^{-1}}= \left(\sqrt[12]{2}\right)^4=1.2599... \approx \frac{5}{4} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

So, the frequencies between the two notes in a major third is about 5/4.

Using this approximation, (1) can be rewritten and simplified.


 * {| style="width:100%" border="0"

$$ s(t) = \sin(2 \pi * 440 \, t) + \sin (2 \pi * 440 * \frac{5}{4} \, t) + \sin (2 \pi * 440 * \frac{3}{2} \, t) $$ (1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ s(t) = \sin\left(440\pi*t\left(\frac{2}{1}\right)\right) + \sin\left(440\pi*t\left(\frac{5}{2}\right)\right) + \sin\left(440\pi*t\left(\frac{9}{3}\right)\right) $$     (1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ s(t) = \sum_{n=1}^3 \sin\left(\cancelto{220}{440}\pi*t\left(\frac{\cancel{n}(n+3)}{\cancel{2}\cancel{n}}\right)\right) = \sum_{n=1}^3 \sin\left(220\pi*t\left(n+3\right)\right) $$     (1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ s(t) = \sum_{n=4}^6 \sin\left(220\pi n t\right) $$     (5)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

(5) is the Fourier series of the A Major triad using the above approximation. The fundamental frequency is 110 Hz, which is the same frequency as A2.

Note
If we wanted the exact Fourier series of the A Major triad, we would use the exact frequency differences for a Perfect Fifth and Major Third:


 * {| style="width:100%" border="0"

$$ f_{A4}=440 \text{ Hz}, f_{C\#5}=\left(\sqrt[12]{2}\right)^4 440 \text{ Hz} , f_{E5}=\left(\sqrt[12]{2}\right)^7 440 \text{ Hz} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

And (1) would be written and simplified as follows.


 * {| style="width:100%" border="0"

$$ s(t) = \sin(2 \pi 440 t) + \sin (2 \pi \left(\sqrt[12]{2}\right)^4 440 t) + \sin (2 \pi \left(\sqrt[12]{2}\right)^7 440 t) $$ (1)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }


 * {| style="width:100%" border="0"

$$ s(t) = \sum_{n=1}^3 \sin \left( 880\pi t \left(\sqrt[12]{2}\right)^{\frac{-1}{2}n^2+\frac{11}{2}n-5}\right) $$     (6)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

(6) is the exact Fourier series of the A Major triad. A Desmos plot of the all three series can be found here: https://www.desmos.com/calculator/kuwdjoxhpt.



The above graph is the exact series graphed along with (1) with the frequencies substituted in. The graphs overlap perfectly.



The above graph is the approximate series graphed along with (1) with the frequencies substituted in. While the graphs are good around t=0, they diverge further from the origin.

Another point to note is that (6) can be made into a general form for any major triad.


 * {| style="width:100%" border="0"

$$ s(t) = \sum_{n=1}^3 \sin \left( 2\pi f t \left(\sqrt[12]{2}\right)^{\frac{-1}{2}n^2+\frac{11}{2}n-5}\right) $$     (7)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Where $$f$$ is the frequency of the root of the triad. (7) can be used to produce the Fourier series for any desired major triad.

Computer Generated A Major Triad
As before, the Wolfram applet was used to generate the A Major triad.



Recorded in Audacity...



Selected the region we want to analyze...



And this is the plot spectrum we get. The three main peaks are



A4...



C#5...



and E5, just as we expected.



Examining Periodicity of Waveform
We can compare the Desmos plot from before with a zoomed in view of the Audacity waveform.

Desmos plot of the A Major triad, using the exact form



Zoomed in waveform



The two graphs are almost identical. However, while the Desmos graph is obviously periodic, the Audacity graph doesn't appear to be, as shown below.



In truth, the waveform is periodic. The waveform function just has a different period than (5) or (6).

The peaks of the plot spectrum generated by Audacity are


 * {| style="width:100%" border="0"

$$ f_{A4}=440 \text{ Hz}, f_{C\#5}=550 \text{ Hz}, f_{E5}=658 \text{ Hz} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The three frequencies have a fundamental frequency (greatest common divisor) of 2 Hz. Substituting the frequencies into (1) gives


 * {| style="width:100%" border="0"

$$ s(t) = \sin(2 \pi 440 t) + \sin (2 \pi 550 t) + \sin (2 \pi 658 t) $$ (8)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

(8) can be rewritten and simplified as follows.


 * {| style="width:100%" border="0"

$$ s(t) = \sin(2 \pi 440 t) + \sin (2 \pi 550 t) + \sin (2 \pi 658 t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ s(t)=\sin(4\pi 220 t)+\sin(4\pi 275 t)+\sin(4\pi 329 t) $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }


 * {| style="width:100%" border="0"

$$ s(t)=\sum_{n=1}^3 \sin\left(4\pi t \left(\frac{-1}{2}n^2+\frac{113}{2}n+164\right)\right) $$     (9)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

The period of a sinusoidal function is found by


 * {| style="width:100%" border="0"

$$ P=\frac{2\pi}{\omega}=\frac{2\pi}{2f\pi}=\frac{1}{f} $$     (10)
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Where $$\omega$$ is the circular frequency of the function and $$f$$ is the fundamental frequency of the notes being considered. The circular frequencies of the functions we have found so far are:


 * {| style="width:100%" border="0"

$$ \omega_{(5)}=220\pi \text{ rad/sec}, \omega_{(6)}=2\pi \text{ rad/sec}, \omega_{(9)}=4\pi \text{ rad/sec}. $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

The fundamental frequencies of the functions found so far are:


 * {| style="width:100%" border="0"

$$ f_{(5)}=110 \text{ Hz}, f_{(6)}=1 \text{ Hz}, f_{(9)}=2 \text{ Hz}. $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

As a reminder, (5) is the approximate Fourier series of the A Major triad, (6) is the exact Fourier series of the A Major triad, and (9) is the Fourier series of the Audacity waveform for the computer generated A Major triad.

Substituting into (10) gives the periods of the three Fourier series.


 * {| style="width:100%" border="0"

$$ P_{(5)}=\frac{1}{110} \text{ sec}, P_{(6)}=1 \text{ sec}, P_{(9)}=\frac{1}{2} \text{ sec} $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

So, the Audacity waveform only looked nonperiodic because it has a shorter period than the exact series, which means the variances in the graph show up sooner in comparison.

A Major Triad from Interactive Piano Chord Visualizer
Now we want to compare the FFT spectrum of the Wolfram A Major triad to an A Major triad produced by the Interactive Piano Chord Visualizer, which emulates actual piano chords. Doing so will be an approximation to comparing with a chord played on an actual piano.

Recording the sound in Audacity...



Selecting what we want to analyze...



And this is the plot spectrum that we get. Notice how it is already more complicated than the pure sine wave gotten earlier.



As before, we want to export the data into a .txt file...



Paste the data into the spreadsheet...



Filter out the noise...



And these are the frequencies we are left with.



With the exception of B5, all of the notes are in the A Major triad.

Problem 5: Detecting Unknown Chord
Now we need to do the same FFT process, but this time with an unknown chord in an unknown piano piece. We start the same, however. By recording in Audacity...



Selecting the second chord...



And we get this plot spectrum. Because the smaller size makes the peaks easier to see, this image is of size 16384. The data that will be exported, however, will be of size 65536.



This is the data gotten from the size 65536 FFT.



We paste the data into the spreadsheet...



And filter out the noise.



These are the notes that we are left with.



There were 13 distinct notes detected: F2, C3, F3, C4, E♭4, A♭4, A4, C5, E♭5, G5, A5, B♭5, and E♭5. It stands that the second chord in the piano piece contains some combination of those 13 notes. However, not all of the notes appear the same number of times. A♭4 appears six times, F2, C3, C4, and C5 each appear four times, F3 appears three times, E♭4 and G5 each appear twice, and A4, E♭5, A5, B♭5, and E♭6 each appear only once. This implies that the piano the piece was played on has some internal inharmonicities, especially since A♭4 and A4, as well as A5 and B♭5, appear, each being only a semitone apart. It's possible that A♭4 being played triggered some resonance in A4, which triggered some resonance in A5, which triggered resonance in B♭5. The conclusion drawn is that the piano should be tuned.