<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
		<id>https://mat.caminos.upm.es/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mario+Alonso</id>
		<title>MateWiki - Contribuciones del usuario [es]</title>
		<link rel="self" type="application/atom+xml" href="https://mat.caminos.upm.es/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mario+Alonso"/>
		<link rel="alternate" type="text/html" href="https://mat.caminos.upm.es/wiki/Especial:Contribuciones/Mario_Alonso"/>
		<updated>2026-04-23T10:39:40Z</updated>
		<subtitle>Contribuciones del usuario</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>https://mat.caminos.upm.es/w/index.php?title=Ecuacion_del_calor_MAM&amp;diff=104577</id>
		<title>Ecuacion del calor MAM</title>
		<link rel="alternate" type="text/html" href="https://mat.caminos.upm.es/w/index.php?title=Ecuacion_del_calor_MAM&amp;diff=104577"/>
				<updated>2026-04-12T20:23:13Z</updated>
		
		<summary type="html">&lt;p&gt;Mario Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ TrabajoED | Ecuación del calor. Grupo MAM| [[:Categoría:EDP|EDP]]|[[:Categoría:EDP25/26|2025-26]] | Mario ALonso Rodríguez&lt;br /&gt;
Adrián Moreno Nieto&lt;br /&gt;
&lt;br /&gt;
Matías Martínez Mancebo }}&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Ecuación del calor MAM.png||800px]]&lt;br /&gt;
[[Medio:Ecuación del calor MAM.pdf| PDF del póster]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Abajo se puede ver el código que se ha utilizado para conseguir las gráficas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import numpy as np&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
# Define the heat equation solution&lt;br /&gt;
def heat_solution(x, t):&lt;br /&gt;
    if t &amp;lt;= 0:&lt;br /&gt;
        return 0&lt;br /&gt;
    return (1 / np.sqrt(2 * t)) * np.exp(-x**2 / (4 * t))&lt;br /&gt;
&lt;br /&gt;
# Create grid&lt;br /&gt;
x = np.linspace(-5, 5, 100)&lt;br /&gt;
t = np.linspace(0.1, 2, 50)  # Avoid t=0&lt;br /&gt;
X, T = np.meshgrid(x, t)&lt;br /&gt;
Z = np.vectorize(heat_solution)(X, T)&lt;br /&gt;
&lt;br /&gt;
# Plot 3D surface&lt;br /&gt;
fig = plt.figure()&lt;br /&gt;
ax = fig.add_subplot(111, projection='3d')&lt;br /&gt;
ax.plot_surface(X, T, Z, cmap='viridis')&lt;br /&gt;
ax.set_xlabel('x')&lt;br /&gt;
ax.set_ylabel('t')&lt;br /&gt;
ax.set_zlabel('u(x,t)')&lt;br /&gt;
ax.set_title('Solución fundamental de la ecuación del calor')&lt;br /&gt;
plt.show()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import numpy as np&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
# Solución fundamental correcta de la ecuación del calor&lt;br /&gt;
def G(x, t):&lt;br /&gt;
    return (1 / np.sqrt(4 * np.pi * t)) * np.exp(-x**2 / (4 * t))&lt;br /&gt;
&lt;br /&gt;
# Tiempos que queremos comparar&lt;br /&gt;
times = [0.05, 0.1, 0.2, 0.5, 1, 2]&lt;br /&gt;
&lt;br /&gt;
# Dominio espacial&lt;br /&gt;
x = np.linspace(-10, 10, 2000)&lt;br /&gt;
&lt;br /&gt;
# Crear una sola gráfica&lt;br /&gt;
plt.figure(figsize=(7, 5))&lt;br /&gt;
&lt;br /&gt;
# -------------------------&lt;br /&gt;
# Perfiles originales&lt;br /&gt;
# -------------------------&lt;br /&gt;
for t in times:&lt;br /&gt;
    plt.plot(x, G(x, t), label=f&amp;quot;t = {t}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
plt.title(&amp;quot;Solución fundamental para distintos tiempos&amp;quot;)&lt;br /&gt;
plt.xlabel(&amp;quot;x&amp;quot;)&lt;br /&gt;
plt.ylabel(&amp;quot;G(x,t)&amp;quot;)&lt;br /&gt;
plt.grid(True)&lt;br /&gt;
plt.legend()&lt;br /&gt;
&lt;br /&gt;
plt.tight_layout()&lt;br /&gt;
plt.show()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Categoría:EDP]]&lt;br /&gt;
[[Categoría:EDP25/26]]&lt;/div&gt;</summary>
		<author><name>Mario Alonso</name></author>	</entry>

	<entry>
		<id>https://mat.caminos.upm.es/w/index.php?title=Archivo:Ecuaci%C3%B3n_del_calor_MAM.png&amp;diff=104576</id>
		<title>Archivo:Ecuación del calor MAM.png</title>
		<link rel="alternate" type="text/html" href="https://mat.caminos.upm.es/w/index.php?title=Archivo:Ecuaci%C3%B3n_del_calor_MAM.png&amp;diff=104576"/>
				<updated>2026-04-12T20:22:32Z</updated>
		
		<summary type="html">&lt;p&gt;Mario Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mario Alonso</name></author>	</entry>

	<entry>
		<id>https://mat.caminos.upm.es/w/index.php?title=Archivo:Ecuaci%C3%B3n_del_calor_MAM.pdf&amp;diff=104575</id>
		<title>Archivo:Ecuación del calor MAM.pdf</title>
		<link rel="alternate" type="text/html" href="https://mat.caminos.upm.es/w/index.php?title=Archivo:Ecuaci%C3%B3n_del_calor_MAM.pdf&amp;diff=104575"/>
				<updated>2026-04-12T20:20:20Z</updated>
		
		<summary type="html">&lt;p&gt;Mario Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mario Alonso</name></author>	</entry>

	<entry>
		<id>https://mat.caminos.upm.es/w/index.php?title=Ecuacion_del_calor_MAM&amp;diff=104574</id>
		<title>Ecuacion del calor MAM</title>
		<link rel="alternate" type="text/html" href="https://mat.caminos.upm.es/w/index.php?title=Ecuacion_del_calor_MAM&amp;diff=104574"/>
				<updated>2026-04-12T20:19:14Z</updated>
		
		<summary type="html">&lt;p&gt;Mario Alonso: Página creada con «{{ TrabajoED | Ecuación del calor. Grupo LÁJ| EDP|2025-26 | Mario ALonso Rodríguez Adrián Moreno Nieto  Matías Martínez M...»&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ TrabajoED | Ecuación del calor. Grupo LÁJ| [[:Categoría:EDP|EDP]]|[[:Categoría:EDP25/26|2025-26]] | Mario ALonso Rodríguez&lt;br /&gt;
Adrián Moreno Nieto&lt;br /&gt;
&lt;br /&gt;
Matías Martínez Mancebo }}&lt;br /&gt;
&lt;br /&gt;
[[Archivo:Ecuación del calor MAM.png||800px]]&lt;br /&gt;
[[Medio:Ecuación del calor MAM.pdf| PDF del póster]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Abajo se puede ver el código que se ha utilizado para conseguir las gráficas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import numpy as np&lt;br /&gt;
from mpl_toolkits.mplot3d import Axes3D&lt;br /&gt;
&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
# Define the heat equation solution&lt;br /&gt;
def heat_solution(x, t):&lt;br /&gt;
    if t &amp;lt;= 0:&lt;br /&gt;
        return 0&lt;br /&gt;
    return (1 / np.sqrt(2 * t)) * np.exp(-x**2 / (4 * t))&lt;br /&gt;
&lt;br /&gt;
# Create grid&lt;br /&gt;
x = np.linspace(-5, 5, 100)&lt;br /&gt;
t = np.linspace(0.1, 2, 50)  # Avoid t=0&lt;br /&gt;
X, T = np.meshgrid(x, t)&lt;br /&gt;
Z = np.vectorize(heat_solution)(X, T)&lt;br /&gt;
&lt;br /&gt;
# Plot 3D surface&lt;br /&gt;
fig = plt.figure()&lt;br /&gt;
ax = fig.add_subplot(111, projection='3d')&lt;br /&gt;
ax.plot_surface(X, T, Z, cmap='viridis')&lt;br /&gt;
ax.set_xlabel('x')&lt;br /&gt;
ax.set_ylabel('t')&lt;br /&gt;
ax.set_zlabel('u(x,t)')&lt;br /&gt;
ax.set_title('Solución fundamental de la ecuación del calor')&lt;br /&gt;
plt.show()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import numpy as np&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
# Solución fundamental correcta de la ecuación del calor&lt;br /&gt;
def G(x, t):&lt;br /&gt;
    return (1 / np.sqrt(4 * np.pi * t)) * np.exp(-x**2 / (4 * t))&lt;br /&gt;
&lt;br /&gt;
# Tiempos que queremos comparar&lt;br /&gt;
times = [0.05, 0.1, 0.2, 0.5, 1, 2]&lt;br /&gt;
&lt;br /&gt;
# Dominio espacial&lt;br /&gt;
x = np.linspace(-10, 10, 2000)&lt;br /&gt;
&lt;br /&gt;
# Crear una sola gráfica&lt;br /&gt;
plt.figure(figsize=(7, 5))&lt;br /&gt;
&lt;br /&gt;
# -------------------------&lt;br /&gt;
# Perfiles originales&lt;br /&gt;
# -------------------------&lt;br /&gt;
for t in times:&lt;br /&gt;
    plt.plot(x, G(x, t), label=f&amp;quot;t = {t}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
plt.title(&amp;quot;Solución fundamental para distintos tiempos&amp;quot;)&lt;br /&gt;
plt.xlabel(&amp;quot;x&amp;quot;)&lt;br /&gt;
plt.ylabel(&amp;quot;G(x,t)&amp;quot;)&lt;br /&gt;
plt.grid(True)&lt;br /&gt;
plt.legend()&lt;br /&gt;
&lt;br /&gt;
plt.tight_layout()&lt;br /&gt;
plt.show()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Categoría:EDP]]&lt;br /&gt;
[[Categoría:EDP25/26]]&lt;/div&gt;</summary>
		<author><name>Mario Alonso</name></author>	</entry>

	<entry>
		<id>https://mat.caminos.upm.es/w/index.php?title=Series_de_Fourier_MAM&amp;diff=104375</id>
		<title>Series de Fourier MAM</title>
		<link rel="alternate" type="text/html" href="https://mat.caminos.upm.es/w/index.php?title=Series_de_Fourier_MAM&amp;diff=104375"/>
				<updated>2026-02-23T21:16:30Z</updated>
		
		<summary type="html">&lt;p&gt;Mario Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ TrabajoED | Series de Fourier. Grupo MAM| [[:Categoría:EDP|EDP]]|[[:Categoría:EDP25/26|2025-26]] | Mario Alonso Rodríguez&lt;br /&gt;
