SCIE1000 Program - 15% coding assignment PDF

Title SCIE1000 Program - 15% coding assignment
Author Nicole Li
Course Theory & Practice in Science
Institution University of Queensland
Pages 11
File Size 86.2 KB
File Type PDF
Total Downloads 52
Total Views 140

Summary

15% coding assignment...


Description

# this is a program written for the "Exploring Our Galaxy" exhibition in St Lucia public science museum from pylab import * ###################### Functions are defined here ########################### # calculates the period of an exoplanet, given its velocity and distance from its host star def get_period_of_planet(dist_exo_star, velocity_exo): return (2*pi*dist_exo_star/velocity_exo) # calculates the transit time of an exoplanet, given its velocity and the radius of its host star def get_transit_time(velocity_exo, r_star): return (2*pi*r_star)/velocity_exo # calculates the minimum relative intensity of the star, given its radius and the radius of the exoplanet orbiting around it def get_min_rel_intensity(r_exo, r_star): return 1-((r_exo)**2/(r_star)**2) # calculates the N (the number of civilisations in the galaxy that can communicate with Earth), by using the simplified Drake equation def Drake_equation(c): R=7 p=0.5 n=1 L=10000 N=R*p*n*c*L return N # calculates the velocity of the exoplanet, given its distance from its host star def get_velocity_exo(dist_exo_star): return (dist_Earth_sun/dist_exo_star)**0.5*velocity_Earth # function that asks the user to press "0" button to move through the program def button(x): x=float(input("Press 0 to continue: ")) return x ###################### some constants used throughout ########################### #radius of the Sun in kilometres r_star= 695700 #(Williams, 2020a) #radius of the Earth in kilometres r_Earth= 6371 #(Williams, 2020a) #velocity of the Earth in kilometres/hour velocity_Earth= 107208 #(Williams, 2020b)

#distance from Earth to the Sun in kilometres dist_Earth_sun= 149600000 #(NASA, 2020) ###################### main body of the code here ########################### # display welcome message suitable to both patrons print("Hi there! Welcome to St Lucia Public Science Museum! This exhibition is called 'Exploring Our Galaxy'. Today we will explore exoplanets - the planets found orbiting distant stars other than the Sun.") print("Have you ever wondered about the potential for finding other life forms and communicating with them in our vast Milky Way galaxy? Have you wondered how challenging it is to search for exoplanets?") print("If you have, then prepare to be amazed. If you haven't, then prepare to be mindblown!") # prompts user to enter their patron type patron_type=float(input("Press 0 if you are a science rookie OR Press 1 if you are a science enthusiast: ")) # begin program for "science enthusiast" if patron_type==1: # display intro about other planets and other potential civilisations in our galaxy print() print("In this vast universe, are we truly unique and alone? Human fascination and speculation regarding the potential existence of extraterrestrial life on other planets has existed since ancient times. ") print("Astronomers have attempted to communicate with intelligent life using radio waves since 1959. The first exoplanet (a planet found orbiting distant stars other than our Sun) was discovered in 1992. Since then, around 4000 exoplanets have been discovered, amidst thousands of potential planet candidates.")#(Peters, 2019)(Brennan, n.d.) print("Scientists ponder, among these exoplanets, which ones can potentially develop and maintain environments capable of supporting life, and what is the chance that we will find other communicable technological civilisations like our own on these exoplanets?") #(Kerschner, 2014)) x=float(input("Press 0 to continue: ")) #explains Drake equation print() print("The Drake equation is a probabilistic argument that estimates the number of communicable extraterrestrial civilisations in the Milky Way galaxy.") #(Howell, 2018) print("Parameters in this model such as the number of habitable planets per system, and the average lifetime of a civilisation are practically impossible to measure with current technology.") print("Therefore, educated guesses and speculation are involved in the Drake equation. These estimates for parameters in the Drake equation are highly conjectural, creating significant uncertainty in the final value the model returns.") #(Hartsfield, 2015)

print("Although the model is not reliable, it evokes us to critically consider the probability of finding intelligent life in our galaxy.") print("Hence, we will use the Drake equation in the following activity, and ask for your input.") button(x) #asks user to input their estimate of the proportion of habitable planets that develop technological civilisations proportion=float(input("Now, what proportion (%) of potentially habitable planets do you think have developed technological civilisations like us?: ")) proportion=(proportion/100) #prints the value of N (number of communicable civilisations in the galaxy) print("You have predicted that",round(Drake_equation(proportion)), "civilisations in the galaxy can communicate with us.") print("Recent estimates suggest that around 700 civilisations in the galaxy that can communicate with Earth.") #(SCIE1000, 2020) #prints useful message comparing user's prediction with recent estimates of N if Drake_equation(proportion)>700: print("You have overestimated the number of planets which we can communicate with by",(round(Drake_equation(proportion))-700),". However, the search for exoplanets is continually evolving, and we may discover that your predictions are correct in the future.") if Drake_equation(proportion)==700: print("Your guess is spot on! You wouldn't by any chance be a physicist, would you?") if Drake_equation(proportion)...


Similar Free PDFs