Skip to content

Instantly share code, notes, and snippets.

View astrojuanlu's full-sized avatar

Juan Luis Cano Rodríguez astrojuanlu

View GitHub Profile
@astrojuanlu
astrojuanlu / levicivita.py
Created May 13, 2012 19:08
Símbolo de Levi-Civita en Python
# coding: utf-8
# Símbolo de Levi-Civita en Python utilizando listas por comprensión
# Fórmula extraída de http://en.wikipedia.org/wiki/Levi-Civita_symbol#Three_dimensions
# Válido para Python 2 y 3
#
# Juan Luis Cano Rodríguez <juanlu001@gmail.com>
from __future__ import print_function
import numpy as np
@astrojuanlu
astrojuanlu / anima.sh
Created May 20, 2012 10:05
Péndulo esférico
#!/usr/bin/env bash
#
# Crea un vídeo de una serie de imágenes .png
# Juan Luis Cano Rodríguez <juanlu001@gmail.com>
ffmpeg -i fig%03d.png -b:v 512k animation.ogv
@astrojuanlu
astrojuanlu / dft_scipy.ipynb
Last active April 4, 2024 01:30
Transformada de Fourier discreta en Python con SciPy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astrojuanlu
astrojuanlu / numba.ipynb
Created October 18, 2012 21:39
numba, a jit for Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astrojuanlu
astrojuanlu / juego-vida.py
Created November 6, 2012 16:40
Juego de la vida de Conway en Python
# coding: utf-8
"""Juego de la vida de Conway.
Autor: Juan Luis Cano <juanlu001@gmail.com>
El tablero es un array de NumPy, donde 0 significa célula muerta y 1 célula
viva. Se muestra una animación con matplotlib.
"""
@astrojuanlu
astrojuanlu / lineas_corriente.ipynb
Created November 9, 2012 15:52
Líneas de corriente con matplotlib 1.2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astrojuanlu
astrojuanlu / vectores.f90
Created January 27, 2013 20:38
Módulo con operaciones sobre vectores.
module vectores
implicit none
contains
! Producto escalar entre dos vectores u, v de longitud n
function producto_escalar(n, u, v) result(p)
integer, intent(in) :: n
@astrojuanlu
astrojuanlu / jpl_ephem.py
Last active May 16, 2017 23:36
Retrieve planetary ephemerides from JPL HORIZONS with Python
from datetime import datetime
from io import StringIO
import telnetlib
import socket
import numpy as np
from numpy import radians
@astrojuanlu
astrojuanlu / polar.dat
Created August 15, 2013 11:38
Datos de la polar del avión.
# Polar data for a certain airplane
# 1st line: C_L
# 2rd line: C_D
-0.9100 -0.7200 -0.4800 -0.2700 -0.0600 0.1600 0.3100 0.4700 0.6000 0.8200 1.0200 1.2000 1.2400 1.1500 1.0000 0.8000
0.0538 0.0438 0.0316 0.0245 0.0228 0.0232 0.0262 0.0301 0.0348 0.0461 0.0608 0.0771 0.0814 0.0900 0.0950 0.1000
@astrojuanlu
astrojuanlu / ajuste_interp.ipynb
Last active July 11, 2021 10:39
Ajuste e interpolación unidimensionales básicos en Python con SciPy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.