docsity

Resumo: Método dos Mínimos Quadrados

Método dos Mínimos Quadrados


O Método dos Mínimos Quadrados é um método de aproximação de funções e ajuste de curvas que tem ampla aplicação em problemas físicos e biológicos. Aqui, vamos abordar esse método no contexto de Cálculo Numérico.


Neste resumo, vamos falar sobre alguns dos principais tópicos sobre Método dos Mínimos Quadrados (MMQ): Método dos Mínimos Quadrados discretos, regressão linear e caso discreto geral, caso contínuo geral, Análise Harmônica.


Para conferir todas as fórmulas do Método dos Mínimos Quadrados e ainda resolver vários exercícios de Cálculo Numérico, acesse o Conteúdo de Cálculo Numérico da Estudar com Você pelo link: https://estudar.com.vc/cursos/1021-calculo-numerico


1. Regressão Linear


Considere a seguinte tabela de pontos:


Regressão Linear: Tabela de Pontos
Regressão Linear: Tabela de Pontos

Na regressão linear, desejamos aproximar os pontos da tabela por uma função do tipo:


f(xi)=a+bxif(x_i)={\color{#ef8722}a}+{\color{#9e3acc} b}x_i


Definimos o erro quadrático médio da aproximação como:


E(a,b)=∑i=1n(yi−a−bxi)2E ({\color{#ef8722} a},{\color{#9e3acc} b})=\displaystyle \sum_{i=1}^n (y_i-{\color{#ef8722}a}-{\color{#9e3acc} b}x_i)^2


Queremos minimzar o valor desse erro. Portanto, devemos ter:


{∂E(a,b)∂a=0∂E(a,b)∂b=0\begin{cases} \dfrac{\partial E ({\color{#ef8722} a},{\color{#9e3acc} b})}{\partial {\color{#ef8722} a}}=0 \\ \\ \dfrac{\partial E ({\color{#ef8722} a},{\color{#9e3acc} b})}{\partial {\color{#9e3acc} b}}=0 \end{cases} 


Calculando as derivadas parciais:


∂E(a,b)∂a=2∑i=1n(yi−a−bxi)(−1)=2[−∑i=1nyi⋅1+a∑i=1n1⋅1+b∑i=1nxi⋅1] \dfrac{\partial E ({\color{#ef8722} a},{\color{#9e3acc} b})}{\partial {\color{#ef8722} a}}=2 \displaystyle \sum_{i=1}^n (y_i-{\color{#ef8722}a}-{\color{#9e3acc} b}x_i)(-1)=2 \left[ - \displaystyle \sum_{i=1}^n y_i \cdot 1 +{\color{#ef8722} a} \sum_{i=1}^n 1 \cdot 1+{\color{#9e3acc} b} \sum_{i=1}^n x_i \cdot 1 \right]


∂E(a,b)∂b=2∑i=1n(yi−a−bxi)(−xi)=2[−∑i=1nyi⋅xi+a∑i=1n1⋅xi+b∑i=1nxi⋅xi]\dfrac{\partial E ({\color{#ef8722} a},{\color{#9e3acc} b})}{\partial {\color{#9e3acc} b}}=2 \displaystyle \sum_{i=1}^n (y_i-{\color{#ef8722}a}-{\color{#9e3acc} b}x_i)(-x_i)=2 \left[ - \displaystyle \sum_{i=1}^n y_i \cdot x_i +{\color{#ef8722} a} \sum_{i=1}^n 1 \cdot x_i+{\color{#9e3acc} b} \sum_{i=1}^n x_i \cdot x_i \right]


Igualando a zero cada uma das derivadas parciais:


{−∑i=1nyi⋅1+a∑i=1n1⋅1+b∑i=1nxi⋅1=0−∑i=1nyi⋅xi+a∑i=1n1⋅xi+b∑i=1nxi⋅xi=0\begin{cases} - \displaystyle \sum_{i=1}^n y_i \cdot 1 +{\color{#ef8722} a} \sum_{i=1}^n 1 \cdot 1+{\color{#9e3acc} b} \sum_{i=1}^n x_i \cdot 1 =0 \\ \\ - \displaystyle \sum_{i=1}^n y_i \cdot x_i +{\color{#ef8722} a} \sum_{i=1}^n 1 \cdot x_i+{\color{#9e3acc} b} \sum_{i=1}^n x_i \cdot x_i =0\end{cases} 


Conseguimos escrever o sistema de equações como uma equação matricial:


[∑i=1n1⋅1∑i=1n1⋅xi ∑i=1nxi⋅1∑i=1nxi⋅xi][ab]=[∑i=1n1⋅yi∑i=1nxi⋅yi] \begin{bmatrix} \displaystyle \sum_{i=1}^n 1 \cdot 1 & \displaystyle \sum_{i=1}^n 1 \cdot x_i \\\ \displaystyle \sum_{i=1}^n x_i \cdot 1 & \displaystyle\sum_{i=1}^n x_i \cdot x_i \end{bmatrix} \begin{bmatrix}{\color{#ef8722}a} \\ \\ \color{#9e3acc} b \end{bmatrix}=\begin{bmatrix} \displaystyle \sum_{i=1}^n 1 \cdot y_i \\ \displaystyle \sum_{i=1}^n x_i \cdot y_i \end{bmatrix}


Se considerarmos Rn\mathbb{R}^n com produto interno usual, isto é:


u,v∈Rn⇒⟨u,v⟩=∑i=1nui⋅viu, v \in \mathbb{R}^n \Rightarrow \langle u,v \rangle=\displaystyle \sum_{i=1}^n u_i \cdot v_i


Podemos escrever o sistema matricial utilizando os produtos internos:


[⟨1,1⟩⟨1,x⟩⟨x,1⟩⟨x,x⟩][ab]=[⟨1,y⟩⟨x,y⟩] \begin{bmatrix} \langle1,1 \rangle & \langle 1,x \rangle \\ \langle x,1 \rangle & \langle x,x \rangle \end{bmatrix} \begin{bmatrix}{\color{#ef8722}a} \\ \color{#9e3acc} b \end{bmatrix}=\begin{bmatrix} \langle 1,y \rangle \\ \langle x,y \rangle \end{bmatrix}


Onde:


1=(1,1,1,…,1)1=(1,1,1,\ldots, 1);


x=(x1,x2,…,xn)x=(x_1,x_2, \ldots, x_n) ;


y=(y1,y2,…,yn)y=(y_1,y_2, \ldots, y_n).


O sistema linear formado pelos produtos internos é chamado de sistema normal.


2. Caso Discreto Geral


Conseguimos expandir o resultado obtido na regressão linear para qualquer função do tipo linear nos parâmetros.


Uma função f(x)f(x) é dita linear nos parâmetros quando pode ser escrita como:


f(x)=∑i=1mak⋅gk(x)\color{#9e3acc} f(x)=\displaystyle \sum_{i=1}^m a_k \cdot g_k(x)


Sendo aka_k constantes e gk(x)g_k(x) funções quaisquer.


Suponha que desejamos aproximar a mesma tabela apresentada anteriormente, com os pares de pontos (x1,y1),(x2,y2),…,(xn,yn)(x_1,y_1), (x_2,y_2), \ldots, (x_n,y_n), pela função f(x)\color{#9e3acc} f(x) linear nos parâmetros.


O erro quadrático médio é definido por:


E(a1,a2,…,am)=∑i=1n[yi−a1g1(xi)−a2g2(xi)−…−amgm(xi)]2E(a_1, a_2, \ldots, a_m)=\displaystyle \sum_{i=1}^n [y_i {\color{#9e3acc} -a_1g_1(x_i)-a_2g_2(x_i) - \ldots -a_mg_m(x_i)}]^2


A condição de minimização do erro quadrático médio é estabelecida quando:


∂E∂ai(a1,a2,…,am)=0, 1≤i≤m\dfrac{\partial E}{\partial a_i} (a_1,a_2, \ldots, a_m)=0, \ 1 \leq i \leq m


Por meio dessas equações, conseguimos montar o seguinte sistema normal para o caso discreto geral:


[⟨g1,g1⟩⟨g1,g2⟩⟨g1,g3⟩…⟨g1,gm⟩⟨g2,g1⟩⟨g2,g2⟩⟨g2,g3⟩…⟨g2,gm⟩⟨g3,g1⟩⟨g3,g2⟩⟨g3,g3⟩…⟨g3,gm⟩...............⟨gm,g1⟩⟨gm,g2⟩⟨gm,g3⟩…⟨gm,gm⟩][a1a2a3...am]=[⟨g1,y⟩⟨g2,y⟩⟨g3,y⟩...⟨gm,y⟩]\begin{bmatrix} \langle g_1,g_1 \rangle & \langle g_1,g_2 \rangle &\langle g_1,g_3 \rangle & \ldots & \langle g_1,g_m \rangle \\ \langle g_2,g_1 \rangle & \langle g_2,g_2 \rangle &\langle g_2,g_3 \rangle & \ldots & \langle g_2,g_m \rangle \\ \langle g_3,g_1 \rangle & \langle g_3,g_2 \rangle &\langle g_3,g_3 \rangle & \ldots & \langle g_3,g_m \rangle \\ . & . & . & . & . \\ . & . & . & . & . \\ . & . & . & . & . \\ \langle g_m,g_1 \rangle & \langle g_m,g_2 \rangle &\langle g_m,g_3 \rangle & \ldots & \langle g_m,g_m \rangle \end{bmatrix} \begin{bmatrix} a_1 \\ a_2 \\ a_3 \\ . \\ . \\ . \\ a_m \end{bmatrix}=\begin{bmatrix} \langle g_1,y \rangle \\ \langle g_2,y \rangle \\ \langle g_3,y \rangle \\ . \\ . \\ . \\ \langle g_m,y \rangle \end{bmatrix}

span>⟨g2​,y⟩⟨g3​,y⟩...⟨gm​,y⟩​⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤​


Exemplo:


Como exemplo, vamos aproximar a seguinte tabela:


MMQ: Tabela de Pontos a serem aproximados pela Função
MMQ: Tabela de Pontos a serem aproximados pela Função

Pela função:


f(x)=a⋅x+b⋅cos⁡xf(x)={\color{#ef8722} a} \cdot x+{\color{#9e3acc} b} \cdot \cos x


Primeiro, precisamos ver se a função f(x)f(x) é linear nos parâmetros.


A função ff pode ser escrita como:


f(x)=a1g1(x)+a2g2(x)f(x)=a_1 g_1(x)+a_2g_2(x);


g1(x)=xg_1(x)=x;


g2(x)=cos⁡xg_2(x)=\cos x.


Sendo a1,a2a_1,a_2 constantes. Assim, a função é dita linear nos parâmetros.


Como a função é linear nos parâmetros, conseguimos montar o sistema normal de forma direta:


[⟨g1,g1⟩⟨g1,g2⟩⟨g2,g1⟩⟨g2,g2⟩][ab]=[⟨g1,y⟩⟨g2,y⟩]\begin{bmatrix} \langle g_1,g_1 \rangle & \langle g_1, g_2 \rangle \\ \langle g_2,g_1 \rangle & \langle g_2,g_2 \rangle \end{bmatrix} \begin{bmatrix} {\color{#ef8722} a} \\ {\color{#9e3acc} b} \end{bmatrix}=\begin{bmatrix} \langle g_1,y \rangle \\ \langle g_2,y \rangle \end{bmatrix} 


[⟨x,x⟩⟨x,cos⁡x⟩⟨cos⁡x,x⟩⟨cos⁡x,cos⁡x⟩][ab]=[⟨x,y⟩⟨cos⁡x,y⟩]\begin{bmatrix} \langle x,x \rangle & \langle x, \cos x \rangle \\ \langle \cos x, x \rangle & \langle \cos x, \cos x \rangle \end{bmatrix} \begin{bmatrix} {\color{#ef8722} a} \\ {\color{#9e3acc} b} \end{bmatrix}=\begin{bmatrix} \langle x,y \rangle \\ \langle \cos x,y \rangle \end{bmatrix} 


Nesse caso, temos um problema discreto, então o produto interno é um somatório.


Vamos calcular cada um deles:


⟨x,x⟩=∑i=15xi⋅xi=0⋅0+1,5⋅1,5+3⋅3+4,5⋅4,5+6⋅6=67,5\langle x,x \rangle =\displaystyle \sum_{i=1}^5 x_i \cdot x_i=0 \cdot 0+ 1,5 \cdot 1,5 +3 \cdot 3+ 4,5 \cdot 4,5 +6 \cdot 6=67,5


⟨x,cos⁡x⟩=⟨cos⁡x,x⟩=∑i=15xi⋅cos⁡(xi)=0cos⁡(0)+1,5cos⁡(1,5)+3cos⁡(3)+4,5cos⁡(4,5)+6cos⁡(6)=1,948\langle x, \cos x \rangle =\langle \cos x, x \rangle=\displaystyle \sum_{i=1}^5 x_i \cdot \cos (x_i)=0 \cos (0)+1,5 \cos (1,5)+3 \cos (3)+4,5 \cos (4,5)+6 \cos (6)=1,948


⟨cos⁡x,cos⁡x⟩=∑i=15cos⁡2(xi)=cos⁡2(0)+cos⁡2(1,5)+cos⁡2(3)+cos⁡2(4,5)+cos⁡2(6)=2,951\langle \cos x, \cos x \rangle =\displaystyle \sum_{i=1}^5 \cos^2(x_i)=\cos^2(0)+\cos^2(1,5)+\cos^2(3)+\cos^2(4,5)+\cos^2(6)=2,951


⟨x,y⟩=∑i=15xi⋅yi=0⋅1+1,5⋅1,57+3⋅2+4,5⋅4,3+6⋅7=69,71\langle x,y \rangle =\displaystyle \sum_{i=1}^5 x_i \cdot y_i=0 \cdot 1+1,5 \cdot 1,57 +3 \cdot 2+4,5 \cdot 4,3+6 \cdot 7=69,71


⟨cos⁡x,y⟩=∑i=15yi⋅cos⁡(xi)=1⋅cos⁡(0)+1,57⋅cos⁡(1,5)+2⋅cos⁡(3)+4,3⋅cos⁡(4,5)+7⋅cos⁡(6,0)=6,76\langle \cos x, y \rangle =\displaystyle \sum_{i=1}^5 y_i \cdot \cos (x_i)= 1 \cdot \cos (0)+1,57 \cdot \cos(1,5)+2\cdot \cos (3)+ 4,3 \cdot \cos (4,5)+ 7 \cdot \cos(6,0)=6,76


Um observação importante é que a função cos⁡(x)\cos (x) deve ter os argumentos em radianos.


Dessa forma, o sistema normal com valores numéricos fica:


[67,51,9481,9482,951][ab]=[69,716,76]\begin{bmatrix} 67,5 & 1,948 \\ 1,948 & 2,951 \end{bmatrix} \begin{bmatrix} {\color{#ef8722} a} \\ {\color{#9e3acc} b} \end{bmatrix}=\begin{bmatrix} 69,71 \\ 6,76 \end{bmatrix} 


a=0,9854\color{#ef8722} a=0,9854


b=1,6403\color{#9e3acc} b=1,6403


Com isso, a função aproximadora fica:


f(x)=0,9854x+1,6403cos⁡xf(x)={\color{#ef8722} 0,9854} x+{\color{#9e3acc} 1,6403} \cos x



3. Caso Contínuo Geral


Em alguns casos, mesmo quando a forma analítica da função ff é conhecida em um domínio contínuo, desejamos aproximá-la em um intervalo:


I=[xi,xf]I=[x_i,x_f]


Por uma família de funções do tipo:


g(x)=∑i=1mak⋅gk(x)\color{#9e3acc}g(x)= \displaystyle \sum_{i=1}^m a_k \cdot g_k(x)


Nesse caso, o produto interno é calculado por meio de uma integral. Sendo assim, definimos o erro quadrático médio da aproximação no intervalo II por:


E(a1,a2,…,am)=∫xixf[f(x)−a1g1(xi)−a2g2(xi)−…−amgm(xi)]2 dxE(a_1, a_2, \ldots, a_m)=\displaystyle \int_{x_i}^{x_f} [f(x) {\color{#9e3acc} -a_1g_1(x_i)-a_2g_2(x_i) - \ldots -a_mg_m(x_i)}]^2 \ dx


A condição de minimização é representada por:


∂E∂ai(a1,a2,…,am)=0, 1≤i≤m\dfrac{\partial E}{\partial a_i} (a_1,a_2, \ldots, a_m)=0, \ 1 \leq i \leq m


Usando a formulação com produto interno, o sistema normal obtido é igual ao caso discreto. Ou seja:


[⟨g1,g1⟩⟨g1,g2⟩⟨g1,g3⟩…⟨g1,gm⟩⟨g2,g1⟩⟨g2,g2⟩⟨g2,g3⟩…⟨g2,gm⟩⟨g3,g1⟩⟨g3,g2⟩⟨g3,g3⟩…⟨g3,gm⟩...............⟨gm,g1⟩⟨gm,g2⟩⟨gm,g3⟩…⟨gm,gm⟩][a1a2a3...am]=[⟨g1,f(x)⟩⟨g2,f(x)⟩⟨g3,f(x)⟩...⟨gm,f(x)⟩]\begin{bmatrix} \langle g_1,g_1 \rangle & \langle g_1,g_2 \rangle &\langle g_1,g_3 \rangle & \ldots & \langle g_1,g_m \rangle \\ \langle g_2,g_1 \rangle & \langle g_2,g_2 \rangle &\langle g_2,g_3 \rangle & \ldots & \langle g_2,g_m \rangle \\ \langle g_3,g_1 \rangle & \langle g_3,g_2 \rangle &\langle g_3,g_3 \rangle & \ldots & \langle g_3,g_m \rangle \\ . & . & . & . & . \\ . & . & . & . & . \\ . & . & . & . & . \\ \langle g_m,g_1 \rangle & \langle g_m,g_2 \rangle &\langle g_m,g_3 \rangle & \ldots & \langle g_m,g_m \rangle \end{bmatrix} \begin{bmatrix} a_1 \\ a_2 \\ a_3 \\ . \\ . \\ . \\ a_m \end{bmatrix}=\begin{bmatrix} \langle g_1,f(x) \rangle \\ \langle g_2,f(x) \rangle \\ \langle g_3,f(x) \rangle \\ . \\ . \\ . \\ \langle g_m,f(x) \rangle \end{bmatrix}


Exemplo


Aproximar a função f(x)=exf(x)=e^x por um polinômio de primeiro grau g(x)=a0+a1xg(x)=a_0+a_1x no intervalo [0,1][0,1], pelo Método dos Mínimos Quadrados.


A função aproximadora g(x)g(x) é linear nos parâmetros. Em particular, porque ela é uma função polinomial de coeficientes constantes. Portanto, podemos montar o sistema normal de forma direta:


[⟨g1,g1⟩⟨g1,g2⟩⟨g2,g1⟩⟨g2,g2⟩][a0a1]=[⟨g1,f(x)⟩⟨g2,f(x)⟩]\begin{bmatrix} \langle g_1,g_1 \rangle & \langle g_1, g_2 \rangle \\ \langle g_2,g_1 \rangle & \langle g_2,g_2 \rangle \end{bmatrix} \begin{bmatrix} {\color{#ef8722} a_0} \\ {\color{#9e3acc} a_1} \end{bmatrix}=\begin{bmatrix} \langle g_1,f(x) \rangle \\ \langle g_2,f(x) \rangle \end{bmatrix} 


[⟨1,1⟩⟨1,x⟩⟨x,1⟩⟨x,x⟩][a0a1]=[⟨1,ex⟩⟨x,ex⟩]\begin{bmatrix} \langle 1,1 \rangle & \langle 1, x \rangle \\ \langle x,1 \rangle & \langle x,x \rangle \end{bmatrix} \begin{bmatrix} {\color{#ef8722} a_0} \\ {\color{#9e3acc} a_1} \end{bmatrix}=\begin{bmatrix} \langle 1,e^x \rangle \\ \langle x,e^x \rangle \end{bmatrix} 


Calculando cada um dos produtos internos:


⟨1,1⟩=∫011⋅1 dx=1\langle 1,1 \rangle =\displaystyle \int_0^1 1 \cdot 1 \ dx=1


⟨1,x⟩=⟨x,1⟩=∫01x dx=12\langle 1, x \rangle=\langle x, 1 \rangle= \displaystyle \int_0^1 x \ dx= \dfrac{1}{2}


⟨x,x⟩=∫01x2 dx=13\langle x,x \rangle =\displaystyle \int_0^1 x^2 \ dx= \dfrac{1}{3}


⟨1,ex⟩=∫01ex dx=e−1\langle 1, e^x \rangle =\displaystyle \int_0^1 e^x \ dx =e-1


⟨x,ex⟩=∫01xex dx=xex∣01−∫01ex dx=e−(e−1)=1\langle x, e^x \rangle =\displaystyle \int_0^1 xe^x \ dx =xe^x \biggm \vert_0^1 -\int_0^1 e^x \ dx=e-(e-1)=1


Com esses valores, o sistema fica:


[1121213][a0a1]=[e−11]\begin{bmatrix}1 & \dfrac{1}{2} \\ \\ \dfrac{1}{2} & \dfrac{1}{3} \end{bmatrix} \begin{bmatrix} {\color{#ef8722} a_0} \\ {\color{#9e3acc} a_1} \end{bmatrix}=\begin{bmatrix} e-1 \\ 1 \end{bmatrix} 


Resolvendo o sistema por algum dos métodos conhecidos, chegamos em:


a0=4e−10\color{#ef8722} a_0=4e-10


a1=18−6e\color{#9e3acc} a_1=18-6e


4. Análise Harmônica Contínua


Quando a função f(x)f(x) a ser aproximada é uma função periódica, costumamos utilizar uma família particular de funções lineares nos parâmetros, que são as funções trigonométricas; esse processo é denominado análise harmônica.


Com isso, a família de funções lineares nos parâmetros g(x)g(x) pode ser expressa como:


g(x)=a0+∑k=1makcos⁡(kx)+bksin⁡(kx)\color{#9e3acc} g(x)={\color{#ef8722} a_0} + \displaystyle \sum_{k=1}^m {\color{#20ac5b} a_k} \cos (k x) +{\color{#c90000} b_k} \sin (kx)


No caso geral, a função f(x)f(x) pode ser periódica de período 2L2L, enquanto cada função trigonométrica tem período 2π/k2\pi/k.


Para corrigir esse fato e facilitar no caso de uma função periódica genérica, vamos propor a seguinte mudança de variáveis:


x=πLx′x=\dfrac{\pi}{L} x'


Agora, para x′=0x'=0 vale:



x=πL⋅0=0x=\dfrac{\pi}{L} \cdot 0=0


E para x′=2Lx'=2L:


x′=πL2L=2πx'=\dfrac{\pi}{L} 2L= 2 \pi


Ou seja, fazemos com que as funções trigonométricas obedeçam:


gk(x′)=gk(x′+2L)g_k(x')=g_k(x'+2L)


Reescrevendo a família de funções:


g(x′)=a0+∑k=1makcos⁡(kπLx′)+bksin⁡(kπLx′)\color{#9e3acc} g(x')={\color{#ef8722} a_0} + \displaystyle \sum_{k=1}^m {\color{#20ac5b} a_k} \cos \left(\dfrac{k \pi}{L} x' \right) +{\color{#c90000} b_k} \sin \left(\dfrac{k\pi}{L} x' \right)


É claro que o nome que damos a variável não importa. Então, para facilitar vamos voltar a xx:


g(x)=a0+∑k=1makcos⁡(kπLx)+bksin⁡(kπLx)\color{#9e3acc} g(x)={\color{#ef8722} a_0} + \displaystyle \sum_{k=1}^m {\color{#20ac5b} a_k} \cos \left(\dfrac{k \pi}{L} x \right) +{\color{#c90000} b_k} \sin \left(\dfrac{k\pi}{L} x \right)


g(x)=a0+∑k=1makgk(x)+bkhk(x)\color{#9e3acc} g(x)={\color{#ef8722} a_0} + \displaystyle \sum_{k=1}^m {\color{#20ac5b} a_k} g_k(x)+{\color{#c90000} b_k} h_k(x)


A função g(x)\color{#9e3acc} g(x) é linear nos parâmetros. Então, conseguimos escrever o sistema normal de forma direta:



[⟨1,1⟩⟨1,g1⟩⟨1,g2⟩…⟨1,gm⟩⟨1,h1⟩⟨1,h2⟩…⟨1,hm⟩⟨g1,1⟩⟨g1,g1⟩⟨g1,g2⟩…⟨g1,gm⟩⟨g1,h1⟩⟨g1,h2⟩…⟨g1,hm⟩...........................⟨h1,1⟩⟨h1,g1⟩⟨h1,g2⟩…⟨h1,gm⟩⟨h1,h1⟩⟨h1,h2⟩…⟨h1,hm⟩...........................⟨hm,1⟩⟨hm,g1⟩⟨hm,g2⟩…⟨hm,gm⟩⟨hm,h1⟩⟨hm,h2⟩…⟨hm,hm⟩][a0a1a2...amb1b2...bm]=[⟨1,f⟩⟨g1,f⟩⟨g2,f⟩...⟨gm,f⟩⟨h1,f⟩⟨h2,f⟩...⟨hm,f⟩]\begin{bmatrix} \langle 1,1 \rangle & \langle 1, g_1\rangle & \langle1,g_2 \rangle & \ldots& \langle 1,g_m \rangle & \langle 1,h_1 \rangle & \langle 1,h_2 \rangle & \ldots & \langle 1, h_m\rangle \\ \\ \langle g_1,1 \rangle & \langle g_1, g_1\rangle & \langle g_1,g_2 \rangle & \ldots& \langle g_1,g_m \rangle & \langle g_1,h_1 \rangle & \langle g_1,h_2 \rangle & \ldots & \langle g_1, h_m\rangle \\ \\ . & . & . & . &. &. &. &. & . \\ . & . & . & . &. &. &. &. & . \\ . & . & . & . &. &. &. &. & . \\ \langle h_1,1 \rangle & \langle h_1, g_1\rangle & \langle h_1,g_2 \rangle & \ldots& \langle h_1,g_m \rangle & \langle h_1,h_1 \rangle & \langle h_1,h_2 \rangle & \ldots & \langle h_1, h_m\rangle \\ \\ . & . & . & . &. &. &. &. & . \\ . & . & . & . &. &. &. &. & . \\ . & . & . & . &. &. &. &. & . \\ \langle h_m,1 \rangle & \langle h_m, g_1\rangle & \langle h_m,g_2 \rangle & \ldots& \langle h_m,g_m \rangle & \langle h_m,h_1 \rangle & \langle h_m,h_2 \rangle & \ldots & \langle h_m, h_m\rangle \\ \\ \end{bmatrix} \begin{bmatrix} a_0 \\ a_1 \\ a_2 \\ . \\ . \\ . \\ a_m \\ b_1 \\ b_2 \\ . \\ . \\ . \\ b_m \end{bmatrix}=\begin{bmatrix} \langle 1, f \rangle \\ \langle g_1, f \rangle \\ \langle g_2, f \rangle \\ . \\ . \\ . \\ \langle g_m, f \rangle \\ \langle h_1, f \rangle \\ \langle h_2, f \rangle \\ . \\ . \\ . \\ \langle h_m, f \rangle \end{bmatrix}


Porém, devido a propriedades das funções trigonométricas, todos os elementos fora da diagonal principal são nulos, pois:


∫−L+Lcos⁡(iπxL)cos⁡(jπxL) dx=0, se i̸=j\displaystyle \int_{-L}^{+L} \cos \left( \dfrac{i \pi x}{L} \right) \cos \left( \dfrac{j \pi x}{L} \right) \ dx=0, \ \text{se} \ i \neq j


∫−L+Lsin⁡(iπxL)sin⁡(jπxL) dx=0, se i̸=j\displaystyle \int_{-L}^{+L} \sin \left( \dfrac{i \pi x}{L} \right) \sin \left( \dfrac{j \pi x}{L} \right) \ dx=0, \ \text{se} \ i \neq j


∫−L+Lcos⁡(iπxL)sin⁡(jπxL) dx=0, ∀i,j\displaystyle \int_{-L}^{+L} \cos \left( \dfrac{i \pi x}{L} \right) \sin \left( \dfrac{j \pi x}{L} \right) \ dx=0, \ \forall i, j


Além disso, os elementos da diagonal principal tem valores bem definidos:


∫−L+Lcos⁡(iπxL)cos⁡(jπxL) dx=L, se i=j̸=0\displaystyle \int_{-L}^{+L} \cos \left( \dfrac{i \pi x}{L} \right) \cos \left( \dfrac{j \pi x}{L} \right) \ dx=L, \ \text{se} \ i =j \neq 0


∫−L+Lcos⁡(iπxL)cos⁡(jπxL) dx=2L, se i=j=0\displaystyle \int_{-L}^{+L} \cos \left( \dfrac{i \pi x}{L} \right) \cos \left( \dfrac{j \pi x}{L} \right) \ dx=2L, \ \text{se} \ i =j = 0


∫−L+Lsin⁡(iπxL)sin⁡(jπxL) dx=L, se i=j̸=0\displaystyle \int_{-L}^{+L} \sin \left( \dfrac{i \pi x}{L} \right) \sin \left( \dfrac{j \pi x}{L} \right) \ dx=L, \ \text{se} \ i = j \neq 0


Com isso, conseguimos escrever os coeficientes de forma direta:


a0=12L∫−L+Lf(x) dx\color{#ef8722} a_0=\dfrac{1}{2L} \displaystyle \int_{-L}^{+L} f(x) \ dx


ak=1L∫−L+Lf(x)cos⁡(kπxL) dx\color{#20ac5b} a_k=\dfrac{1}{L} \displaystyle \int_{-L}^{+L} f(x) \cos \left( \dfrac{k \pi x}{L} \right) \ dx


bk=1L∫−L+Lf(x)sin⁡(kπxL) dx\color{#c90000} b_k=\dfrac{1}{L} \displaystyle \int_{-L}^{+L} f(x) \sin \left( \dfrac{k \pi x}{L} \right) \ dx


Esses valores são justamente os coeficientes da Série de Fourier; clique no link ao lado caso queira estudar esse assunto de Cálculo Diferencial e Integral.


Isso é o que você mais precisa saber sobre esses temas relacionados ao Método dos Mínimos Quadrados. Para conferir todas as fórmulas do Método dos Mínimos Quadrados e ainda resolver vários exercícios de Cálculo Numérico, acesse o Conteúdo de Cálculo Numérico da Estudar com Você pelo link: https://estudar.com.vc/cursos/1021-calculo-numerico.

Registre-se e continue a aula gratuitamente
Você poderá assistir de qualquer dispositivo
francisco-mendes-12
heliofarenheit
fabricio-villon-dos-reis
camila-cássia-aprovadas
iago-santos-57
fernando-coelho-84
sarah-pinheiro-18
isaque-novaes-pinho
renan-oliveira-7t7
isis-rocha-9
Outros alunos 1 591 estão fazendo este curso na Docsity
Anterior
Aulas
Materiais
Próximo