This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Talbot Effect Simulation</title> | |
<style> | |
body { display: flex; flex-direction: column; align-items: center; margin: 0; } | |
canvas { border: 1px solid black; } | |
.controls { margin: 10px; display: flex; flex-direction: column; align-items: center; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import torch | |
import torchvision | |
import torchvision.transforms as transforms | |
import torch.nn.functional as F | |
#custom activations | |
def gelu_variant(x): | |
two_over_pi = torch.tensor(2 / torch.pi, device=x.device) | |
return 0.5 * x * (1 + torch.tanh(torch.sqrt(two_over_pi) * (x + 0.044715 * torch.pow(x, 3)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.animation import FuncAnimation, writers | |
from numpy.fft import fft, ifft | |
# Reduced setup for quicker testing | |
L = 30 | |
N = 512 # Reduced number of spatial points for simplicity | |
dx = L / N | |
dt = 0.1 # Time step size can be adjusted if needed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Particle Simulation</title> | |
<style> | |
body { | |
display: flex; | |
justify-content: center; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import torch | |
import torchvision | |
import torchvision.transforms as transforms | |
class ELM(torch.nn.Module): | |
def __init__(self, input_size, hidden_size, output_size): | |
super(ELM, self).__init__() | |
self.hidden_size = hidden_size | |
self.input_weights = torch.nn.Parameter(torch.randn(input_size, hidden_size) * 0.1, requires_grad=False) |