# Ryan Martin
# macid: abcd123
# student number: #######
# July 12, 2011
#
# This is a solution for Major Assignment 1 (Lab 04) Version 04.

import math

print """\

This program is a solution to Major Assignment 1 (Lab 04) Version 04.

"""

#INPUTS
v = input("Enter a value for the particle's velocity, v: ")
m0 = input("Enter a value for the particle's rest mass, m0: ")
print

SPEEDOFLIGHT = 3e8
PLANCKCONSTANT = 6.63e-34

#CALCULATION
A = PLANCKCONSTANT * math.sqrt( 1 - ( v**2 / SPEEDOFLIGHT**2 ) ) / ( m0 * v )
B = PLANCKCONSTANT * math.sqrt( 1 - ( v**2 / SPEEDOFLIGHT**2 ) ) / ( 5 * m0 * v )
C = 100.0 * abs((A - B) / B)

#OUTPUT
print "The de Broglie Wavelength for v m0 =", A
print "The de Broglie Wavelength for v and 5m0 =", B
print "The relative difference between these values =", C
print ""

'''
Design Question

There are three ways in Python to compute a square root:
1. Using x**(0.5) or x**(1./2)
2. Using math.sqrt(x)
3. Using math.pow(x, 0.5) or math.pow(x, 1./2)

Test Plan

Test: 1
Input: [2.2e6,9.11e-31]
Expected Output: [3.30796413745e-10,6.61592827489e-11,400.0]

Test: 2
Input: [2.8e8,3.45e-34]
Expected Output: [2.46401950803e-09,4.92803901605e-10,400.0]

Test: 3
Input: [2.8e8,string]
Expected Output: [error]

Test: 4
Input: [3e8,100] %velocity equals speed of light
Expected Output: [error - ZeroDivisionError]

Test: 5
Input: [4e8,100] %velocity cannot be greater than speed of light
Expected Output: [error - ValueError]
'''
