In a recent post I showed that whenever the reaction diffusion equation
has traveling wave solutions connecting
(and this also holds when
In a recent post I showed that whenever the reaction diffusion equation
has traveling wave solutions connecting
(and this also holds when
In many variants of scalar reaction-diffusion equations with monotone bistable traveling waves, there is a concise formula for computing the sign of the wave speed.
First I will prove a general version of this formula that applies to continuous time, and show how it applies specifically to both PDE and integro-difference equations. Then I will prove a discrete-time variation for integrodifference equations.
The classic references on this specifically for reaction-diffusion PDE are:
How good is your (my) intuition for reaction diffusion equations? I mean equations in this form:
where
Note: you should always first consider the "local dynamics" given by the ODE
import numpy | |
import matplotlib.pyplot | |
def ornstein_uhlenbeck(tmax, dt, x0=0, r=1, sigma=1, mu=0): | |
T = numpy.arange(0, tmax + dt, dt) | |
X = numpy.zeros(T.shape[0]) | |
X[0] = x0 | |
for i in range(T.shape[0] - 1): | |
dWt = numpy.random.normal(scale=dt**0.5) | |
X[i+1] = X[i] + (-r) * (X[i] - mu) * dt + sigma * dWt |
import numpy | |
def bridge(x0 = 0, x1 = 0, dt = 1, n = 0): | |
if n == 0: | |
return [x0, x1] | |
m = numpy.random.normal((x0 + x1) / 2, dt/4) | |
bridge1 = bridge(x0, m, dt/2, n-1) | |
bridge2 = bridge(m, x1, dt/2, n-1) | |
return bridge1[:-1] + bridge2 |
# http://stanleyrabinowitz.com/bibliography/spigot.pdf | |
from typing import * | |
def espigot(n: int) -> List[int]: | |
A = [1 for _ in range(n + 4)] | |
q = 0 | |
digits = [] | |
for _ in range(n + 2): | |
A = [10*a for a in A] | |
for i in range(n + 4): |
# Diffe-Hellman key exchange | |
# https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange | |
import math | |
def least_prime_factor(n: int) -> int: | |
assert(n > 1) | |
for d in range(2, int(n**(1/2))): | |
if n % d == 0: | |
return d |
# Algorithm Minecraft uses to convert world seeds to integers | |
# Shows why `creashaks organzine` yields seed 0, whereas by design manually inputting seed 0 uses random seed. | |
def seed(x: str) -> int: | |
if isinstance(x, int): | |
return x | |
s = 0 | |
for c in x: | |
s = ((31*s + ord(c)) ^ 0x80000000) & 0xFFFFFFFF - 0x80000000 | |
return s |
import numpy as np | |
import pygame | |
from scipy.ndimage import convolve | |
def game_of_life(state): | |
kernel = np.array([[2,2,2],[2,1,2],[2,2,2]]) | |
activation = np.vectorize(lambda x: int(5 <= x <= 7)) | |
return activation(convolve(state, kernel, mode='wrap')) | |
pygame.init() |