Baixe o app para aproveitar ainda mais
Prévia do material em texto
CÁLCULO NUMÉRICO Aula 6 – Aproximação de funções APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO CONTEÚDO PROGRAMÁTICO DESTA AULA Aproximação de funções: Interpolação Polinomial: Método de Lagrange; Método de Newton. Ajuste de funções. APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO INTERPOLAÇÃO POLINOMIAL • Consiste em determinar uma função (polinomial, neste caso) que se ajuste a uma série de pontos dados. • Polinômio interpolador – (n+1) pontos geram um único polinômio de grau menor ou igual a n. -40 -20 0 20 40 60 80 -8 -6 -4 -2 0 2 4 6 pontos polinômio de grau 3 APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO MÉTODO DE LAGRANGE • (n+1) PONTOS / POLINÔMIO ÚNICO ( n); n i ii xfxLxP 0 )().()( ))...().()...().(( ))...().()...().(( )( 1110 1110 niiiiiii nii i xxxxxxxxxx xxxxxxxxxx xL )().(..)().()().()( 1100 nn xfxLxfxLxfxLxP APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO EXEMPLO1: • Considere o seguinte conjunto de pontos: • Pontos: x0 = 0, x1 = 1 e x2 = 2; f(x0) = -2; f(x1) = 4 e f(x2) = 12 xi 0 1 2 f(xi) -2 4 12 2 23 )20).(10( )2).(1( )( 2 0 xxxx xL xx xx xL 2 )21).(01( )2).(0( )( 21 2)12).(02( )1).(0( )( 2 2 xxxx xL APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO CONTINUAÇÃO EXEMPLO 1 )().()().()().()( 221100 xfxLxfxLxfxLxP )12.( 2 )4.(2)2.( 2 23 )( 2 2 2 xx xx xx xP 25)( 668.423)( 2 222 xxxP xxxxxxxP APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO MÉTODO DE NEWTON • (n+1) PONTOS / POLINÔMIO ÚNICO ( n); • OPERADOR DIFERENÇAS DIVIDIDAS •Para n = 2 ],...,,,[).)...().((... ],,[).).((],[).(][)( 210110 210101000 nn n xxxxfxxxxxx xxxfxxxxxxfxxxfxP ],,[).).((],[).(][)( 2101010002 xxxfxxxxxxfxxxfxP 0 1210321 210 ],...,,[],...,,,[ ],...,,,[ xx xxxxfxxxxf xxxxf n nn n (diferença dividida ordem n) APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO MÉTODO DE NEWTON - CONTINUAÇÃO )(][ 00 xfxf 01 01 10 )()( ],[ xx xfxf xxf 02 1021 210 ],[],[ ],,[ xx xxfxxf xxxf 03 210321 3210 ],,[],,[ ],,,[ xx xxxfxxxf xxxxf (ordem 0) (ordem 1) (ordem 2) (ordem 3) APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO EXEMPLO 2: • Considere o seguinte conjunto de pontos: • Pontos: x0 = 0, x1 = 1 e x2 = 2; f(x0) = -2; f(x1) = 4 e f(x2) = 12 xi 0 1 2 f(xi) -2 4 12 ],,[).).((],[).(][)( 2101010002 xxxfxxxxxxfxxxfxP 2)0()(][ 00 fxfxf 6 1 )2(4 01 )0()1()()( ],[ 01 01 10 ff xx xfxf xxf APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO EXEMPLO 2 - CONTINUAÇÃO: 2 ]1,0[]2,1[ 02 ]1,0[]2,1[],[],[ ],,[ 02 1021 210 ffff xx xxfxxf xxxf 6 1 )2(4 01 )0()1()()( ],[ 01 01 10 ff xx xfxf xxf 8 1 124 21 )2()1()()( ],[ 21 21 21 ff xx xfxf xxf 1 2 68 2 ]1,0[]2,1[ ],,[ 210 ff xxxf APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO EXEMPLO 2 - CONTINUAÇÃO: ],,[).).((],[).(][)( 2101010002 xxxfxxxxxxfxxxfxP 25)( 62)( 1).1.(6.2)( ]2,1,0[).1).(0(]1,0[).0(]0[)( 2 2 2 2 2 2 xxxP xxxxP xxxxP fxxfxfxP APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO AJUSTE DE FUNÇÕES Nem sempre a interpolação é aconselhável. Quando se quer aproximar um valor da função fora do intervalo de tabelamento (extrapolação); Quando os valores são medidas experimentais com erros. Neste caso a função deve passar pela barra de erros e não pelos pontos. Temos que ajustar estas funções tabeladas por uma função que seja uma “boa aproximação” e que permita extrapolações com alguma margem de segurança. APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO AJUSTE DE FUNÇÕES Caso discreto: Dados “k” pontos distintos no plano (x1,y1); (x2,y2); (x3,y3) ...;(xk,yk) num intervalo [a,b]. Devemos escolher funções lineares ou não g1(x), g2(x)...gk(x), e constantes a1, a2 ,..., ak tais que a função (x) = a1. g1(x) + a2. g2(x) + ...+ ak. gk(x) se aproxime de y = f(x); Este modelo é dito linear pois os coeficientes a determinar a1, a2 ,..., ak aparecem linearmente. APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO AJUSTE DE FUNÇÕES – CASO DISCRETO 0 5 10 15 20 25 30 35 -2 -1 0 1 2 3 4 5 0 5 10 15 20 25 30 35 -2 -1 0 1 2 3 4 5 Diagrama de dispersão sugere uma função polinomial do 20 grau APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO AJUSTE DE FUNÇÕES – CASO DISCRETO -10 -5 0 5 10 15 20 -2 0 2 4 6 8 -10 -5 0 5 10 15 20 -2 0 2 4 6 8 f(x) (x) APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO AJUSTE DE FUNÇÕES – MÉTODO DOS MÍNIMOS QUADRADOS • Função (x) = a1.g1(x) + a2.g2(x) + a3.g3(x) + ...+ ak.gk(x) • Determinar (x) que mais se aproxime de f(x), ou seja, determinar os “ais” • Desvio: [f(xi) – (xi)] 2 para i = 1, 2, ...k • • F mínima para cada ai . Sistema linear com k incógnitas e k equações. A solução leva aos valores de a1, a2, ..., ak. 0 ia F k i kkin xgaxgaxgaxfaaaF 1 2 221121 )](....)(.)(.)([),...,,( APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO EXEMPLO 3 • Sejam os pontos abaixo de um experimento. • Gráfico de dispersão sugere parábola que passa pela origem; • (x) = a1.g(x), onde g(x) = x 2. 0 0,5 1 1,5 2 2,5 -1,5 -1 -0,5 0 0,5 1 APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO EXEMPLO 3 - CONTINUAÇÃO 9 1 2 11 )](.)([)( i ii xgaxfaF 0)()].(.)([ 9 1 1 i iii xgxgaxf 0)()].(.)([.20 9 1 1 i iii i xgxgaxf a F )().()().(.0)]().(.)().([ 1 9 1 1 xgxfxgxgaxgxgaxgxf iiii i iii 9 1 9 1 1 )().( )().( i ii i ii xgxgxgxf a APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO EXEMPLO 3 - CONTINUAÇÃO 9 1 4 9 1 2 19 1 9 1 1 ).( )().( )().( i i i ii i ii i ii x xxf a xgxg xgxf a 2 9 1 4 9 1 2 1 .02,2)(02,2 606,1 238,3 ).( xx x xxf a i i i ii APROXIMAÇÃO DE FUNÇÕES CÁLCULO NUMÉRICO RESUMINDO Nesta aula vocês estudaram: Aproximação de funções: Interpolação Polinomial: Método de Lagrange; Método de Newton. Ajuste de funções.
Compartilhar