Skip to content

Instantly share code, notes, and snippets.

View thomasahle's full-sized avatar
♟️

Thomas Dybdahl Ahle thomasahle

♟️
View GitHub Profile
from manim import *
import numpy as np
class DualRingHeatTransferAnimation(Scene):
def construct(self):
# Configuration
num_blocks = 20
block_size = 0.4
outer_radius = 3.3
inner_radius = 2.9
@thomasahle
thomasahle / blocks.py
Created September 8, 2024 18:54
Manim heat exchange
from manim import *
import numpy as np
class HeatTransferAnimation(Scene):
def construct(self):
# Configuration
num_blocks = 10
block_size = 1
spacing = 0.1
import geopandas as gpd
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.colors as mcolors
from shapely.geometry import Polygon, MultiPolygon
import shapely.ops
import os.path
def get_text_color(fill_color):
import instructor
from pydantic import BaseModel, Field
from typing import overload, Union, Literal, Generator
from tqdm.asyncio import tqdm
import asyncio
import numpy as np
import json
import os, sys
import diskcache, inspect, functools
import random
import instructor
from pydantic import BaseModel, Field
from typing import overload, Union, Literal, Generator
from tqdm.asyncio import tqdm
import asyncio
import numpy as np
import json
import os, sys
import diskcache, inspect, functools
import random
@thomasahle
thomasahle / mlps.py
Created July 7, 2024 17:30
Randomly Initialized MLPs with Different Activation Functions
import torch
import math
from torch import nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as mcolors
import numpy as np
import seaborn as sns
from collections import Counter
from manim import *
import networkx as nx
import random
import numpy as np
import itertools
class UF:
def __init__(self, ids):
from collections import Counter
from manim import *
import networkx as nx
import random
import numpy as np
import itertools
class UF:
def __init__(self, ids):
from collections import Counter
from manim import *
import networkx as nx
import random
import numpy as np
import itertools
class UF:
def __init__(self, ids):
import networkx as nx
import matplotlib.pyplot as plt
import random
import matplotlib.animation as animation
import numpy as np
# Step 1: Create the graph
G = nx.MultiGraph()
edges = [
(1, 2), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5), (2, 6), (3, 4), (3, 5), (3, 6),