Diferencia entre revisiones de «Series de Fourier (Grupo DMR)»
(→Base trigonométrica compleja) |
(→Base trigonométrica compleja) |
||
| (No se muestran 69 ediciones intermedias de 3 usuarios) | |||
| Línea 3: | Línea 3: | ||
=Introducción= | =Introducción= | ||
| − | + | En un espacio de Hilbert <math>L_2(a,b)</math>, una serie de Fourier converge en norma <math>L_2</math> a una función real de variable real, <math>f</math>, que se puede representar mediante la base trigonométrica de Fourier como | |
| − | + | ||
| − | En un espacio de Hilbert <math> | + | |
| Línea 41: | Línea 39: | ||
<math>\quad | <math>\quad | ||
| − | f(x) \sim \frac{a_0}{2} + \sum_{n=1}^\infty\left[a_n\cos \left( nx \right) + b_n\sin \left( nx \right) \right] = \frac{a_0}{2} + \sum_{n=1}^\infty\left[\frac{a_n}{2}(e^{inx}+e^{-inx}) + \frac{b_n}{2i}(e^{inx}-e^{-inx}) \right] = c_0 + \sum_{n=1}^\infty\left[c_n e^{inx} +c_{-n} e^{-inx} \right]=</math><math> \sum_{n=0}^\infty c_n e^{inx} + \sum_{n=-\infty}^{-1} c_n e^{inx} =\sum_{n=-\infty}^\infty c_n e^{inx}, </math> | + | f(x) \sim \frac{a_0}{2} + \sum_{n=1}^\infty\left[a_n\cos \left( nx \right) + b_n\sin \left( nx \right) \right] = \frac{a_0}{2} + \sum_{n=1}^\infty\left[\frac{a_n}{2}(e^{inx}+e^{-inx}) + \frac{b_n}{2i}(e^{inx}-e^{-inx}) \right] |
| + | </math> | ||
| + | <math> | ||
| + | =c_0 + \sum_{n=1}^\infty\left[c_n e^{inx} +c_{-n} e^{-inx} \right]=</math><math> \sum_{n=0}^\infty c_n e^{inx} + \sum_{n=-\infty}^{-1} c_n e^{inx} =\sum_{n=-\infty}^\infty c_n e^{inx}, </math> | ||
| − | donde <math> c_0:=\frac{a_0}{2}</math>, <math> c_n:=\frac{a_n-ib_n}{2} </math> y <math> c_{-n}:=\frac{a_n+ib_n}{2} </math>. Decimos que este desarrollo es formal por el penúltimo paso | + | donde <math> c_0:=\frac{a_0}{2}</math>, <math> c_n:=\frac{a_n-ib_n}{2} </math> y <math> c_{-n}:=\frac{a_n+ib_n}{2} </math>. Decimos que este desarrollo es formal por el penúltimo paso, notemos que estamos reordenando sumandos. |
De esta forma hemos obtenido la base trigonométrica compleja | De esta forma hemos obtenido la base trigonométrica compleja | ||
| + | |||
<math>\quad | <math>\quad | ||
\{e_n := e^{ inx }\}_{n \in \mathbb{Z}} | \{e_n := e^{ inx }\}_{n \in \mathbb{Z}} | ||
</math>. | </math>. | ||
| − | |||
| − | |||
| Línea 76: | Línea 76: | ||
Una observación relevante es que como la norma de cada elemento de la base es siempre <math> \sqrt{2\pi} </math>, podemos ortonormalizar dividiendo precisamente por esta constante a cada elemento de la base trigonométrica compleja. | Una observación relevante es que como la norma de cada elemento de la base es siempre <math> \sqrt{2\pi} </math>, podemos ortonormalizar dividiendo precisamente por esta constante a cada elemento de la base trigonométrica compleja. | ||
| + | |||
| + | [[Archivo:Base(DMR).gif|500px|thumb|right|(Pinchar) Términos de la base <math> \{e_n := e^{ inx }\}_{n} </math> para <math>n \in \{-1,0,1,2\}</math> en referencia tridimensional con eje real y plano complejo.]] | ||
| + | |||
| + | <source lang="matlab"> | ||
| + | %%% Código generado junto con Chat GPT para la representación de la base trigonométrica compleja. | ||
| + | |||
| + | clc | ||
| + | clear all | ||
| + | close all | ||
| + | |||
| + | %%% Planteamiento | ||
| + | x = linspace(-pi, pi, 10000); | ||
| + | n_values = [-1, 0, 1, 2]; | ||
| + | |||
| + | %%% Visualizacion animada de la base | ||
| + | pelicula=VideoWriter('baseanimada.avi'); | ||
| + | pelicula.FrameRate=100; | ||
| + | open(pelicula); | ||
| + | |||
| + | figura=figure(1); | ||
| + | hold on; | ||
| + | xlabel('x'); | ||
| + | ylabel('Re(f(x))'); | ||
| + | zlabel('Im(f(x))'); | ||
| + | sgtitle('Representación de \{e^{inx}\}', 'Interpreter', 'tex') | ||
| + | grid on; | ||
| + | legend; | ||
| + | view(3); | ||
| + | axis([-pi,pi,-1.5,1.5,-1.5,1.5]); | ||
| + | |||
| + | |||
| + | h = gobjects(1, length(n_values)); | ||
| + | |||
| + | for i = 1:length(n_values) | ||
| + | z = exp(1i*n_values(i)*x); | ||
| + | h(i) = plot3(NaN, NaN, NaN,'LineWidth', 1.75, 'DisplayName', ... | ||
| + | sprintf('n = %d', n_values(i))); | ||
| + | |||
| + | end | ||
| + | |||
| + | for k = 1:70:length(x) | ||
| + | for i = 1:length(n_values) | ||
| + | z = exp(1i * n_values(i) * x); | ||
| + | set(h(i), 'XData', x(1:k), 'YData', real(z(1:k)), ... | ||
| + | 'ZData', imag(z(1:k))); | ||
| + | imagen=getframe(figura); | ||
| + | writeVideo(pelicula,imagen); | ||
| + | end | ||
| + | drawnow; | ||
| + | pause(10^(-10)); | ||
| + | end | ||
| + | |||
| + | hold off; | ||
| + | close(pelicula); | ||
| + | </source> | ||
=Extensión impar= | =Extensión impar= | ||
| − | + | {| class="wikitable" style="text-allign:justify;width:200px; float:right; font-size:90%;" | |
| + | |+ Representación gráfica de <math> f^*(x)</math>. | ||
| + | |- | ||
| + | | [[Archivo:Figura6DMR.jpg|400px]] | ||
| + | |- | ||
| + | | [[Archivo:ImparfDMR_V2.jpg|400px]] | ||
| + | |- | ||
| + | | Representación de <math>f^*</math> con eje <math>x</math> y el plano complejo en la parte superior, mientras que representamos abajo parte real (izquierda) e imaginaria (derecha). | ||
| + | |} | ||
| − | <math> | + | Nos podemos plantear cómo aproximar la siguiente función <math> f </math> |
| − | |||
| − | + | <math>\quad | |
| + | \begin{align} | ||
| + | f: [0,1] \subseteq \mathbb{R} &\longrightarrow \mathbb{C} \\ | ||
| + | x &\mapsto 4x(\frac{1}{2} − x)^2 + ix. | ||
| + | \end{align} | ||
| + | </math> | ||
| − | <math> | + | Notemos que el intervalo de definición no es simétrico. Extendamos <math> f </math> de forma impar |
| − | <math> x \mapsto \begin{cases} 4x(\frac{1}{2} + x)^2 + ix \text{ , si } x\in [-1,0]\\ | + | |
| + | <math>\quad | ||
| + | \begin{align} | ||
| + | f^*: [-1,1] \subseteq \mathbb{R} &\longrightarrow \mathbb{C} \\ | ||
| + | x &\mapsto \begin{cases} 4x(\frac{1}{2} + x)^2 + ix \text{ , si } x\in [-1,0],\\ | ||
| − | 4x(\frac{1}{2} - x)^2 + ix \text{ , si } x\in [0,1] | + | 4x(\frac{1}{2} - x)^2 + ix \text{ , si } x\in [0,1]. |
\end{cases} | \end{cases} | ||
| + | \end{align} | ||
</math> | </math> | ||
| − | Tras representar esta función | + | Tras representar esta función en las imágenes adjuntas, sólo nos falta adaptar la base <math> \{e^{n i x}\}_{n \in \mathbb{Z}}</math> al nuevo intervalo. Comprobemos que como |
| − | <math> | + | <math>\quad |
| − | \{e^{\pi n ix }\}_{n \in \mathbb{Z}} : ( | + | \{e^{\pi n ix }\}_{n \in \mathbb{Z}} : (e^{\pi n ix},e^{\pi m ix})_{L^2[-1,1]} = \int_{-1}^1 e^{\pi (n-m)i} \,dx = \begin{cases} |
\int_{-1}^1 1 dx = 2 \text{ , si } n = m, \\ | \int_{-1}^1 1 dx = 2 \text{ , si } n = m, \\ | ||
0 \text{ , si } n \neq m, | 0 \text{ , si } n \neq m, | ||
| Línea 109: | Línea 181: | ||
| − | entonces es una base ortogonal, habiéndonos basado fuertemente en la periodicidad en el intervalo para el segundo caso. | + | entonces <math> \{e^{\pi n ix }\}_{n \in \mathbb{Z}}</math> es una base ortogonal en <math>[-1,1]</math>, habiéndonos basado fuertemente en la periodicidad en el intervalo para el segundo caso. Ahora, podemos ortonormalizarla dividiendo por la norma común a todos los elementos, <math> \sqrt{2} </math>. Esto define la base ortonormal |
| − | <math> | + | |
| − | \{E_n\}_{n \in \mathbb{Z}} := \{\frac{\sqrt{2}e^{\pi n ix }}{2}\}_{n \in \mathbb{Z}}. | + | <math>\quad |
| + | \{E_n\}_{n \in \mathbb{Z}} := \left\{\frac{\sqrt{2}e^{\pi n ix }}{2}\right\}_{n \in \mathbb{Z}}. | ||
</math> | </math> | ||
| Línea 120: | Línea 193: | ||
| + | <math>\quad | ||
| + | f^*(x) \sim \sum_{n=-\infty}^{\infty} C_nE_n = \sum_{n=-\infty}^{\infty} C_ne^{\pi n i}, \quad | ||
| + | </math> | ||
<math> | <math> | ||
| − | + | \quad C_n = (f^*,E_n)_{L^2[-1,1]} = \int_{-1}^1 f^*(x) \overline{E}_n(x) \,dx \in \mathbb{C}. | |
</math> | </math> | ||
| + | |||
| + | {| class="wikitable" style="text-align:justify; width:500px; float:right; font-size:80%;" | ||
| + | |+ Aproximaciones mediante base trigonométrica compleja. | ||
| + | |- | ||
| + | | [[Archivo:Figure2fDMR.jpg|320px]] || [[Archivo:Erroresf.jpg|320px]] | ||
| + | |- | ||
| + | | [[Archivo:Figure3fDMR.jpg|320px]] || [[Archivo:TrapeciofDMR.jpg|320px]] | ||
| + | |- | ||
| + | | colspan="2" | Representación de aproximaciones con elementos hasta <math> n = 5,10,20 </math> en tres dimensiones, parte real de las aproximaciones y parte imaginaria respectivamente en esquinas superior izquierda y ambas de abajo. Mejora visiblemente, aunque difieran los extremos, reflejado en los errores representados en la esquina superior derecha. | ||
| + | |} | ||
| Línea 128: | Línea 214: | ||
| − | <math> f(x) \approx \sum_{i=-n}^{n} C_iE_{i|[0,1]} </math> | + | <math> \quad |
| + | f(x) \approx \sum_{i=-n}^{n} C_iE_{i\big{|}[0,1]}. | ||
| + | </math> | ||
| − | + | Vemos que la aproximación mejora el error en norma <math>L_2</math>, algo que esperábamos por continuidad de <math>f</math> y su extensión impar. Además, como | |
| − | + | <math> | |
| + | f(1) \neq \frac{f^*(-1)+f^*(1)}{2} = 0 | ||
| + | </math> | ||
| − | + | por ser impar, las aproximaciones convergerán puntualmente a <math> 0 </math> en el valor <math> x=1 </math>. No hay convergencia uniforme porque es necesario que la convergencia puntual de las aproximaciones sucesivas fuese <math> f </math> en todo punto de <math>[0,1]</math>. De hecho, el mayor error se obtiene aquí como <math>|f(1)-f_n(1)|=|1+i|=\sqrt{2}. </math> | |
| + | |||
| + | |||
| + | Podemos verificar que esta base también es útil con funciones reales aproximando <math>\text{Re}f </math> con una extensión impar (representado gráficamente a continuación), precisamente <math>\text{Re}f^* </math>. Por el mismo procedimiento, base y código, logramos de nuevo aproximaciones que convergen en norma del espacio de funciones pero no uniformemente, una vez más por el problema que causa <math> x=1 </math>, donde de nuevo se halla el mayor error con <math>|f(1)-f_n(1)|=|1|=1. </math> | ||
=Código= | =Código= | ||
| + | |||
| + | {| class="wikitable" style="text-align:justify; width:200px; float:right; font-size:90%;" | ||
| + | |+ Aproximaciones mediante base trigonométrica compleja. | ||
| + | |- | ||
| + | | [[Archivo:Figure2RefDMR.jpg|500px]] || [[Archivo:ErroresRef.jpg|500px]] | ||
| + | |- | ||
| + | | [[Archivo:Figure3RefDMR.jpg|500px]] || [[Archivo:TrapecioRefDMR.jpg|500px]] | ||
| + | |- | ||
| + | | colspan="2" | Análogamente a <math> f^* </math>, las aproximaciones revelan ser capaces de tomar valores reales a pesar de partir de elementos con parte imaginaria no trivial. La aproximación vuelve a ser por norma del espacio de funciones pero no uniforme por el valor en <math> x=1 </math>. | ||
| + | |} | ||
| + | |||
| + | [[Archivo:Figura6RefDMR.jpg|500px|thumb|right|Representando esta función real de variable real en las mismas referencias que con <math> f^* </math>, puede comprobarse que es precisamente su proyección ortogonal en el plano horizontal, claramente con parte imaginaria nula por estar definida como parte real de una función de valores complejos.]] | ||
| + | |||
| + | <syntaxhighlight lang="matlab"> | ||
| + | %%% Código generado junto con Chat GPT para aproximación y representación de gráficas. | ||
| + | |||
| + | clc | ||
| + | clear all | ||
| + | close all | ||
| + | |||
| + | %%% Planteamiento | ||
| + | xx = 0:10^(-3):1; | ||
| + | xy = -1:10^(-3):0; | ||
| + | haux = @(x)(4*x.*(1/2 - x).^2 + 1i*x); | ||
| + | hauximp = @(x)-(4*x.*(1/2 - x).^2 + 1i*x); | ||
| + | yy=[hauximp(xx(end:-1:1)),haux(xx)]; | ||
| + | |||
| + | %%% Comprobacion de la extension impar | ||
| + | figure(1) | ||
| + | plot3([xy,xx], real(yy), imag(yy), 'r', 'LineWidth', 1.75) | ||
| + | xline(0); | ||
| + | yline(0); | ||
| + | axis equal | ||
| + | xlim([-1, 1]) | ||
| + | ylim([-1, 1]) | ||
| + | xlabel('x'); | ||
| + | ylabel('Re(f(x))'); | ||
| + | zlabel('Im(f(x))'); | ||
| + | view(3) | ||
| + | grid on | ||
| + | hold off | ||
| + | |||
| + | figure(2) | ||
| + | subplot(1,2,1) | ||
| + | hold on | ||
| + | xlabel('x'); | ||
| + | ylabel('R'); | ||
| + | plot(xx, real(haux(xx)), 'r', 'LineWidth', 1.5) | ||
| + | plot(xy, real(hauximp(xx(end:-1:1))), ... | ||
| + | 'r', 'LineWidth', 1.5) | ||
| + | title('\rm Extensión impar de la función f(x)', 'Interpreter', 'tex') | ||
| + | grid on | ||
| + | subplot(1,2,2) | ||
| + | hold on | ||
| + | xlabel('x'); | ||
| + | ylabel('iR'); | ||
| + | plot(xx, imag(haux(xx)), 'r', 'LineWidth', 1.5) | ||
| + | plot(xy, imag(hauximp(xx(end:-1:1))), ... | ||
| + | 'r', 'LineWidth', 1.5) | ||
| + | title('\rm Extensión impar de la función f(x)', 'Interpreter', 'tex') | ||
| + | grid on | ||
| + | |||
| + | |||
| + | xx=[xy,xx]; | ||
| + | N = [5,10,20]; | ||
| + | |||
| + | %%% Inicializacion los vectores de errores | ||
| + | L2_errors = zeros(length(N), 1); | ||
| + | uniform_errors = zeros(length(N), 1); | ||
| + | |||
| + | aux = 1; | ||
| + | for n = N %%% Aproximacion la funcion por la regla del trapecio | ||
| + | a = zeros(1, n); | ||
| + | b = zeros(1, n); | ||
| + | fn = trapz(xx, yy/sqrt(2)) * ones(1, length(xx)); | ||
| + | |||
| + | for k = 1:n | ||
| + | a(k) = trapz(xx, yy .* ... | ||
| + | conj(exp(1i*k*pi*xx)/sqrt(2))); | ||
| + | b(k) = trapz(xx, yy .* ... | ||
| + | conj(exp(1i*(-k)*pi*xx)/sqrt(2))); | ||
| + | |||
| + | fn = fn + a(k) * exp(1i*k*pi*xx)/sqrt(2) + ... | ||
| + | b(k) * exp(1i*(-k)*pi*xx)/sqrt(2); | ||
| + | end | ||
| + | |||
| + | %%% Visualizacion de los resultados | ||
| + | figure(3) | ||
| + | subplot(1, length(N), aux) | ||
| + | plot3(xx, real(yy), imag(yy), 'r', 'LineWidth', 1.75) | ||
| + | hold on | ||
| + | plot3(xx, real(fn), imag(fn), 'b', 'LineWidth', 1.75) | ||
| + | xline(0); | ||
| + | yline(0); | ||
| + | axis equal | ||
| + | xlim([-1, 1]) | ||
| + | ylim([-1, 1]) | ||
| + | legend({'$f(x)$', '$f_n(x)$'}, ... | ||
| + | 'Interpreter', 'latex', 'Location', 'northwest') | ||
| + | xlabel('x'); | ||
| + | ylabel('Re(f(x))'); | ||
| + | zlabel('Im(f(x))'); | ||
| + | title(['n = ', num2str(n)], 'Interpreter', 'latex') | ||
| + | view(3) | ||
| + | grid on | ||
| + | hold off | ||
| + | |||
| + | %%% Parte real | ||
| + | figure(4) | ||
| + | subplot(1, length(N), aux) | ||
| + | plot3(xx, real(yy), imag(yy), 'r', 'LineWidth', 1.75) | ||
| + | hold on | ||
| + | plot3(xx, real(fn), imag(fn), 'b', 'LineWidth', 1.75) | ||
| + | xline(0); | ||
| + | yline(0); | ||
| + | axis equal | ||
| + | xlim([-1, 1]) | ||
| + | ylim([-1, 1]) | ||
| + | legend({'$f(x)$', '$f_n(x)$'}, ... | ||
| + | 'Interpreter', 'latex', 'Location', 'northwest') | ||
| + | xlabel('x'); | ||
| + | ylabel('Re(f(x))'); | ||
| + | zlabel('Im(f(x))'); | ||
| + | title(['n = ', num2str(n)], 'Interpreter', 'latex') | ||
| + | view(2) | ||
| + | grid on | ||
| + | hold off | ||
| + | |||
| + | %%% Parte imaginaria | ||
| + | figure(5) | ||
| + | subplot(1, length(N), aux) | ||
| + | plot3(xx, imag(yy), real(yy), 'r', 'LineWidth', 1.75) | ||
| + | hold on | ||
| + | plot3(xx, imag(fn), real(fn), 'b', 'LineWidth', 1.75) | ||
| + | xline(0); | ||
| + | yline(0); | ||
| + | axis equal | ||
| + | xlim([-1, 1]) | ||
| + | ylim([-1, 1]) | ||
| + | legend({'$f(x)$', '$f_n(x)$'}, ... | ||
| + | 'Interpreter', 'latex', 'Location', 'northwest') | ||
| + | xlabel('x'); | ||
| + | ylabel('Im(f(x))'); | ||
| + | zlabel('Re(f(x))'); | ||
| + | title(['n = ', num2str(n)], 'Interpreter', 'latex') | ||
| + | view(2) | ||
| + | grid on | ||
| + | hold off | ||
| + | |||
| + | %%% Guardamos los errores | ||
| + | L2_errors(aux) = sqrt(trapz(xx, abs(yy - fn).^2)); | ||
| + | uniform_errors(aux) = max(abs(yy - fn)); | ||
| + | aux = aux + 1; | ||
| + | end | ||
| + | |||
| + | sgtitle('Aproximación de la función por la regla del trapecio', ... | ||
| + | 'Interpreter', 'latex'); | ||
| + | |||
| + | %%% Visualizacion de los errores | ||
| + | figure(6); | ||
| + | hold on; | ||
| + | plot(N, L2_errors, 'b-', 'LineWidth', 2); | ||
| + | plot(N, uniform_errors, 'r--', 'LineWidth', 2); | ||
| + | grid on | ||
| + | xlabel('n'); | ||
| + | ylabel('Error'); | ||
| + | legend('Error L2', 'Error uniforme'); | ||
| + | sgtitle('Errores en normas L2 y uniforme en función de n', ... | ||
| + | 'Interpreter', 'latex'); | ||
| + | hold off; | ||
| + | </syntaxhighlight> | ||
| + | |||
[[Categoría:EDP]] | [[Categoría:EDP]] | ||
[[Categoría:EDP24/25]] | [[Categoría:EDP24/25]] | ||
Revisión actual del 20:16 14 feb 2025
| Trabajo realizado por estudiantes | |
|---|---|
| Título | Series de Fourier (Grupo DMR). |
| Asignatura | EDP |
| Curso | 2024-25 |
| Autores | Daniel Rodríguez Calderón, Marcos Cabellos Hernández, Rafael Pascual Ortega. |
| Este artículo ha sido escrito por estudiantes como parte de su evaluación en la asignatura | |
1 Introducción
En un espacio de Hilbert [math]L_2(a,b)[/math], una serie de Fourier converge en norma [math]L_2[/math] a una función real de variable real, [math]f[/math], que se puede representar mediante la base trigonométrica de Fourier como
[math] \quad
f(x) \sim \frac{a_0}{2} + \sum_{n=1}^\infty\left[a_n\cos \left( nx \right) + b_n\sin \left( nx \right) \right]
[/math].
Esta representación nos permite, tomando una suma parcial de la serie, aproximar a [math] f [/math]. Sin embargo, la base trigonométrica no se presta a la aproximación de funciones de variable real y valores complejos. Esta carencia nos lleva a la base trigonométrica compleja: considerando seno y coseno complejos, somos capaces de aproximar funciones de variable real y valores complejos o reales indistintamente. Esta base, con dominio [math] [-\pi,\pi] [/math]
[math]
\quad \{e^{inx}\}_{n \in \mathbb{Z}} ,
[/math]
será nuestro foco de atención. La obtendremos formalmente a partir de la base trigonométrica original, para luego visualizarla y comprobar su capacidad para aproximar.
2 Base trigonométrica compleja
Para obtener la base compleja, partamos de la trigonométrica. Por la fórmula de Euler, podemos reescribir coseno y seno de la forma
[math]\quad
\cos\theta = \frac{1}{2} (e^{i\theta} + e^{-i\theta})
[/math]
[math]\quad[/math] y [math]\quad[/math]
[math]
\sin\theta = \frac{1}{2i} (e^{i\theta} - e^{-i\theta})
[/math].
Así, en [math] [-\pi,\pi] [/math], [math]f[/math] puede representarse formalmente como
[math]\quad
f(x) \sim \frac{a_0}{2} + \sum_{n=1}^\infty\left[a_n\cos \left( nx \right) + b_n\sin \left( nx \right) \right] = \frac{a_0}{2} + \sum_{n=1}^\infty\left[\frac{a_n}{2}(e^{inx}+e^{-inx}) + \frac{b_n}{2i}(e^{inx}-e^{-inx}) \right]
[/math]
[math]
=c_0 + \sum_{n=1}^\infty\left[c_n e^{inx} +c_{-n} e^{-inx} \right]=[/math][math] \sum_{n=0}^\infty c_n e^{inx} + \sum_{n=-\infty}^{-1} c_n e^{inx} =\sum_{n=-\infty}^\infty c_n e^{inx}, [/math]
donde [math] c_0:=\frac{a_0}{2}[/math], [math] c_n:=\frac{a_n-ib_n}{2} [/math] y [math] c_{-n}:=\frac{a_n+ib_n}{2} [/math]. Decimos que este desarrollo es formal por el penúltimo paso, notemos que estamos reordenando sumandos.
De esta forma hemos obtenido la base trigonométrica compleja
[math]\quad
\{e_n := e^{ inx }\}_{n \in \mathbb{Z}}
[/math].
Usando el producto escalar, comprobemos que es una base ortogonal
[math]\quad
(e_n,e_m)_{L^2} = \int_{-\pi}^{\pi} e_n \overline{e_m} \,dx = \int_{-\pi}^{\pi} e^{inx} e^{-imx} \,dx =
\int_{-\pi}^{\pi} e^{(n-m)ix} \,dx = \frac{-i}{n-m} e^{(n-m)ix} \Big|_{-\pi}^{\pi} = 0 \quad \text{si } n \neq m, \\
[/math]
[math]\quad
(e_n,e_n)_{L^2} = \int_{-\pi}^{\pi} e^{(n-n)ix} \,dx = 2\pi.
[/math]
Aquí fijémonos en que hemos usado el producto escalar en [math]L^2(-\pi,\pi)[/math] dado por
[math]\quad
(f,g)_{L^2} = \int_{-\pi}^{\pi} f(x) \hspace{0.2cm} \overline{g(x)} \,dx
[/math].
Una observación relevante es que como la norma de cada elemento de la base es siempre [math] \sqrt{2\pi} [/math], podemos ortonormalizar dividiendo precisamente por esta constante a cada elemento de la base trigonométrica compleja.
%%% Código generado junto con Chat GPT para la representación de la base trigonométrica compleja.
clc
clear all
close all
%%% Planteamiento
x = linspace(-pi, pi, 10000);
n_values = [-1, 0, 1, 2];
%%% Visualizacion animada de la base
pelicula=VideoWriter('baseanimada.avi');
pelicula.FrameRate=100;
open(pelicula);
figura=figure(1);
hold on;
xlabel('x');
ylabel('Re(f(x))');
zlabel('Im(f(x))');
sgtitle('Representación de \{e^{inx}\}', 'Interpreter', 'tex')
grid on;
legend;
view(3);
axis([-pi,pi,-1.5,1.5,-1.5,1.5]);
h = gobjects(1, length(n_values));
for i = 1:length(n_values)
z = exp(1i*n_values(i)*x);
h(i) = plot3(NaN, NaN, NaN,'LineWidth', 1.75, 'DisplayName', ...
sprintf('n = %d', n_values(i)));
end
for k = 1:70:length(x)
for i = 1:length(n_values)
z = exp(1i * n_values(i) * x);
set(h(i), 'XData', x(1:k), 'YData', real(z(1:k)), ...
'ZData', imag(z(1:k)));
imagen=getframe(figura);
writeVideo(pelicula,imagen);
end
drawnow;
pause(10^(-10));
end
hold off;
close(pelicula);3 Extensión impar
Nos podemos plantear cómo aproximar la siguiente función [math] f [/math]
[math]\quad
\begin{align}
f: [0,1] \subseteq \mathbb{R} &\longrightarrow \mathbb{C} \\
x &\mapsto 4x(\frac{1}{2} − x)^2 + ix.
\end{align}
[/math]
Notemos que el intervalo de definición no es simétrico. Extendamos [math] f [/math] de forma impar
[math]\quad
\begin{align}
f^*: [-1,1] \subseteq \mathbb{R} &\longrightarrow \mathbb{C} \\
x &\mapsto \begin{cases} 4x(\frac{1}{2} + x)^2 + ix \text{ , si } x\in [-1,0],\\
4x(\frac{1}{2} - x)^2 + ix \text{ , si } x\in [0,1].
\end{cases}
\end{align}
[/math]
Tras representar esta función en las imágenes adjuntas, sólo nos falta adaptar la base [math] \{e^{n i x}\}_{n \in \mathbb{Z}}[/math] al nuevo intervalo. Comprobemos que como
[math]\quad
\{e^{\pi n ix }\}_{n \in \mathbb{Z}} : (e^{\pi n ix},e^{\pi m ix})_{L^2[-1,1]} = \int_{-1}^1 e^{\pi (n-m)i} \,dx = \begin{cases}
\int_{-1}^1 1 dx = 2 \text{ , si } n = m, \\
0 \text{ , si } n \neq m,
\end{cases}
[/math]
entonces [math] \{e^{\pi n ix }\}_{n \in \mathbb{Z}}[/math] es una base ortogonal en [math][-1,1][/math], habiéndonos basado fuertemente en la periodicidad en el intervalo para el segundo caso. Ahora, podemos ortonormalizarla dividiendo por la norma común a todos los elementos, [math] \sqrt{2} [/math]. Esto define la base ortonormal
[math]\quad \{E_n\}_{n \in \mathbb{Z}} := \left\{\frac{\sqrt{2}e^{\pi n ix }}{2}\right\}_{n \in \mathbb{Z}}. [/math]
Para realizar las aproximaciones, necesitamos los coeficientes de cada elemento que consideremos, que pueden obtenerse por ortonormalidad de la base mediante el producto escalar ya que
[math]\quad
f^*(x) \sim \sum_{n=-\infty}^{\infty} C_nE_n = \sum_{n=-\infty}^{\infty} C_ne^{\pi n i}, \quad
[/math]
[math]
\quad C_n = (f^*,E_n)_{L^2[-1,1]} = \int_{-1}^1 f^*(x) \overline{E}_n(x) \,dx \in \mathbb{C}.
[/math]
Podemos estimar estos coeficientes [math] C_n [/math] numéricamente por fórmula del trapecio, y así aproximar la función para un número dado de [math] E_n [/math]. La aproximación con los elementos de la base de [math]-n[/math] a [math]n[/math] será entonces
[math] \quad
f(x) \approx \sum_{i=-n}^{n} C_iE_{i\big{|}[0,1]}.
[/math]
Vemos que la aproximación mejora el error en norma [math]L_2[/math], algo que esperábamos por continuidad de [math]f[/math] y su extensión impar. Además, como
[math]
f(1) \neq \frac{f^*(-1)+f^*(1)}{2} = 0
[/math]
por ser impar, las aproximaciones convergerán puntualmente a [math] 0 [/math] en el valor [math] x=1 [/math]. No hay convergencia uniforme porque es necesario que la convergencia puntual de las aproximaciones sucesivas fuese [math] f [/math] en todo punto de [math][0,1][/math]. De hecho, el mayor error se obtiene aquí como [math]|f(1)-f_n(1)|=|1+i|=\sqrt{2}. [/math]
Podemos verificar que esta base también es útil con funciones reales aproximando [math]\text{Re}f [/math] con una extensión impar (representado gráficamente a continuación), precisamente [math]\text{Re}f^* [/math]. Por el mismo procedimiento, base y código, logramos de nuevo aproximaciones que convergen en norma del espacio de funciones pero no uniformemente, una vez más por el problema que causa [math] x=1 [/math], donde de nuevo se halla el mayor error con [math]|f(1)-f_n(1)|=|1|=1. [/math]
4 Código
%%% Código generado junto con Chat GPT para aproximación y representación de gráficas.
clc
clear all
close all
%%% Planteamiento
xx = 0:10^(-3):1;
xy = -1:10^(-3):0;
haux = @(x)(4*x.*(1/2 - x).^2 + 1i*x);
hauximp = @(x)-(4*x.*(1/2 - x).^2 + 1i*x);
yy=[hauximp(xx(end:-1:1)),haux(xx)];
%%% Comprobacion de la extension impar
figure(1)
plot3([xy,xx], real(yy), imag(yy), 'r', 'LineWidth', 1.75)
xline(0);
yline(0);
axis equal
xlim([-1, 1])
ylim([-1, 1])
xlabel('x');
ylabel('Re(f(x))');
zlabel('Im(f(x))');
view(3)
grid on
hold off
figure(2)
subplot(1,2,1)
hold on
xlabel('x');
ylabel('R');
plot(xx, real(haux(xx)), 'r', 'LineWidth', 1.5)
plot(xy, real(hauximp(xx(end:-1:1))), ...
'r', 'LineWidth', 1.5)
title('\rm Extensión impar de la función f(x)', 'Interpreter', 'tex')
grid on
subplot(1,2,2)
hold on
xlabel('x');
ylabel('iR');
plot(xx, imag(haux(xx)), 'r', 'LineWidth', 1.5)
plot(xy, imag(hauximp(xx(end:-1:1))), ...
'r', 'LineWidth', 1.5)
title('\rm Extensión impar de la función f(x)', 'Interpreter', 'tex')
grid on
xx=[xy,xx];
N = [5,10,20];
%%% Inicializacion los vectores de errores
L2_errors = zeros(length(N), 1);
uniform_errors = zeros(length(N), 1);
aux = 1;
for n = N %%% Aproximacion la funcion por la regla del trapecio
a = zeros(1, n);
b = zeros(1, n);
fn = trapz(xx, yy/sqrt(2)) * ones(1, length(xx));
for k = 1:n
a(k) = trapz(xx, yy .* ...
conj(exp(1i*k*pi*xx)/sqrt(2)));
b(k) = trapz(xx, yy .* ...
conj(exp(1i*(-k)*pi*xx)/sqrt(2)));
fn = fn + a(k) * exp(1i*k*pi*xx)/sqrt(2) + ...
b(k) * exp(1i*(-k)*pi*xx)/sqrt(2);
end
%%% Visualizacion de los resultados
figure(3)
subplot(1, length(N), aux)
plot3(xx, real(yy), imag(yy), 'r', 'LineWidth', 1.75)
hold on
plot3(xx, real(fn), imag(fn), 'b', 'LineWidth', 1.75)
xline(0);
yline(0);
axis equal
xlim([-1, 1])
ylim([-1, 1])
legend({'$f(x)$', '$f_n(x)$'}, ...
'Interpreter', 'latex', 'Location', 'northwest')
xlabel('x');
ylabel('Re(f(x))');
zlabel('Im(f(x))');
title(['n = ', num2str(n)], 'Interpreter', 'latex')
view(3)
grid on
hold off
%%% Parte real
figure(4)
subplot(1, length(N), aux)
plot3(xx, real(yy), imag(yy), 'r', 'LineWidth', 1.75)
hold on
plot3(xx, real(fn), imag(fn), 'b', 'LineWidth', 1.75)
xline(0);
yline(0);
axis equal
xlim([-1, 1])
ylim([-1, 1])
legend({'$f(x)$', '$f_n(x)$'}, ...
'Interpreter', 'latex', 'Location', 'northwest')
xlabel('x');
ylabel('Re(f(x))');
zlabel('Im(f(x))');
title(['n = ', num2str(n)], 'Interpreter', 'latex')
view(2)
grid on
hold off
%%% Parte imaginaria
figure(5)
subplot(1, length(N), aux)
plot3(xx, imag(yy), real(yy), 'r', 'LineWidth', 1.75)
hold on
plot3(xx, imag(fn), real(fn), 'b', 'LineWidth', 1.75)
xline(0);
yline(0);
axis equal
xlim([-1, 1])
ylim([-1, 1])
legend({'$f(x)$', '$f_n(x)$'}, ...
'Interpreter', 'latex', 'Location', 'northwest')
xlabel('x');
ylabel('Im(f(x))');
zlabel('Re(f(x))');
title(['n = ', num2str(n)], 'Interpreter', 'latex')
view(2)
grid on
hold off
%%% Guardamos los errores
L2_errors(aux) = sqrt(trapz(xx, abs(yy - fn).^2));
uniform_errors(aux) = max(abs(yy - fn));
aux = aux + 1;
end
sgtitle('Aproximación de la función por la regla del trapecio', ...
'Interpreter', 'latex');
%%% Visualizacion de los errores
figure(6);
hold on;
plot(N, L2_errors, 'b-', 'LineWidth', 2);
plot(N, uniform_errors, 'r--', 'LineWidth', 2);
grid on
xlabel('n');
ylabel('Error');
legend('Error L2', 'Error uniforme');
sgtitle('Errores en normas L2 y uniforme en función de n', ...
'Interpreter', 'latex');
hold off;