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
def g(x): | |
print x | |
b = 20 |
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
def f(x): | |
print x | |
a = 10 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Exploration of the Cal Poly Library API" | |
] | |
}, | |
{ |
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
"""Functions for reading binary files with the digits of pi stored | |
as 4-bit ints.""" | |
def bin_file_to_digits(filename, the_type=str): | |
raw_bytes = np.fromfile(filename, dtype=np.byte) | |
for b in raw_bytes[0:10000]: | |
digits = byte_to_digits(b) | |
yield the_type(digits[0]) | |
yield the_type(digits[1]) |
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.physics.quantum import * | |
from sympy.physics.cartesian import * | |
from sympy.physics.piab import * | |
from sympy.physics.spin import * | |
# Basic manipulations with operators, bras, kets and commutators | |
psi, phi = Ket('psi'), Ket('phi') | |
psi, phi | |
A, B, C = Operator('A'), Operator('B'), Operator('C') |
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
"""Quantum mechanics on graphs. | |
Todo: | |
* Implement dirichlet boundary conditions. | |
* Use node attributes to label boundary points and impose dirichlet boundary | |
conditions. | |
* Develop plotting/viz routines using matplotlib/mayavi2. | |
* Use node attributes to store the physics coordinates of the point. | |
* Write a bisect function to put additional nodes between existing ones. |
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
"""Solve the 1D diffusion equation using CN and finite differences.""" | |
from time import sleep | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import networkx as nx | |
# The total number of nodes | |
nnodes = 10 | |
# The total number of times |
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 numpy import * | |
from matplotlib.pyplot import * | |
from time import sleep | |
import numpy as np | |
import networkx as nx | |
dim = [3,2] |
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
"""Solve the 1D diffusion equation using CN and finite differences.""" | |
from time import sleep | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import networkx as nx | |
# The total number of nodes | |
numx = 5 | |
numy = 5 |