# Ryan Martin
# macid: abcd123
# student number: #######
# July 12, 2011
#
# This is a solution for Marked Assignment 1 (Lab 03) on Monday.

import math

def main():

    print """\

This program is a solution to Marked Assignment 1 (Lab 03) on Monday.

"""

    #INPUT
    
    v = input("Enter a value for the object's speed, v: ")
    delta_t0 = input("Enter a value for the object's time experienced at rest, delta t(0): ")
    print 

    SPEEDOFLIGHT = 3e8

    #CALCULATION

    #We can first calculate the Lorentz factor to simplify:
    gamma = 1 / math.sqrt(1 - ( v**2 / SPEEDOFLIGHT**2 ) )

    A = gamma * delta_t0
    B = gamma * 5 * delta_t0
    C = 100 * abs((A - B) / B)

    #OUTPUT
    
    print "The time experienced for v and delta t(0), A= ", A
    print "The time experienced for v and 5*delta t(0), B= ", B
    print "The relative difference between these values, C= ", C
    print ""

main()


##Design Question
##
##Since v does not change for both A and B, we can calculate the Lorentz factor and
##save it as a variable (gamma).  Then, calculating A and B becomes a simple matter
##of multiplying gamma by delta_t0 or 5*delta_t0. The code becomes
##easier to read, less repetitive and it may even run marginally faster.
##
##Testing Report
##
##REPORT
##
##Test: 1
##Input: [2.85e8,60]
##Expected Output: [192.153784566,960.768922831,80]
##Actual Output: [192.153784566,960.768922831,80]
##Result: Pass
##
##Test: 2
##Input: [string,5]
##Expected Output: [error]
##Actual Output: [NameError]
##Result: Pass
##
#Test: 3
##Input: [234235425e500,50]
##Expected Output: [Math Error]
##Actual Output: [Math Domain Error]
##Result: Pass