Skip to content

Instantly share code, notes, and snippets.

import time
import numpy as np
from numba import jit
x_dim = 1000
y_dim = 1000
x_min = -1.8
x_max = 1.8
y_min = -1.8j
y_max = 1.8j
import time
import numpy as np
from numba import njit, prange
x_dim = 1000
y_dim = 1000
x_min = -1.8
x_max = 1.8
y_min = -1.8j
y_max = 1.8j
import time #timing
import numpy as np #arrays
import numba as nb #speed
x_dim = 1000
y_dim = 1000
x_min = -1.8
x_max = 1.8
y_min = -1.8j
y_max = 1.8j
import time #timing
import numpy as np #arrays
import numba as nb #speed
x_dim = 1000
y_dim = 1000
x_min = -1.8
x_max = 1.8
y_min = -1.8j
y_max = 1.8j
//Written by David Butts
#include<time.h>
#include<chrono>
#include<thread>
#include<iomanip>
int next_val(const vector<int> &v){
if (v == vector<int>{0,0,0})
return 0;
else if (v == vector<int>{0,0,1})
return 0;
//Written by Bill Punch
#include<iostream>
using std::cout; using std::endl; using std::boolalpha;
#include<chrono>
#include<iomanip>
#include<bitset>
using std::bitset;
int main() {
const size_t sz = 100000;
#Written by David Butts
#This code is an implementation of a Rule 30 Wolfram model written in Python.
import numpy as np
import time
import numba
@nb.jit #numba the function
def Rule30_code():
Rule30 = np.zeros((1000,100000)) #initilize an array to run on (timesteps, width)
Rule30[0,50] = 1
for y in range(Rule30.shape[0]-1): #iterate through grid
#Written by David Butts
#This code is an implementation of a Rule 30 Wolfram model written in Python.
import numpy as np
import time
def Rule30_code():
Rule30 = np.zeros((1000,100000)) #initilize an array to run on (timesteps, width)
Rule30[0,50] = 1
for y in range(Rule30.shape[0]-1): #iterate through grid
for x in range(Rule30.shape[1]):
#update the next rows values according to neighbor & self value