This file contains hidden or 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 torch | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D # registers the 3-D projection | |
from matplotlib import cm | |
# ───────────────────────── optimiser ────────────────────────────────────── | |
def solve_monotone_symmetric( | |
n: int, | |
lr: float = 5e-3, |
This file contains hidden or 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
# now at https://github.com/danielvarga/grid-slicing/blob/master/main_complete_set_system.py | |
# use that instead! | |
import numpy as np | |
import cvxpy as cp | |
from fractions import Fraction | |
import matplotlib.pyplot as plt | |
import sys | |
from pysat.formula import WCNF | |
from pysat.examples.rc2 import RC2 |
This file contains hidden or 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 pygame | |
import math | |
import random | |
# Initialize Pygame | |
pygame.init() | |
# Screen dimensions | |
WIDTH, HEIGHT = 800, 800 | |
screen = pygame.display.set_mode((WIDTH, HEIGHT)) |
This file contains hidden or 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 torch | |
import torch.nn as nn | |
class TensorNetworkBase(nn.Module): | |
def __init__(self, d, k): | |
super(TensorNetworkBase, self).__init__() | |
self.d = d | |
self.k = k |
This file contains hidden or 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 | |
from numpy import ndarray | |
from manim import * | |
from shapely.geometry import Point as ShapelyPoint | |
from shapely.geometry import Polygon as ShapelyPolygon | |
from shapely.ops import unary_union # To compute the union of multiple geometries | |
def moser_spindle(): | |
delta = np.exp(np.pi * 1j / 3) # 60 degrees |
This file contains hidden or 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
# all code written by ChatGPT | |
# https://chatgpt.com/share/44f5f3c4-3213-445c-a824-13acd249e91b | |
import sys | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import networkx as nx | |
from collections import Counter | |
This file contains hidden or 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 cvxpy as cp | |
import matplotlib.pyplot as plt | |
import matplotlib.patches as patches | |
def enumerate_isoscales(n): | |
triangles = [] | |
for x1 in range(n): | |
for y1 in range(n): |
This file contains hidden or 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
# https://chatgpt.com/share/a06552d3-778a-4bfc-b411-3cb5bee4d6d3 | |
import numpy as np | |
from scipy.integrate import odeint | |
import matplotlib.pyplot as plt | |
# Define the system of ODEs | |
def system(y, t): | |
f, g = y | |
dfdt = g |
This file contains hidden or 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
# https://users.renyi.hu/~geza/GeoSzem/imre24 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def F(a, g): | |
numerator = np.sin(g)**2 * ((a + 1)**2 * np.tan(g)**2 + a**2) | |
denominator = (a + 1)**2 - (a + 1) * np.sin(g) | |
return numerator / denominator |
This file contains hidden or 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 cvxpy as cp | |
import itertools | |
def collect_vertices(n): | |
if n <= 0: | |
return np.array([]) | |
# Generate all possible combinations of +1 and -1 using meshgrid |
NewerOlder