Professional Documents
Culture Documents
15/05/2023
Pag. 152
t(h) T (o c)
6 24
7 25
8 27
9 28
10 30
11 30,5
12 31
(
a0 + a1 · x0 = y0 1 x0 a y
=⇒ · 0 = 0
a0 + a1 · x1 = y1 1 x1 a1 y1
Exemplos
Qual a temperatura às 7:30hs
y = a0 + a1 x
(
a0 + 7a1 = 25 (−1)
a0 + 8a1 = 27 +
a1 = 2 =⇒ a0 = 11
1
1 interpolação continuação
Pag.: 167
data 19/05/2023
Interpolador de Lagrange
Os polinômios interpoladores de Lagrange, formam uma classe especifica de polinômios
que podem ser usados para fazer a interpolação de um determinado conjunto de dados,
simplesmente a partir dos valores dos pontos. A partir dos valores dos pontos. os po-
linômios podem ser escritos diretamente, e os coeficientes são determinados sem a neces-
sidade de nenhum cálculo preliminar.
A forma geral do polinômio interpolador de Lagrange é dada por:
n
Y
n
X (x − xj )
Pn (x) = yi
i=o
j=0 xi − x j
j ̸= i
demonstração:
Exemplo 1
pag: 167
Determinar:
• o polinômio interpolador de Lagrange para a função conhecida pelos pontos tabela-
dos abaixo
xi y1
0,0 0,000
0,2 2,008
0,4 4,064
0,5 5,125
3
3
Y
X (x − xj )
P3 (x) = yi =
i=o
j=0 xi − xj
j ̸= i
(x − x1 ) · (x − x2 ) · (x − x3 ) (x − x0 ) · (x − x2 ) · (x − x3 )
y0 · + y1 · +
(x0 − x1 ) · (x0 − x2 ) · (x0 − x3 ) (x1 − x0 ) · (x1 − x2 ) · (x1 − x3 )
(x − x0 ) · (x − x1 ) · (x − x3 ) (x − x0 ) · (x − x1 ) · (x − x2 )
y2 · + y3 ·
(x2 − x0 ) · (x2 − x1 ) · (x2 − x3 ) (x3 − x0 ) · (x3 − x1 ) · (x3 − x2 )
logo,
(x − 0, 2) · (x − 0, 4) · (x − 0, 5)
0, 000 · +
(0, 0 − 0, 2) · (0, 0 − 0, 4) · (0, 0 − 0, 5)
2
(x − 0, 0) · (x − 0, 4) · (x − 0, 5)
2, 008 · +
(0, 2 − 0, 0) · (0, 2 − 0, 4) · (0, 2 − 0, 5)
(x − 0, 0) · (x − 0, 2) · (x − 0, 5)
4, 064 · +
(0, 4 − 0, 0) · (0, 4 − 0, 2) · (0, 4 − 0, 5)
(x − 0, 0) · (x − 0, 2) · (x − 0, 4)
5, 125 ·
(0, 5 − 0, 0) · (0, 5 − 0, 2) · (0, 5 − 0, 4)
• P (0, 3)
P (0, 3) ∼
= 3, 027
Exemplo 2
A partir do seguinte conjunto de dados
xi yi
1 52
2 5
4 -5
5 -40
7 10
4
4
Y
X (x − xj )
P4 (x) = yi =
i=o
j=0 xi − xj
j ̸= i
(x − x1 ) · (x − x2 ) · (x − x3 ) · (x − x4 )
y0 · +
(x0 − x1 ) · (x0 − x2 ) · (x0 − x3 ) · (x0 − x4 )
(x − x0 ) · (x − x2 ) · (x − x3 ) · (x − x4 )
y1 · +
(x1 − x0 ) · (x1 − x2 ) · (x1 − x3 ) · (x1 − x4 )
(x − x0 ) · (x − x1 ) · (x − x3 ) · (x − x4 )
y2 · +
(x2 − x0 ) · (x2 − x1 ) · (x2 − x3 ) · (x2 − x4 )
(x − x0 ) · (x − x1 ) · (x − x2 ) · (x − x4 )
y3 · +
(x3 − x0 ) · (x3 − x1 ) · (x3 − x2 ) · (x3 − x4 )
(x − x0 ) · (x − x1 ) · (x − x2 ) · (x − x3 )
y4 ·
(x4 − x0 ) · (x4 − x1 ) · (x4 − x2 ) · (x4 − x3 )
logo,
(x − 2) · (x − 4) · (x − 5) · (x − 7) (x − 1) · (x − 4) · (x − 5) · (x − 7)
52 · +5· +
(1 − 2) · (1 − 4) · (1 − 5) · (1 − 7) (2 − 1) · (2 − 4) · (2 − 5) · (2 − 7)
3
(x − 1) · (x − 2) · (x − 5) · (x − 7) (x − 1) · (x − 2) · (x − 4) · (x − 7)
−5 · + −40 · +
(4 − 1) · (4 − 2) · (4 − 5) · (4 − 7) (5 − 1) · (5 − 2) · (5 − 4) · (5 − 7)
(x − 1) · (x − 2) · (x − 4) · (x − 5)
10 ·
(7 − 1) · (7 − 2) · (7 − 4) · (7 − 5)
(3 − 1) · (3 − 2) · (x − 5) · (3 − 7) (3 − 1) · (3 − 2) · (3 − 4) · (3 − 7)
−5 · + −40 · +
(4 − 1) · (4 − 2) · (4 − 5) · (4 − 7) (5 − 1) · (5 − 2) · (5 − 4) · (5 − 7)
(3 − 1) · (3 − 2) · (3 − 4) · (3 − 5) ∼
10 · =6
(7 − 1) · (7 − 2) · (7 − 4) · (7 − 5)
f (x) − f (x0 )
f ′ (x) = lim
x→x0 x − x0
A diferença dividida de primeira ordem é definida como uma aproximação da f ′ (x),
ou seja
f (x) − f (x0 )
f [x, x0 ] =
x − x0
São usada as seguintes notações para diferenças divididas:
f [ ], [ ], ∆y
f [xi , xi+1 , xi+2 , ..., xi+n ] − f [xi , xi+1 , xi+2 , ..., xi+n−1 ]
=
xi+n − xi
∆n−1 yi+1 − ∆n−1 yi
xi+n − xi
4
xi yi ∆yi ∆2 yi ∆3 yi ∆4 yi
1 52 -47 14 -6 2
2 5 -5 -10 6
4 -5 -35 20 ——
5 -40 25 ——
7 10 ——
∆0 y1 − ∆0 y0 y1 − y0 5 − 52
∆y0 = = = = −47
x1 − x0 x1 − x0 2−1
∆0 y2 − ∆0 y1 y2 − y1 −5 − 5
∆y1 = = = = −5
x2 − x1 x2 − x1 4−2
∆0 y3 − ∆0 y2 y3 − y2 −40 − (−5)
∆y2 = = = = −35
x3 − x2 x3 − x2 5−4
∆0 y4 − ∆0 y3 y4 − y3 10 − (−40)
∆y3 = = = = 25
x4 − x3 x4 − x3 7−5
——————————————————————————————————————
∆1 y1 − ∆1 y0 −5 − (−47)
∆2 y0 = = = 14
x2 − x0 4−1
∆1 y2 − ∆1 y1 −35 − (−5)
∆2 y1 = = = 10
x3 − x1 5−2
∆1 y3 − ∆1 y2 25 − (−35)
∆2 y2 = = = 20
x4 − x2 7−4
——————————————————————————————————————
∆2 y1 − ∆2 y0 −10 − 14
∆3 y0 = = = −6
x3 − x0 5−1
∆2 y2 − ∆2 y1 20 − (−10)
∆3 y1 = = =6
x4 − x1 7−2
——————————————————————————————————————
∆3 y1 − ∆3 y0 6 − (−6)
∆4 y0 = = =2
x4 − x0 7−1
O polinômio interpolador de Newton, usando as diferenças dividas, pode ser escrito
da seguinte maneira
pn (x) = y0 + ∆y0 (x − x0 ) + ∆2 (x − x0 )(x − x1 ) + ∆3 y0 (x − x0 )(x − x1 )(x − x2 ) + ... +
∆n (x − x0 )...(x − xn−1 )
5
Exemplo
p(x) = 52 + (−47)(x − 1) + 14(x − 1)(x − 2) + (−6)(x − 1)(x − 2)(x − 4) +
2(x − 1)(x − 2)(x − 4)(x − 5)
Exemplo 2
xi yi
6 24
7 25
8 27
Sistema linear
y = a0 + a1 x + a2 x2
a0 + 6a1 + 36a2 = 24
a0 + 7a1 + 49a2 = 25
a0 + 8a1 + 64a2 = 27
Passo 0
.
1 6 36 .. 24 L(0)
1
1 7 49 ... 25 L(0)
2
.. (0)
1 8 64 . 27 L3
1
m1 = − = −1
1
Passo 1
.
1 6 36 .. 24 L(1)
1 = L1
(0)
2
m1 = − = −2
1
Passo 2
..
1 6 36 . 24 L(2)
1 = L1
(1)
6
3 Retrosubstituição
a0 + 6a1 + 36a2 = 24
a1 + 13a2 = 1
2a2 = 1
[39 − 5, 5 0, 5]T
y = 39 − 5, 5x + 0, 5x2
n
Y
n
X (x − xj )
Pn (x) = yi
i=o
j=0 xi − x j
j ̸= i
x2 − 8x − 7x + 56 x2 − 8x − 6x + 48 x2 − 7x − 6x + 42
P3 (x) = 24 · + 25 · + 27 ·
−1 · −2 1 · −1 2·1
P3 (x) = 12 · (x2 − 15x + 56) − 25 · (x2 − 14x + 48) + 13, 5 · (x2 − 13x + 42)
P3 (x) = 12x2 − 180x + 672 − 25x2 + 350x − 1200 + 13, 5x2 − 175, 5x + 567
P3 (x) = 12x2 − 25x2 + 13, 5x2 − 180x + 350x − 175, 5x + 672 − 1200 + 567
7
P3 (x) = 0, 5x2 − 5, 5x + 39
xi yi ∆yi ∆2 yi
6 24 1 0,5
7 25 2
8 27
∆0 y1 − ∆0 y0 y1 − y0 25 − 24
∆y0 = = = =1
x1 − x0 x1 − x0 7−6
∆0 y2 − ∆0 y1 y2 − y1 27 − 25
∆y1 = = = =2
x2 − x1 x2 − x1 8−7
==================================================
∆1 y1 − ∆1 y0 2−1 1
∆2 y0 = = = = 0, 5
x2 − x0 8−6 2
Pn (x) = 24 + 1 · (x − 6) + 0, 5 · (x − 6)(x − 7)
Pn (x) = 18 + x + 0, 5x2 − 6, 5x + 21
Pn (x) = 39 − 5, 5x + 0, 5x2
8
6 INTEGRAÇÃO NUMÉRICA
26/05/2023
pag.: 206
Z b Z x1
f (x)dx ∼
= P1 (x)dx
a x0 dx = hdz
P1 (x) = y0 + ∆y0 (x − x0 )
Então
onde Z b Z x1
∼
f (x)dx = [y0 + (y1 − y0 ) · z]hdz
y1 − y0 a x0
∆y0 =
x1 − x0 Quando
Então x = a = x0 =⇒ z = 0
x = b = x1 =⇒ z = 1
y1 − y0
P1 (x) = y0 + (x − x0 )
x 1 − x0 Logo
Z b Z x1
Sendo ∼
f (x)dx = h [y0 + (y1 − y0 ) · z]dz
a x0
h = x1 − x 0
1
z2
Temos = h y0 z + (y1 − y0 )
2 0
x − x0 Logo
P1 (x) = y0 + (y1 − y0 )
h
1 2y0 + y1 − y0
Fazendo h y0 + (y1 − y0 ) = h
2 2
x − x0 h
z= =⇒ x = x0 + zh =⇒ = (y0 + y1 )
h 2
9
Caso Geral
h h h
At ∼
= A1 + A2 + A3 + ... + An = (y0 − y1 ) + (y2 + y3 ) + ... + (yn−2 + yn−1 ) + yn
2 2 2
h h
(y0 + 2y1 + 2y2 + 2y3 + ... + 2yn−1 + yn ) = [y0 + 2(y1 + y2 + y3 + ... + yn−1 ) + yn ]
2 2
1
1º Formula de Simpson ou método de 3
Data 02/06/2023
Pag.: 214
Z b Z x1
I= f (x)dx ∼
= P2 (x)dx
a x0
10
Caso Geral
Z b
I= f (x)dx ∼
= A1 + A2 + A3 + ... + An
a
h h h h
[y0 + 4y1 + y2 ] + [y2 + 4y3 + y4 ] + [y4 + 4y5 + y6 ] + ... + [yn−2 + 4yn−1 + yn ]
3 3 3 3
Fórmula:
h
I= [y0 + 4y1 + y2 + y2 + 4y3 + y4 + y4 + 4y5 + y6 + ... + yn−2 + 4yn−1 + yn ]
3
h
[y0 + 4y1 + 2y2 + +4y3 + 2y4 + ... + 4yn−1 + yn ]
3
h
[y0 + yn + 4(y1 + y3 + ... + yn1 ) + 2(y2 + y4 + ... + yn−2 )]
3
6.1 Exemplo 1
Calcular o valor π Dado pela expressão:
Z 1
dx
π=4 2
0 1+x
1
f (x) =
1 + x2
Com 8 subintervalos.
b−a 1−0
h= = = 0, 125
8 8
11
i xi yi
0 0 1
1 0,125 0,9846
2 0,250 0,9412
3 0,375 0,8767
4 0,500 0,800
5 0,625 0,7191
6 0,750 0,6400
7 0,875 0,5664
8 1 0,5
h
[y0 + yn + 4(y1 + y3 + ... + yn1 ) + 2(y2 + y4 + ... + yn−2 )]
3
Z 1
dx 0, 125
2
= [(1+0, 5)+4(0, 9846+0, 8767+0, 7191+0, 5664)+2(0, 9412+0, 8+0, 64)]
0 1+x 3
= 0, 7854
π∼
= 4 · 0, 7854 ∼
= 3, 1416
Exemplo 2
Z 1
I= x0,1 (1, 2 − x)(1 − e20(x−10) )dx
0
m=4
b−a 1−0 1
h= = = = 0, 25
4 4 4
i xi yi
0 0 0
1 0,25 0,82702
2 0,5 0,65309
3 0,75 0,43429
4 1 0
Z 1
I= x0,1 (1, 2 − x)(1 − e20(x−10) )dx =
0
0, 25
[(0 + 0) + 4(0, 82702 + 0, 43429) + 2(0, 65309)] ∼
= 0, 52929
3
3
2ª Fórmula de Simpson ou método de 8
Gráfico da foto
caso simples
Z b Z x3
I= f (x)dx ∼
= p3 (x)dx
a x0
12
onde
Resultado:
3h
I∼
= [y0 + 3y1 + 3y2 + y3 ] Fórmula Simples
8
caso geral
3h 3h
I∼= A1 + A2 + A3 + ... + An = [y0 + 3y1 + 3y2 + y3 ] + [y3 + 3y4 + 3y5 + y6 ] + ... +
8 8
3h
[yn−3 + 3yn−2 + 3yn−1 + yn ]
8
3h
[(y0 + yn ) + 3(y1 + y2 + y4 + y5 + ... + yn−1 ) + 2(y3 + y6 + y9 + ... + yn−3 )]
8
data 16/05/2023
pag.: 275
Uma equação que contem as derivadas ou diferenciais de uma ou mais variáveis de-
pendentes, em relação a uma ou mais variáveis independentes, é chamada de equação
diferencial (E.D).
Se uma equação contem somente derivadas ordinárias de uma ou mais variáveis de-
pendentes, com relação a uma única variável independente, ela é chamada de equação
Diferencial Ordinária (E.D.O).
Exemplos
dy
1. − 5y = 1
dx
2. (y − x)dx + 4xdy
dx dv
3. − =x
dy dx
d2 y dy
4. 2
− 2 + 6y = 0
dx dx
Uma equação que envolve as derivadas parciais de uma ou mais variáveis dependentes
de duas ou mais variáveis independentes é chamada de equação diferencial parcial (EDP).
13
exemplo
∂u ∂v
1. =−
∂y ∂x
∂u ∂u
2. x +y =u
∂x ∂y
∂ 2u ∂ 2u ∂u
3. 2
= 2
−2
∂x ∂t ∂t
São equação diferencias parciais.
A ordem da derivada de maior ordem em uma equação diferencial é, por definição, a
ordem da equação.
Uma E.D.O geral de enésima ordem é frequentemente representada pelo simbolismo
dn y dy dn−1 y
n
= f (x, y, dx , ..., dxn−1 )
dx
ou
dy n
d y
F (x, y, dx , ..., dxn)
Uma equação diferencial e chamada de linear quando pode ser escrita na forma:
dn y dn−1 y dy
an (x) n
+ a n−1 (x) + ... + a1 (x) a0 (x)y = g(x)
dx dxn − 1 dx
Observa que as equações diferencias lineares são caracterizadas por duas propriedades:
1. A variável dependentes e todas as suas derivadas são do primeiro grau: isto é, a
potencia de cada termo envolvendo y é 1.
Associado a essa equação, podem existir condições cujo o número coincide com a
ordem da E.D.O. Se tais condições se referem a único valor de x, tem-se um problema de
valor inicial (P.V.I). Caso contrário, tem-se um problema de valores de contorno.
Os tipos de P.V.I que será objeto deste estudo, é o mais simples, isto é, de primeira
ordem: (
y ′ = f (x, y)
y(x0 ) = yo = η, η um número dado
Solução numérica de um P.V.I de primeira ordem
14
7.5 Método de Euler
h ′ h2 ′′ h3 ′′′
y(x) = y(x0 ) + y (x0 ) + y (x0 ) + y (x0 ) + ...
1! 2! 3!
Método de Euler
para x = x1
para x = x2
y2 = y1 + h · f (x1 , y1 ))
Generalizando
(
y′ = x − y + 2
y(0) = 2
Solução: x0 = 0 ; y0 = 2 ; f (x, y) = x − y + 2
P/i = 1 temos:
x1 = x0 + 1 · h = 0 + 1 · 0.1 = 0.1
y1 = y0 + h · f (x0 , y0 )
15
∴ y1 = y0 + h · f (x0 , y0 ) = 2 + 0.1 · 0 = 2
=======================================================
P/i = 2 temos:
x2 = x1 + 1 · h = 0.1 + 1 · 0.1 = 0.2
y2 = y1 + h · f (x1 , y1 )
y3 = y2 + h · f (x2 , y2 )
y4 = y3 + h · f (x3 , y3 )
y5 = y4 + h · f (x4 , y4 )
y6 = y5 + h · f (x5 , y5 )
16
y7 = y6 + h · f (x6 , y6 )
y8 = y7 + h · f (x7 , y7 )
y9 = y8 + h · f (x8 , y8 )
y10 = y9 + h · f (x9 , y9 )
i x1 y1
0 0.0 2
1 0.1 2
2 0.2 2.010
3 0.3 2.029
4 0.4 2.056
5 0.5 2.090
6 0.6 2.131
7 0.7 2.178
8 0.8 2.230
9 0.9 2.287
10 1.0 2.348
17
Método de Runge-Kutta de 2ª ordem
23/06/2023
pag.: 288
Seja
yj+1 = yj + hϕ(xj , yj , h), j = 0, 1, ..., m − 1
Fazendo
ϕ(xj , yj , h) = αK1 + βK2
e substituindo na equação anterior, temos
Sejam (
K1 = f (xj , yj )
.
K2 = f (xj + ph, yj + qhf (xj , yj ))
As constantes α, β, p e q devem ser determinadas para que se obtenha os métodos de
Runge-Kutta de 2ª ordem.
1 1
Para a escolha β = , tem-se α = , p = 1 e q = 1 e o Método de Runge-Kutta (RK2)
2 2
vai ser dado por:
h
yj+1 = yj + 2 (K1 + K2 )
K1 = f (xj , yj )
K2 = f (xj + h, yj + hf (xj , yj ))
Exemplo 1
(
y′ = N y
y(0) = 1
Analiticamente
Z Z
dy
= N dx =⇒ ln y = N x + c =⇒ y = eN x+c = ec · eN x = C1 · eN x
y
Fazendo
x = 0, y = 1 =⇒ 1 = C1 · eN 0 =⇒ c1 = 1
logo
y = eN x , p/ N = 1 y = ex
18
Usando o método de Euler modificado.
b−a 1−0 1
h= = = = 0, 2
n 5 5
===================================================
p/ j = 0
Temos:
k1 = f (x0 , y0 ) = y0 = 1
k = f (x + h , y + h · K ) = y + h · K ) = 1 + 0,2 · 1 = 1, 1
2 0 2 0 2 1 0 2 1 2
y1 = y0 + h · K2 = 1 + 0, 2 · 1, 1 = 1, 22
x1 = x0 + h = 0 + 0, 2
===================================================
p/ j = 1
K1 = f (x1 , y1 ) = 1, 22
k = f (x + h , y + h · K ) = y + h · K = 1, 22 +
0,2
2 1 2 1 2 1 1 2 1 2
· 1, 22 = 1, 342
y2 = y1 + h · K2 = 1, 22 + 0, 2 · 1, 342 = 1, 4884
x2 = x1 + h = 0, 2 + 0, 2 = 0, 4
===================================================
p/ j = 2
K1 = f (x2 , y2 ) = 1, 4884
k = f (x + h , y + h · K ) = y + h · K = 1, 4884 + 0,2 · 1, 4884 = 1, 63724
2 2 2 2 2 1 2 2 1 2
y 3 = y 2 + h · K 2 = 1, 4884 + 0, 2 · 1, 63724 = 1, 815848
x3 = x2 + h = 0, 4 + 0, 2 = 0, 6
===================================================
p/ j = 3
K1 = f (x3 , y3 ) = 1, 815848
k = f (x + h , y + h · K ) = y + h · K = 1, 815848 + 0,2 · 1, 815848 = 1, 9974328
2 3 2 3 2 1 3 2 1 2
y4 = y3 + h · K2 = 1, 815848 + 0, 2 · 1, 9974328 = 2, 21533456
x4 = x3 + h = 0, 6 + 0, 2 = 0, 8
===================================================
19
p/ j = 4
K1 = f (x4 , y4 ) = 2, 21533456
k = f (x + h , y + h · K ) = y + h · K = 2, 21533456 + 0,2 · 2, 21533456 = 2, 4368680, 16
2 3 2 4 2 1 4 2 1 2
y 5 = y4 + h · K 2 = 2, 21533456 + 0, 2 · 2, 4368680, 16 = 2, 702708163
x5 = x4 + h = 0, 8 + 0, 2 = 1, 0
j xj yj
0 0 1
1 0,2 1,22
2 0,4 1,4884
3 0,6 1,815848
4 0,8 2,21533456
5 1,0 2,702708163
Exemplo 2
(
y′ = x − y + 2
y(0) = 2
[0, 1] com h = 0, 25
=====================================================
Fazendo uso, do método RK2 - Euler melhorado
f (x, y) = x − y + 2
b−a 1−0
n= = =4
h 0, 25
p/ j = 0
Temos:
k1 = f (x0 , y0 ) = y0 = 1
k = f (x + h , y + h · K ) = y + h · K ) = 1 +
0,2
2 0 2 0 2 1 0 2 1 2
· 1 = 1, 1
y1 = y 0 + h · K 2 = 1 + 0, 2 · 1, 1 = 1, 22
x1 = x0 + h = 0 + 0, 2
y ′ = y − 2x
y
y(0) = 1
[0, 2] com h = 0, 2
20