Skip to content

Instantly share code, notes, and snippets.

from random import *
from math import *
g= 9.8
y0 = 1.9
horizontalDistance = 20.0
hoopHeight = 3.05
startingV = 10
startingT = 30
class Projectile():
@emwdx
emwdx / IB Exam Language Analysis
Created December 18, 2014 10:08
This was the program I used to analyze the language through seven IB Physics exams and identify the most common words.
import string
common = ['the','be','to','of','and','a','in','that','have','I','it','for','not','on','with','he','as','you','do','at','this','but','his','by','from','they','we','say','her','she','or','an','will','my','one','all','would','there','their','what','so','up','out','if','about','who','get','which','go','me','when','make','can','like','time','no','just','him','know','take','people','into','year','your','good','some','could','them','see','other','than','then','now','look','only','come','its','over','think','also','back','after','use','two','how','our','work','first','well','way','even','new','want','because','any','these','give','day','most','us']
additionalCommon = ['is','question','part','are','continued','candidates•','answer','answers','provided•','so•','examination','continues','continuesd','m134physisp2engtz1xxquestion','baccalaureate','minutesinstructions','pagewill','international','reference','booklet','continuedd','instructed','continuedpart','questions','paper•','continuedc','m134physisp2
@emwdx
emwdx / pidigits.py
Last active December 14, 2015 18:18
My tool for memorizing digits of pi in five digit chunks.
pi = '3.1415926535897932384626433832795028841971693993751058209749445923078164\
062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303820'
index = 2
for i in range(10):
print "\n"
14159
@emwdx
emwdx / gravitysim.py
Created November 13, 2012 10:37
One dimensional simulation of a falling object
#One dimensional gravity simulation.
#Programmed by Evan Weinberg
#v0.1 - Initial program
initial_height = 30 #meters
initial_velocity = 10 #m/s
mass = 1 #kilogram
g = 9.81 #m/s^2
is_ground = True #Set this to True if you want to simulate the ground.
@emwdx
emwdx / earthmoonsim.py
Created November 13, 2012 10:28
Earth-Moon orbit simulator
from math import *
#All distance units are in m, velocity in m/s
#Enter initial simulation data here
initial_x = -6.38E6
initial_y = 12E6
initial_vx = 1.1E4 #-6.38E6,12E6,1.1E4,3.5E3
@emwdx
emwdx / positionvel.py
Created November 2, 2012 08:24
CAPM Position & Velocity Data generator
# Written by Evan Weinberg in Python
# 0.1 Initial version
# 0.2 Added initial_t as a variable to allow for the model to start at t!= 0.
# 0.3 Adjusted to make this work for a constant acceleration model.
# This program creates a table of values of position and velocity for a particle moving with constant acceleration.
# The acceleration, velocity, position, and time at the beginning of the interval can all be set in the lines below.
#The initial data for the object goes here.
@emwdx
emwdx / random-group-generator.py
Created October 20, 2012 04:29
A random group generator with differently sized groups.
import random
robotics_students = ['shane', 'kevin', 'spencer', 'sam', 'thomas', 'alex', 'minxiu', 'jun hao', 'paul']
geo_students = ['maddie', 'elena', 'roosa', 'suki', 'patricia', 'ali', 'alex', 'jun hao', 'shane', 'tian', 'sho M', 'sho C', 'nick', 'annie', 'minji', 'kimmy', 'shannon', 'kevin', 'sam']
aa_students = ['flo','eigo','jake', 'sam','jane', 'jessie', 'emilly', 'maiti', 'brandon', 'min-xiu', 'paul', 'thomas']
CTF = ['nikita','cherry','jenny','miyu','flaminia','srishti','amy','celine','amelia','esther','maddie']
CTM = ['thomas','rahul','jakob','isaac','tama','ian','aman']
@emwdx
emwdx / conference-schedule-generator.py
Created October 20, 2012 03:51
A program for automating the process of creating schedules for student-assisted conferences at my school of over 350 students.
import csv
import random
original_list = []
family_number = 0
student_list = []
teacher_list = []
teacher_name_to_index = dict() #Dictionary for looking up teacher names
LSteacher_sched_a = [] #list for creating a schedule for each teacher on A day.
@emwdx
emwdx / limittable.py
Created September 5, 2012 09:47
Table of values generator for evaluating limits
#This program will generate a table of values to help in identifying the left and right hand limits of a function at a value.
#The user can change the values of a (line 10) and the function (line 21) to investigate limits of different functions and different values.
#Entering functions must be done using correct Python syntax. For example, x-squared should be written as x**2.
#Trigonometric, exponential, and other specialized functions can be accessed by typing "math." and then the function.
import math
a = -2 #This is the value that x is approaching in the limit. CHANGE THIS LINE!
@emwdx
emwdx / quizgenerator0_4.py
Created September 1, 2012 05:26
Quiz question generator with randomized values v0.4
import random,math
class Question:
""" Question class for creating a question for use in a quiz """
def ft(self,text,randints,randdec,randsgnint):
return text.format(randints,randdec,randsgnint)
def __init__(self, question, answer):
self.text = question