Subscribe to thetrh51        RSS Feed
-----

Radioactive half life converter thing?

Icon Leave Comment
Hey guys, here is some code I dreamed up regarding half lives of radioactive isotopes. With a known half life and a known mass you can calculate how much will be left after x years. It accepts negative years too but the formatting at the end is a little off when you do that.

#halflife generator
import math as math
halflife = input("Please input the halflife of a radio active substance in years: ")
grams = input("How many grams of the radioactive substance are there? ")
print "Based on an exponential model, the equasion would be: f(years)=grams * 1/2^years/halflife"
print " "
years = input("How many years in the future do you wish for me to focus my crystal ball? ")
halfyears = years/halflife
x = math.pow(0.5, halfyears)
ans = grams * x
print " "

print 'My crystal ball projects that in ' + str(years) + ' years you will have ' + str(ans) + ' of ' + str(grams) + ' grams left of the original substance.'


0 Comments On This Entry

 

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

December 2014

S M T W T F S
 123456
78910111213
14151617181920
21 222324252627
28293031   

Tags

    Recent Entries

    Search My Blog

    0 user(s) viewing

    0 Guests
    0 member(s)
    0 anonymous member(s)

    Categories