Skip to content

Instantly share code, notes, and snippets.

View RamonLopezEscudero's full-sized avatar

Ramon Lopez Escudero RamonLopezEscudero

  • Universidad de Guanajuato
View GitHub Profile
@RamonLopezEscudero
RamonLopezEscudero / Integracion_Numerica.c
Last active July 6, 2016 23:53
Integracion numérica por la regla del trapecio. Para modificar la función a evaluar solamente es necesario cambiar la ecuación definida en la función "funcion".
#include <stdio.h>
#include <math.h>
// Definicion de la funcion de la funcion matematica a evaluar
double funcion(float x)
{
return (x * x) * exp(-x * x);
}
int main()
@RamonLopezEscudero
RamonLopezEscudero / Abrir_FicherosyPagWeb.py
Last active July 8, 2016 04:45
Script para abrir programas, carpetas, archivos y páginas web de manera automática.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================================================== #
# Importar liberías necesarias
import os
import platform
import subprocess
import webbrowser
@RamonLopezEscudero
RamonLopezEscudero / Criba_Erastotenes.py
Created July 8, 2016 05:26
Búsqueda de números primos mediante el método de la Criba de Erastótenes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Numero tope para la búsqueda de numeros primos
num_data = 200
# Llenado de la matriz con valores de 1
matriz_data = []
for i in range(num_data):
matriz_data.append(1)
@RamonLopezEscudero
RamonLopezEscudero / Grafica_Ondas_Armonicas.py
Created July 13, 2016 15:57
Graficadora de ondas armónicas. Si se requiere graficar el coseno, solo es necesario modificar la función de numpy a np.cos en la función de onda.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================================================== #
# Importar librerías
import numpy as np
from basic_units import radians, degrees
import matplotlib.pyplot as plt
@RamonLopezEscudero
RamonLopezEscudero / L8TIRS_Clip_And_Processing.py
Created July 26, 2016 15:02
Procesamiento de imagen de temperatura Landsat 8. Recorte de la imagen a partir de un shapefile y corrección radiométrica a partir de la información contenida en el fichero de metadatos.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================================================== #
# =============================================================================================================== #
# Importar Librerías
import time
import os
import numpy as np
@RamonLopezEscudero
RamonLopezEscudero / Regresion_Lineal.c
Created August 21, 2016 20:50
Regresion lineal simple por mínimos cuadrados
#include <stdio.h>
#include <math.h>
void suma_elem_array(int num_data, int *array_x, int *array_y, float *sum_x, float *sum_y, float *sum_xy,
float *sum_cuad_x, float *sum_cuad_y)
{
/* ---------------------------------- */
int i;
/* ---------------------------------- */
@RamonLopezEscudero
RamonLopezEscudero / Busqueda_Binaria.c
Created September 9, 2016 07:57
Busqueda binaria de un numero.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void main()
{
int counter = 0;
int size, num, aux, lim_izq, lim_der;
printf("Ingrese el limite superior de la lista: ");
@RamonLopezEscudero
RamonLopezEscudero / Merge_Sort.c
Last active May 2, 2024 20:51
Código del método de ordenamiento "Merge Sort"
#include <stdio.h>
#include <stdlib.h>
void merge(int *array, int p, int q, int r)
{
// Declaracion de variables
int i, j, k;
int n_1 = (q - p) + 1;
int n_2 = (r - q);
int *L, *R;
@RamonLopezEscudero
RamonLopezEscudero / Max_Heapify.py
Created October 4, 2016 15:16
Rutina Max Heapify iterativa en lenguaje Python 2.7
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def parent(index_query):
index_parent = int(index_query/2)
return index_parent
def left_child(index_query):
index_lchild = (2 * index_query) + 1
return index_lchild
@RamonLopezEscudero
RamonLopezEscudero / Stack.c
Created December 22, 2016 19:41
Implementación de pilas en C
#include <stdio.h>
#include <stdlib.h>
int size_stack = 7;
void print_stack(int *stack, int *top)
{
int i;
for(i = 0; i < *top; i++) printf(" %i ", *(stack + i));
}