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
from sympy import * | |
import matplotlib.pyplot as plt | |
# time variable | |
t = symbols('t') | |
# number of pendula + 1 | |
Z = 3 + 1 | |
# Constants |
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 pulp, random | |
from collections import defaultdict | |
# Some convenience functions for messing with PULP | |
# This lets us reference variables by any number of strings, numbers etc. | |
__Variables = {} | |
def baseVariable(name_tuple, varType): | |
name = '_'.join( map(str, name_tuple) ) | |
if name not in __Variables: |