Skip to content

Instantly share code, notes, and snippets.

View obedrios's full-sized avatar
😸

Obed Rios obedrios

😸
View GitHub Profile
@obedrios
obedrios / normal_dist_gen1.0.c
Last active May 23, 2022 00:25
Random Normal Generation with Arduino Rev 1.0
/**
* Abstract:
* Using the ATMEGA328/Arduino in this post, we will use a naive method to generate normally distributed random numbers.
* Our first step was to implement density and cumulative normal distribution functions. After that, in order to obtain
* an approximate inverse cumulative density function, a lookup table is used and z-values are obtained using linear interpolation.
* Using the Shapiro-Wilki test, we validated the normality of a generated number list.
*/
#include "support.h"
/**
@obedrios
obedrios / animated_wave_1D_interference.java
Created April 17, 2023 00:54
Simple 1D Wave Interference in Processing
float amplitude1 = 100; // Amplitude of the first wave
float amplitude2 = 50; // Amplitude of the second wave
float wavelength1 = 200; // Wavelength of the first wave
float wavelength2 = 400; // Wavelength of the second wave
float frequency1 = 2*PI/wavelength1; // Frequency of the first wave
float frequency2 = 2*PI/wavelength2; // Frequency of the second wave
float phase1 = 0; // Phase of the first wave
float phase2 = 0; // Phase of the second wave
void setup() {
@obedrios
obedrios / Single_Source_Radial_Wave_01.java
Created April 17, 2023 01:11
Single Source Radial Wave Simulations
// Parameters
int N = 500; // Grid size
float lambda = 10; // Wavelength
float k = 2 * PI / lambda; // Wave number
float A = 100; // Amplitude
// Source position
int[] source = {N/2, N/2};
// Grid and wave array
@obedrios
obedrios / Simple_2D_Wave_Interfernce_01.java
Created April 17, 2023 01:16
Two Dimensional with Two Source Wave Interference
// Parameters
int N = 500; // Grid size
float lambda = 10; // Wavelength
float k = 2 * PI / lambda; // Wave number
float A = 1; // Amplitude
float speed = 0.1; // Speed of the animation
// Source positions
int[] source1 = {N/4, N/2};
int[] source2 = {3 * N/4, N/2};