---
# System prepended metadata

title: Lista 8
tags: [Analiza Numeryczna (L)]

---

###### tags: `Analiza Numeryczna (L)`

# Lista 8

## 1
![](https://i.imgur.com/5074t6m.png)

$S(x)=
\begin{cases}
   S_1(x) = Ax^3+Bx^2+Cx+D  & \quad  x\{0,2\}\\
    S_2(x) = Ex^3+Fx^2+Gx+H  & \quad  x\{2,4\}
  \end{cases}$ 
  
$S'(x)=
\begin{cases}
   S_1'(x) = 3Ax^2+2Bx+C  & \quad  x\{0,2\}\\
    S_2'(x) = 3Ex^2+2Fx+G  & \quad  x\{2,4\}
  \end{cases}$ 
 
$S''(x)=
\begin{cases}
   S_1''(x) = 6Ax+2B  & \quad  x\{0,2\}\\
    S_2''(x) = 6Ex+2F  & \quad  x\{2,4\}
  \end{cases}$ 

$S_1(0) =-8$ => $D =-8$
$S_1(2) =S_2(2) = 8$ => $8A+4B+2C+D=8E+4F+2G+H =8$
$S_2(4) =-8$ => $64E+16F+4G+H =-8$

$S_1'(2)=S_2'(2)$  => $12A+4B+C = 12E+4F+G$

$S_1''(2)= S_2''(2)$ => $12A+2B = 12E+2F$
$S_1''(0)=0$ => $B =0$
$S_1''(4)=0$ => $24E+2F =0$


$D =-8$
$8A+4B+2C+D =8$
$8E+4F+2G+H =8$
$64E+16F+4G+H =-8$
$12A+4B+C = 12E+4F+G$
$12A+2B = 12E+2F$
$B =0$
$24E+2F =0$

Czyli:
A=-1
B=0
C=12
D=-8
E=1
F=-12
G=36
H=-24

więc:
$S(x)=
\begin{cases}
   S_1(x) = -x^3+12x-8  & \quad  x\{0,2\}\\
    S_2(x) = x^3-12x^2+36x-24  & \quad  x\{2,4\}
  \end{cases}$ 

![](https://i.imgur.com/7mqiukc.png)


$f[x_0,x_1,x_2]=-\frac83$
$f[x_1,x_2,x_3]=-\frac{56}{3}$

$h_1=x_1−x_0=\frac12$
$h_2=x_2−x_1=1$
$h_3=x_3−x_2=\frac12$

$λ_1=\frac{h_1}{h_1+h_2}=\frac13$
$λ_2=\frac{h_2}{h_2+h_3}=\frac23$

$λ_1 M_0 +2M_1+ (1−λ_1)M_2 =6f[x_0,x_1,x_2]$
$λ_2 M_1 +2M_2+ (1−λ_2)M_3 =6f[x_1,x_2,x_3]$

wiemy ze $M_0=M_3= 0$
$2M_1+ (1−\frac13)M_2 =6*-\frac83$
$\frac23 M_1 +2M_2 =6*-\frac{56}{3}$

$M_1=12$
$M_2=-60$


$S_1(x) =h^{−1}_1[\frac16 M_0(x_1−x)^3+\frac16 M_1(x−x_0)^3+(y_0−\frac16 M_0 h^2_1)(x_1−x) +(y_1−\frac16 M_1 h^2_1)(x−x_0)]=4x^3+12x^2+7x+3$


$S_2(x) =h^{−1}_2[\frac16 M_1(x_2−x)^3+\frac16 M_2(x−x_1)^3+(y_1−\frac16 M_1 h^2_2)(x_2−x) +(y_2−\frac16 M_2 h^2_2)(x−x_1)]=2 (1/2 - x)^3 + 4 (1/2 + x) - 10 (1/2 + x)^3$



$S_3(x) =h^{−1}_3[\frac16 M_2(x_3−x)^3+\frac16 M_3(x−x_2)^3+(y_2−\frac16 M_2 h^2_3)(x_3-x) +(y_3−\frac16 M_3 h^2_3)(x−x_2)]=20x^3-60x^2+19x-3$

## 2


$f(x)=
\begin{cases}
  x^3+6x^2+18x+13  & \quad  -2<x<-1\\
  -5x^3-12x^2+7  & \quad  -1<x<0\\
  5x^3-12x^2+7  & \quad  0<x<1\\
  -x^3+6x^2-18x+13  & \quad  1<x<2\\
  \end{cases}$ 
  
$f'(x)=
\begin{cases}
  3x^2+12x+18  & \quad  -2<x<-1\\
  -15x^2-24x  & \quad  -1<x<0\\
  15x^2-24x  & \quad  0<x<1\\
  -3x^2+12x-18  & \quad  1<x<2\\
  \end{cases}$ 
  
$f''(x)=
\begin{cases}
  6x+12  & \quad  -2<x<-1\\
  -30x-24  & \quad  -1<x<0\\
  30x-24  & \quad  0<x<1\\
  -6x+12  & \quad  1<x<2\\
  \end{cases}$

1. funkcja $f(x), f'(x), f''(x)$ jest ciągła na przedziale

**ciągłość f(x):**

$\lim_{x \to -1^-} (x^3+6x^2+18x+13) = 0 =\lim_{x \to -1^+} (-5x^3-12x^2+7)$
$\lim_{x \to 0^-} (-5x^3-12x^2+7) = 7 =\lim_{x \to 0^+} (5x^3-12x^2+7)$
$\lim_{x \to 1^-} (5x^3-12x^2+7) = 0 =\lim_{x \to 1^+} (-x^3+6x^2-18x+13)$

**ciągłość f'(x):**

$\lim_{x \to -1^-} (3x^2+12x+18) = 9 =\lim_{x \to -1^+} (-15x^2-24x)$
$\lim_{x \to 0^-} (-15x^2-24x) = 0 =\lim_{x \to 0^+} (15x^2-24x)$
$\lim_{x \to 1^-} (15x^2-24x) = -9 =\lim_{x \to 1^+} (-3x^2+12x-18)$


**ciągłość f''(x):**

$\lim_{x \to -1^-} (6x+12) = 6 =\lim_{x \to -1^+} (-30x-24)$
$\lim_{x \to 0^-} (-30x-24) = -24 =\lim_{x \to 0^+} (30x-24)$
$\lim_{x \to 1^-} (30x-24) = 6 =\lim_{x \to 1^+} (-6x+12)$


2. **funkcja jest naturalna**

$f''(x_0)= f''(-2) = 6x+12 =0$
$f''(x_0)= f''(2) = -6x+12 =0$

3. funkcja f w każdym przedziale

$[x_{k−1},x_k]$ jest wielomianem należącym do $Π_3$

## 3
![](https://i.imgur.com/Kk4pJKq.png)
$f'(x)=
\begin{cases}
  2020  & \quad  -2<x<-1\\
  3ax^2+2bx+c  & \quad  -1<x<1\\
  -2020  & \quad  1<x<2
  \end{cases}$ 
  
$f''(x)=
\begin{cases}
  0  & \quad  -2<x<-1\\
  6ax+2b  & \quad  -1<x<1\\
  0  & \quad  1<x<2
  \end{cases}$ 
  
**ciągłość f(x):**

$f_1(-1)=f_2(-1)$ => $-2020 = -a+b-c+d$
$f_2(1)=f_3(1)$ => $2020=a+b+c+d$
  
**ciągłość f'(x):**

$f_1'(-1)=f_2'(-1)$ => $2020 = 3a-2b+c$
$f_2'(1)=f_3'(1)$ => $-2020=3a+2b+c$

**ciągłość f''(x):**

$f_1''(-1)=f_2''(-1)$ => $0 = -6a+2b$
$f_2''(1)=f_3''(1)$ => $6a+2b=0$

**dostajemy układ równań**
$0 = -6a+2b$
$6a+2b=0$
$-2020=3a+2b+c$
$2020 = 3a-2b+c$
$-2020 = -a+b-c+d$
$2020=a+b+c+d$

Co daje nam sprzeczność.

## 4


```
q[0] := u[0] := 0

dla (k = 1, 2, ..., n-1)
    d[k] := 6 * f(x[k-1], x[k], x[k+1])
    p[k] := λ[k] * q[k-1] + 2
    q[k] := (λ[k] - 1) / p[k]
    u[k] := (d[k] -  λ[k] * u[k-1]) / p[k]
    
wtedy:
    M[0] = M[n] = 0
    M[n-1] = u[n-1]
    
    dla (k = n-2, n-3, ..., 1)
        M[k] = u[k] + q[k] * M[k+1]
```
wszystkie $M_k$ dla  $k\{0,1,...,n\}$ otrzymajemy w czasie O(n)



**d-d:**

indukcja

$λ_kM_{k−1}+ 2M_k+ (1−λ_k)M_{k+1}=d_k$

**1$^\circ$** dla k = 1
$p_1=2$
$u_1=\frac{d_1-\lambda u_0}{p_1}=\frac{d_1}{2}$
$q_1=\frac{\lambda_1-1}{p_1}=\frac{\lambda_1-1}2$

$λ_1M_{0}+ 2M_1+ (1−λ_1)M_{2}=d_1$ / : 2

$M_1 + \frac{(1−λ_1)M_{2}}2=\frac{d_1}{2}$
$M_1 - \frac{(λ_1-1)M_{2}}2=\frac{d_1}{2}$
$M_1 - q_1\times M_{2}=\frac{d_1}{2}$
$M_1 = q_1\times M_{2} + \frac{d_1}{2}$
$M_1 = q_1\times M_{2} + u_1$

**2$^\circ$** dla k + 1, zakładając, że dla k działa

$λ_{k+1}M_{k}+ 2M_{k+1}+ (1−λ_{k+1})M_{k+2}=d_{k+1}$

$M_k = u_k + q_k \times M_{k+1}$ / $\times\lambda_{k+1}$

$M_k\times\lambda_{k+1}= u_k\times\lambda_{k+1} + q_k \times M_{k+1}\times\lambda_{k+1}$


$M_k\times\lambda_{k+1} - q_k \times M_{k+1}\times\lambda_{k+1} = u_k\times\lambda_{k+1}$

Odejmuje stronami równanie
$λ_{k+1}M_{k}+ 2M_{k+1}+ (1−λ_{k+1})M_{k+2}=d_{k+1}$

$-M_{k+1}(q_k \times\lambda_{k+1} + 2) -(1−λ_{k+1})M_{k+2}= u_k\times\lambda_{k+1} - d_{k+1}$

$M_{k+1}(q_k \times\lambda_{k+1} + 2) -(λ_{k+1}-1)M_{k+2}=  d_{k+1} -u_k\times\lambda_{k+1}$ / $: p_{k+1}$

$M_{k+1}\frac{(q_k \times\lambda_{k+1} + 2)}{p_{k+1}} -\frac{(λ_{k+1}-1)}{p_{k+1}}M_{k+2}=  \frac{d_{k+1} -u_k\times\lambda_{k+1}}{p_{k+1}}$

$M_{k+1}\frac{p_{k+1}}{p_{k+1}} -q_{k+1}M_{k+2}=  u_{k+1}$

$M_{k+1} -q_{k+1}M_{k+2}=  u_{k+1}$

$M_{k+1} =  u_{k+1} + q_{k+1}M_{k+2}$

Na podstawie indukcji matematycznej udowodniłem wzór.