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 |
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 | |
nodx = 3 | |
nody = 3 |
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
============================ | |
Configuring IPython.parallel | |
============================ | |
This guide describes the steps needed to run IPython engines on Microsoft Azure to perform a parallel | |
computation in the Microsoft cloud. We assume (see above guide) that Python, IPython and PyZMQ have | |
been installed on a set of Azure compute nodes. | |
1. Install Python, IPython and PyZMQ on a system having open access to the internet. We used an | |
Ubuntu 11.04 system for this purpose. This system will run the IPython controller and the IPython |
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 networkx as nx | |
import matplotlib as mat | |
# Builds a graphene sheet with the given number of rows and columns. | |
# The sheet has a defected column running through the optionally passed | |
# arg. Otherwise it defaults to the center. | |
def build_defected_graph(rows, columns, defect = 0): | |
g = nx.Graph() | |
if( columns <= 2 ): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer