Skip to content

Instantly share code, notes, and snippets.

@emwdx
emwdx / gpd_test.php
Created June 3, 2012 07:31
An exploration of HTML, CSS, and some PHP for helping create the Global Physics Problem Database.
<!DOCTYPE html>
<?php
$username = 'Evan';
$user_type = 'teacher';
$question_text = 'A ball is thrown vertically at 10 meters per second on the surface of Earth. What is the minimum time (in seconds) it could take to reach its maximum height?' ?>
<html>
<style>
.container {
@emwdx
emwdx / positionvstime.py
Created August 22, 2012 00:06
Simple script for generating position vs. time data for a constant velocity particle.
# Written by Evan Weinberg
# This program creates a table of values of a particle moving at constant velocity as a function of time.
# The velocity, position, and time at the beginning of the interval can all be set in the lines below.
velocity = -1.5
initial_x = 18
delta_t = 0.1
total_T = 10
@emwdx
emwdx / algexpressions.py
Created August 22, 2012 23:56
Evaluating Algebraic expression with Python
#Written by Evan Weinberg
#Welcome to your first session of playing with the Python programming language!
#Today's we will be using it to evaluate expressions for us.
#These lines answer the warm-up questions from today. Use these as examples of how
#to enter calculations in Python.
print "Answers to the Warm-Up Questions:"
@emwdx
emwdx / defint.py
Created August 31, 2012 11:21
Calculation of definite integrals
a = 0
b = 1
N = 5000
area = 0
delta_x = (b - a)*1./N
def f(t):
return t**2
@emwdx
emwdx / definttrap.py
Created August 31, 2012 11:25
Trapezoidal Rule for definite integrals
a = 0
b = 1
N = 500
area = 0
delta_x = (b - a)*1./N
def f(t):
return t**2
@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
@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 / 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 / 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 / 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.