A Pen by Doug McNally on CodePen.
A Pen by Doug McNally on CodePen.
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
# name: Mr. McNally | |
# date: 2016-04-25 | |
# description: Text-based space adventure game | |
import random | |
import time | |
def displayIntro(): | |
print("It is the end of a long year of fighting space criminals") | |
print("you come to crossroads on your trip home, one path leads home") |
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
# plot F_g vs. separation distance | |
import numpy | |
import pylab | |
m_earth = 5.972e24 #kg | |
r_earth = 6.371e6 #m | |
m_person = 80 #kg | |
G = 6.67408e-11 #m^3 / (kg * s^2) | |
# average separation between Mars and Earth = 225e9 m | |
# http://www.universetoday.com/14824/distance-from-earth-to-mars/ |
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 numpy | |
import pylab | |
import random | |
n = 100000 | |
x = numpy.zeros(n) | |
y = numpy.zeros(n) | |
for i in range(1, n): |
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
# Collatz Conjecture | |
import matplotlib.pyplot as plt | |
MAX = 1000000 | |
n_list = range(1,MAX+1) | |
steps = list() | |
for n in n_list: | |
count = 0 | |
while not n == 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 __future__ import division | |
from numpy.polynomial.hermite import * | |
import numpy | |
import pylab | |
import math | |
# use natural units where c = h_bar = 1 | |
m = 1 | |
w = 1 | |
h_bar = 1 | |
n = 1 |