Skip to content

Instantly share code, notes, and snippets.

View nicoguaro's full-sized avatar

Nicolás Guarín-Zapata nicoguaro

View GitHub Profile
@nicoguaro
nicoguaro / poly_fit.py
Created January 23, 2024 14:40
Polynomial fitting example in NumPy
import numpy as np
from numpy.polynomial import Polynomial
rng = np.random.default_rng()
x = np.arange(10)
y = np.arange(10) + 0.01*rng.standard_normal(10)
p_fitted = np.polynomial.Polynomial.fit(x, y, deg=1)
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from wordcloud import WordCloud, STOPWORDS
#%%
f = open('output_file.txt', 'r', encoding="utf8")
text = f.read()
f.close()
@nicoguaro
nicoguaro / 01a_fem1d_global_sym.ipynb
Last active August 11, 2025 00:26
Notebooks con implementaciones sencillas del método de elementos finitos para la ecuación de Poisson y de Helmholtz.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nicoguaro
nicoguaro / heart.py
Created March 15, 2023 23:58
Heart surface
import numpy as np
import matplotlib.pyplot as plt
from skimage import measure
y, x, z = np.mgrid[-2:2:100j, -2:2:100j, -2:2:100j]
f = (x**2 + 9/4*y**2 + z**2 - 1)**3 - x**2 * z**3 - 9/80*y**2*z**3
verts, faces, _, _ = measure.marching_cubes(f, 0, spacing=(0.1, 0.1, 0.1))
fig = plt.figure()
@nicoguaro
nicoguaro / random_mats_eigs.py
Last active November 13, 2022 00:06
Eigenvalues for random matrices
# -*- coding: utf-8 -*-
"""
Eigenvalues for matrices with random entries with values of 1 or -1
@author: Nicolás Guarín-Zapata
@date: November 2022
"""
import numpy as np
import matplotlib.pyplot as plt
@nicoguaro
nicoguaro / nonstandard_fd.png
Last active May 31, 2022 21:01
Toy examples for Nonstandard Finite Differences.
nonstandard_fd.png
@nicoguaro
nicoguaro / pumpkin.png
Created November 1, 2021 00:22
Pumpkin surface.
pumpkin.png
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Effect of waves moving.
Inspired by Juan Carlos Ponce
https://mobile.twitter.com/jcponcemath/status/1447388869033283591?t=UJAyYdVEGm3DYvp-ESCByA&s=09
Alt-text: 5 waves propagating from left to right. They are depicted
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nicoguaro
nicoguaro / eig_prob.py
Created August 23, 2021 22:09
Soluton of an eigenvalue problem using finite differences
"""
Problem proposed in:
https://scicomp.stackexchange.com/a/38968/9667
@author: Nicolás Guarín-Zapata
@date: August 2021
"""