Skip to content

Instantly share code, notes, and snippets.

View aleksanderhan's full-sized avatar

Aleksander Hansen aleksanderhan

View GitHub Profile
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation
from numba import njit, prange
@njit
def linear_interp(x, in_min, in_max, out_min, out_max):
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
@aleksanderhan
aleksanderhan / ode_to_galileo.py
Last active August 12, 2023 23:02
An ode to Galileo - Dialogue Concerning the Two Chief World Systems variation
import openai
import os
from termcolor import colored
from langchain.memory import ConversationBufferMemory
from langchain.chat_models import ChatOpenAI
from langchain.chains import ConversationChain
from langchain.prompts import PromptTemplate
from typing import Any
from langchain.callbacks.base import BaseCallbackHandler
@aleksanderhan
aleksanderhan / fractal-dimension.py
Created December 8, 2021 01:35 — forked from rougier/fractal-dimension.py
Fractal dimension computing
# -----------------------------------------------------------------------------
# From https://en.wikipedia.org/wiki/Minkowski–Bouligand_dimension:
#
# In fractal geometry, the Minkowski–Bouligand dimension, also known as
# Minkowski dimension or box-counting dimension, is a way of determining the
# fractal dimension of a set S in a Euclidean space Rn, or more generally in a
# metric space (X, d).
# -----------------------------------------------------------------------------
import scipy.misc
import numpy as np