Skip to content

Instantly share code, notes, and snippets.

View dpiponi's full-sized avatar
🧱
In material form

Dan Piponi dpiponi

🧱
In material form
View GitHub Profile
@dpiponi
dpiponi / defect.py
Created February 20, 2025 19:44
Ising type model using Kawasaki type dynamics
import taichi as ti
import taichi.math as tm
import time
import random
ti.init(arch=ti.gpu)
w = 256
h = 256
# pixels = ti.field(dtype=float, shape=(h, w))
import taichi as ti
import taichi.math as tm
import time
import random
ti.init(arch=ti.gpu)
w = 1440//2
h = 1440//2
# pixels = ti.field(dtype=float, shape=(h, w))
@dpiponi
dpiponi / central.py
Created February 22, 2025 19:28
Ising-ish model with central gravitational force
import taichi as ti
import taichi.math as tm
import time
import random
ti.init(arch=ti.gpu)
w = 1440//2
h = 1440//2
# pixels = ti.field(dtype=float, shape=(h, w))
@dpiponi
dpiponi / caustic.nb
Created March 8, 2025 22:24
Path integral caustics
length = Compile[{{x, _Real}, {y, _Real}, {\[Theta], _Real}},
Sin[\[Theta]] +
Sqrt[(x + Sin[\[Theta]])^2 + (y - Cos[\[Theta]])^2]];
wavelength = 1/128;
phaseSum = Compile[
{{a, _Integer}, {b, _Integer}, {n, _Integer}, {\[Lambda], _Real}, \
{x, _Real}, {y, _Real}},
Module[{i = 0, t = 0. + 0. I},
For[i = a, i <= b, ++i,
t += \[Pi]/n Exp[I length[x, y, \[Pi]/n i]/\[Lambda]]];