&lt;br /&gt;
Adrián Nieto Moreno&lt;br /&gt;
&lt;br /&gt;
Matías Martínez Mancebo}}&lt;br /&gt;
&lt;br /&gt;
[[Archivo:POSTER_FOURIER_MAM.png||800px]]&lt;br /&gt;
[[Archivo:POSTERFOURIER_mam.pdf]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Abajo se puede ver el código que se ha utilizado para conseguir las gráficas:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
import numpy as np&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Funciones objetivo&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def signo(x):&lt;br /&gt;
    return np.sign(x)&lt;br /&gt;
&lt;br /&gt;
def integral_signo(x):&lt;br /&gt;
    return np.abs(x)&lt;br /&gt;
&lt;br /&gt;
def derivada_signo(x):&lt;br /&gt;
    # Derivada clásica: 0 para x != 0 (en x=0 no existe; ignoramos el delta)&lt;br /&gt;
    return np.zeros_like(x)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Serie de Fourier de signo(x)&lt;br /&gt;
# signo(x) ~ (4/pi) * sum_{k=1..n} sin((2k-1)x)/(2k-1)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def serie_fourier_signo(x, n):&lt;br /&gt;
    k = np.arange(1, n + 1)&lt;br /&gt;
    m = 2 * k - 1  # impares&lt;br /&gt;
    # sum over m: sin(m x)/m&lt;br /&gt;
    return (4 / np.pi) * np.sum(np.sin(np.outer(m, x)) / m[:, None], axis=0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Integral de la serie (aprox de |x|)&lt;br /&gt;
# |x| = pi/2 - (4/pi) * sum_{k=1..∞} cos((2k-1)x)/(2k-1)^2&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def integral_serie_fourier_signo(x, n):&lt;br /&gt;
    k = np.arange(1, n + 1)&lt;br /&gt;
    m = 2 * k - 1&lt;br /&gt;
    return (np.pi / 2) - (4 / np.pi) * np.sum(np.cos(np.outer(m, x)) / (m[:, None] ** 2), axis=0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Derivada de la serie (ojo: no converge a la derivada clásica en x=0)&lt;br /&gt;
# d/dx [serie] = (4/pi) * sum_{k=1..n} cos((2k-1)x)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def derivada_serie_fourier_signo(x, n):&lt;br /&gt;
    k = np.arange(1, n + 1)&lt;br /&gt;
    m = 2 * k - 1&lt;br /&gt;
    return (4 / np.pi) * np.sum(np.cos(np.outer(m, x)), axis=0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Norma L2: ||f-g||_2 = sqrt( ∫ |f-g|^2 dx )&lt;br /&gt;
# (integral numérica con trapecios)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def l2_error(x, f, g):&lt;br /&gt;
    return np.sqrt(np.trapz((f - g) ** 2, x))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Plantilla: figura (aprox) + (error L2 vs n)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def figura_aprox_y_error(&lt;br /&gt;
    x,&lt;br /&gt;
    f_true_func,&lt;br /&gt;
    f_aprox_func,&lt;br /&gt;
    titulo_izq,&lt;br /&gt;
    titulo_der,&lt;br /&gt;
    n_list_plot=(5, 10, 30),&lt;br /&gt;
    n_max_error=200,&lt;br /&gt;
    ylims_izq=None&lt;br /&gt;
):&lt;br /&gt;
    f_true = f_true_func(x)&lt;br /&gt;
&lt;br /&gt;
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 5))&lt;br /&gt;
&lt;br /&gt;
    # --- Izquierda: curvas ---&lt;br /&gt;
    ax1.plot(x, f_true, linewidth=3, label=&amp;quot;Función objetivo&amp;quot;, color=&amp;quot;black&amp;quot;)&lt;br /&gt;
    for n in n_list_plot:&lt;br /&gt;
        ax1.plot(x, f_aprox_func(x, n), linewidth=2, label=f&amp;quot;Fourier (n={n})&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    ax1.set_title(titulo_izq)&lt;br /&gt;
    ax1.set_xlabel(&amp;quot;x&amp;quot;)&lt;br /&gt;
    ax1.set_ylabel(&amp;quot;y&amp;quot;)&lt;br /&gt;
    ax1.grid(True, alpha=0.3)&lt;br /&gt;
    ax1.legend()&lt;br /&gt;
    if ylims_izq is not None:&lt;br /&gt;
        ax1.set_ylim(ylims_izq)&lt;br /&gt;
&lt;br /&gt;
    # --- Derecha: error L2 vs n ---&lt;br /&gt;
    ns = np.arange(1, n_max_error + 1)&lt;br /&gt;
    errs = np.array([l2_error(x, f_true, f_aprox_func(x, n)) for n in ns])&lt;br /&gt;
&lt;br /&gt;
    ax2.plot(ns, errs, linewidth=2, label=r&amp;quot;Error $L^2$: $||f - S_n||_2$&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # marcar los n usados en la izquierda&lt;br /&gt;
    for n in n_list_plot:&lt;br /&gt;
        ax2.scatter([n], [errs[n - 1]], s=60)&lt;br /&gt;
&lt;br /&gt;
    ax2.set_title(titulo_der)&lt;br /&gt;
    ax2.set_xlabel(&amp;quot;n&amp;quot;)&lt;br /&gt;
    ax2.set_ylabel(r&amp;quot;$||f - S_n||_2$&amp;quot;)&lt;br /&gt;
    ax2.grid(True, alpha=0.3)&lt;br /&gt;
    ax2.legend()&lt;br /&gt;
&lt;br /&gt;
    plt.tight_layout()&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Dominio (más puntos =&amp;gt; integral numérica más estable)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
x = np.linspace(-np.pi, np.pi, 4000)&lt;br /&gt;
&lt;br /&gt;
# Elige los n que quieres dibujar en la izquierda&lt;br /&gt;
n_list = (5, 10, 30)&lt;br /&gt;
&lt;br /&gt;
# 1) signo(x)&lt;br /&gt;
figura_aprox_y_error(&lt;br /&gt;
    x,&lt;br /&gt;
    f_true_func=signo,&lt;br /&gt;
    f_aprox_func=serie_fourier_signo,&lt;br /&gt;
    titulo_izq=&amp;quot;Aproximación por series de Fourier de la función signo&amp;quot;,&lt;br /&gt;
    titulo_der=r&amp;quot;Error $L^2$ vs $n$&amp;quot;,&lt;br /&gt;
    n_list_plot=n_list,&lt;br /&gt;
    n_max_error=200,&lt;br /&gt;
    ylims_izq=(-1.5, 1.5)&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
# 2) Integral -&amp;gt; |x|&lt;br /&gt;
figura_aprox_y_error(&lt;br /&gt;
    x,&lt;br /&gt;
    f_true_func=integral_signo,&lt;br /&gt;
    f_aprox_func=integral_serie_fourier_signo,&lt;br /&gt;
    titulo_izq=&amp;quot;Integral: aproximación de |x| mediante Fourier&amp;quot;,&lt;br /&gt;
    titulo_der=r&amp;quot;Error $L^2$ vs $n$ (integral)&amp;quot;,&lt;br /&gt;
    n_list_plot=(1, 3, 5),  # menos n porque converge más rápido&lt;br /&gt;
    n_max_error=200,&lt;br /&gt;
    ylims_izq=(0, np.pi)&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
# 3) Derivada (comparada con 0)&lt;br /&gt;
# Nota: este “error” no tenderá a 0, porque la derivada real incluye una singularidad en 0.&lt;br /&gt;
figura_aprox_y_error(&lt;br /&gt;
    x,&lt;br /&gt;
    f_true_func=derivada_signo,&lt;br /&gt;
    f_aprox_func=derivada_serie_fourier_signo,&lt;br /&gt;
    titulo_izq=&amp;quot;Derivada de la serie de Fourier (comparada con 0)&amp;quot;,&lt;br /&gt;
    titulo_der=r&amp;quot;Error $L^2$ vs $n$ (derivada)&amp;quot;,&lt;br /&gt;
    n_list_plot=n_list,&lt;br /&gt;
    n_max_error=200,&lt;br /&gt;
    ylims_izq=(-10, 10)&lt;br /&gt;
)   &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bibliografía ==&lt;br /&gt;
&lt;br /&gt;
* [https://mat.caminos.upm.es/wiki/Categor%C3%ADa:EDP Categoría: EDP], MateWiki, Universidad Politécnica de Madrid.&lt;br /&gt;
&lt;br /&gt;
* Sanders, J. A.; Verhulst, F.; Murdock, J., ''Partial Differential Equations in Action: From Modelling to Theory'', Springer, 2016.&lt;br /&gt;
&lt;br /&gt;
* Evans, L. C., ''Partial Differential Equations'', Graduate Studies in Mathematics, Vol. 19, American Mathematical Society, 2010.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Categoría:EDP]]&lt;br /&gt;
[[Categoría:EDP25/26]]&lt;/div&gt;</summary>
		<author><name>Mario Alonso</name></author>	</entry>

	<entry>
		<id>https://mat.caminos.upm.es/w/index.php?title=Archivo:POSTERFOURIER_mam.pdf&amp;diff=104374</id>
		<title>Archivo:POSTERFOURIER mam.pdf</title>
		<link rel="alternate" type="text/html" href="https://mat.caminos.upm.es/w/index.php?title=Archivo:POSTERFOURIER_mam.pdf&amp;diff=104374"/>
				<updated>2026-02-23T21:16:00Z</updated>
		
		<summary type="html">&lt;p&gt;Mario Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Mario Alonso</name></author>	</entry>

	<entry>
		<id>https://mat.caminos.upm.es/w/index.php?title=Series_de_Fourier_MAM&amp;diff=104355</id>
		<title>Series de Fourier MAM</title>
		<link rel="alternate" type="text/html" href="https://mat.caminos.upm.es/w/index.php?title=Series_de_Fourier_MAM&amp;diff=104355"/>
				<updated>2026-02-19T07:51:34Z</updated>
		
		<summary type="html">&lt;p&gt;Mario Alonso: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ TrabajoED | Series de Fourier. Grupo MAM| [[:Categoría:EDP|EDP]]|[[:Categoría:EDP25/26|2025-26]] | Mario Alonso Rodríguez&lt;br /&gt;
&lt;br /&gt;
Adrián Nieto Moreno&lt;br /&gt;
&lt;br /&gt;
Matías Martínez Mancebo}}&lt;br /&gt;
&lt;br /&gt;
[[Archivo:POSTER_FOURIER_MAM.png||800px]]&lt;br /&gt;
[[Archivo:PosterFourierMAM.pdf]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Abajo se puede ver el código que se ha utilizado para conseguir las gráficas:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
import numpy as np&lt;br /&gt;
import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Funciones objetivo&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def signo(x):&lt;br /&gt;
    return np.sign(x)&lt;br /&gt;
&lt;br /&gt;
def integral_signo(x):&lt;br /&gt;
    return np.abs(x)&lt;br /&gt;
&lt;br /&gt;
def derivada_signo(x):&lt;br /&gt;
    # Derivada clásica: 0 para x != 0 (en x=0 no existe; ignoramos el delta)&lt;br /&gt;
    return np.zeros_like(x)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Serie de Fourier de signo(x)&lt;br /&gt;
# signo(x) ~ (4/pi) * sum_{k=1..n} sin((2k-1)x)/(2k-1)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def serie_fourier_signo(x, n):&lt;br /&gt;
    k = np.arange(1, n + 1)&lt;br /&gt;
    m = 2 * k - 1  # impares&lt;br /&gt;
    # sum over m: sin(m x)/m&lt;br /&gt;
    return (4 / np.pi) * np.sum(np.sin(np.outer(m, x)) / m[:, None], axis=0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Integral de la serie (aprox de |x|)&lt;br /&gt;
# |x| = pi/2 - (4/pi) * sum_{k=1..∞} cos((2k-1)x)/(2k-1)^2&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def integral_serie_fourier_signo(x, n):&lt;br /&gt;
    k = np.arange(1, n + 1)&lt;br /&gt;
    m = 2 * k - 1&lt;br /&gt;
    return (np.pi / 2) - (4 / np.pi) * np.sum(np.cos(np.outer(m, x)) / (m[:, None] ** 2), axis=0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Derivada de la serie (ojo: no converge a la derivada clásica en x=0)&lt;br /&gt;
# d/dx [serie] = (4/pi) * sum_{k=1..n} cos((2k-1)x)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def derivada_serie_fourier_signo(x, n):&lt;br /&gt;
    k = np.arange(1, n + 1)&lt;br /&gt;
    m = 2 * k - 1&lt;br /&gt;
    return (4 / np.pi) * np.sum(np.cos(np.outer(m, x)), axis=0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Norma L2: ||f-g||_2 = sqrt( ∫ |f-g|^2 dx )&lt;br /&gt;
# (integral numérica con trapecios)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def l2_error(x, f, g):&lt;br /&gt;
    return np.sqrt(np.trapz((f - g) ** 2, x))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Plantilla: figura (aprox) + (error L2 vs n)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
def figura_aprox_y_error(&lt;br /&gt;
    x,&lt;br /&gt;
    f_true_func,&lt;br /&gt;
    f_aprox_func,&lt;br /&gt;
    titulo_izq,&lt;br /&gt;
    titulo_der,&lt;br /&gt;
    n_list_plot=(5, 10, 30),&lt;br /&gt;
    n_max_error=200,&lt;br /&gt;
    ylims_izq=None&lt;br /&gt;
):&lt;br /&gt;
    f_true = f_true_func(x)&lt;br /&gt;
&lt;br /&gt;
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 5))&lt;br /&gt;
&lt;br /&gt;
    # --- Izquierda: curvas ---&lt;br /&gt;
    ax1.plot(x, f_true, linewidth=3, label=&amp;quot;Función objetivo&amp;quot;, color=&amp;quot;black&amp;quot;)&lt;br /&gt;
    for n in n_list_plot:&lt;br /&gt;
        ax1.plot(x, f_aprox_func(x, n), linewidth=2, label=f&amp;quot;Fourier (n={n})&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    ax1.set_title(titulo_izq)&lt;br /&gt;
    ax1.set_xlabel(&amp;quot;x&amp;quot;)&lt;br /&gt;
    ax1.set_ylabel(&amp;quot;y&amp;quot;)&lt;br /&gt;
    ax1.grid(True, alpha=0.3)&lt;br /&gt;
    ax1.legend()&lt;br /&gt;
    if ylims_izq is not None:&lt;br /&gt;
        ax1.set_ylim(ylims_izq)&lt;br /&gt;
&lt;br /&gt;
    # --- Derecha: error L2 vs n ---&lt;br /&gt;
    ns = np.arange(1, n_max_error + 1)&lt;br /&gt;
    errs = np.array([l2_error(x, f_true, f_aprox_func(x, n)) for n in ns])&lt;br /&gt;
&lt;br /&gt;
    ax2.plot(ns, errs, linewidth=2, label=r&amp;quot;Error $L^2$: $||f - S_n||_2$&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # marcar los n usados en la izquierda&lt;br /&gt;
    for n in n_list_plot:&lt;br /&gt;
        ax2.scatter([n], [errs[n - 1]], s=60)&lt;br /&gt;
&lt;br /&gt;
    ax2.set_title(titulo_der)&lt;br /&gt;
    ax2.set_xlabel(&amp;quot;n&amp;quot;)&lt;br /&gt;
    ax2.set_ylabel(r&amp;quot;$||f - S_n||_2$&amp;quot;)&lt;br /&gt;
    ax2.grid(True, alpha=0.3)&lt;br /&gt;
    ax2.legend()&lt;br /&gt;
&lt;br /&gt;
    plt.tight_layout()&lt;br /&gt;
    plt.show()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# -----------------------------&lt;br /&gt;
# Dominio (más puntos =&amp;gt; integral numérica más estable)&lt;br /&gt;
# -----------------------------&lt;br /&gt;
x = np.linspace(-np.pi, np.pi, 4000)&lt;br /&gt;
&lt;br /&gt;
# Elige los n que quieres dibujar en la izquierda&lt;br /&gt;
n_list = (5, 10, 30)&lt;br /&gt;
&lt;br /&gt;
# 1) signo(x)&lt;br /&gt;
figura_aprox_y_error(&lt;br /&gt;
    x,&lt;br /&gt;
    f_true_func=signo,&lt;br /&gt;
    f_aprox_func=serie_fourier_signo,&lt;br /&gt;
    titulo_izq=&amp;quot;Aproximación por series de Fourier de la función signo&amp;quot;,&lt;br /&gt;
    titulo_der=r&amp;quot;Error $L^2$ vs $n$&amp;quot;,&lt;br /&gt;
    n_list_plot=n_list,&lt;br /&gt;
    n_max_error=200,&lt;br /&gt;
    ylims_izq=(-1.5, 1.5)&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
# 2) Integral -&amp;gt; |x|&lt;br /&gt;
figura_aprox_y_error(&lt;br /&gt;
    x,&lt;br /&gt;
    f_true_func=integral_signo,&lt;br /&gt;
    f_aprox_func=integral_serie_fourier_signo,&lt;br /&gt;
    titulo_izq=&amp;quot;Integral: aproximación de |x| mediante Fourier&amp;quot;,&lt;br /&gt;
    titulo_der=r&amp;quot;Error $L^2$ vs $n$ (integral)&amp;quot;,&lt;br /&gt;
    n_list_plot=(1, 3, 5),  # menos n porque converge más rápido&lt;br /&gt;
    n_max_error=200,&lt;br /&gt;
    ylims_izq=(0, np.pi)&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
# 3) Derivada (comparada con 0)&lt;br /&gt;
# Nota: este “error” no tenderá a 0, porque la derivada real incluye una singularidad en 0.&lt;br /&gt;
figura_aprox_y_error(&lt;br /&gt;
    x,&lt;br /&gt;
    f_true_func=derivada_signo,&lt;br /&gt;
    f_aprox_func=derivada_serie_fourier_signo,&lt;br /&gt;
    titulo_izq=&amp;quot;Derivada de la serie de Fourier (comparada con 0)&amp;quot;,&lt;br /&gt;
    titulo_der=r&amp;quot;Error $L^2$ vs $n$ (derivada)&amp;quot;,&lt;br /&gt;
    n_list_plot=n_list,&lt;br /&gt;
    n_max_error=200,&lt;br /&gt;
    ylims_izq=(-10, 10)&lt;br /&gt;
)   &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bibliografía ==&lt;br /&gt;
&lt;br /&gt;
* [https://mat.caminos.upm.es/wiki/Categor%C3%ADa:EDP Categoría: EDP], MateWiki, Universidad Politécnica de Madrid.&lt;br /&gt;
&lt;br /&gt;
* Sanders, J. A.; Verhulst, F.; Murdock, J., ''Partial Differential Equations in Action: From Modelling to Theory'', Springer, 2016.&lt;br /&gt;
&lt;br /&gt;
* Evans, L. C., ''Partial Differential Equations'', Graduate Studies in Mathematics, Vol. 19, American Mathematical Society, 2010.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Categoría:EDP]]&lt;br /&gt;
[[Categoría:EDP25/26]]&lt;/div&gt;</summary>
		<author><name>Mario Alonso</name></author>	</entry>

	</feed>