Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in python please Write a function physconst that takes as input the name of a physical constant and returns its numerical value, as given in
in python please
Write a function physconst that takes as input the name of a physical constant and returns its numerical value, as given in the table below. Your function should include some minimal documentation in the form of a docstring. Upper/lower/mixed case for the calling strings should be allowed (check out the relevant string functions), and you should trap obvious errors in the user input. In writing this function, you may find Python if-elif-else statements and/or Python dictionaries useful. Submit this function within the file LastnameFirstname_Lab3.py Use your function to return the physical constants in a Python function blanck (with a docstring) that computes the Planck radiation function, Bn(T)=(2hv3/c2)(exp(hv/kT)1)1 Here v is the frequency of light (in Hz ) and T is the temperature (in K). All of the other symbols are physical constants with the usual meanings. In your function call, you must allow for 1-D array of temperatures and 1-D array of frequencies to be given. If M temperatures and N frequencies are given, your function should return an N-by-M array where the rows correspond to a single temperature and the columns, a single frequency. Your function cannot contain any looping constructs (such as for-loops or while- loops) to achieve this functionality. (Hint: look up the concept of broadcasting in Python documentation). Submit this function within the file LastnameFirstname_Lab3.py. Part 3 Use your Planck function to plot up the radiation field from =10 to 2000 nm for the three temperatures T=5000,10000,15000K. Note that v=c for light in a vacuum. Plot all three curves on the same figure with a legend. Save the figure to a file and submit this file as LastnameFirstname_Lab3_Fig1.png. The code that makes the plot should be included within the file LastnameFirstname_Lab3.py. Part 4 For any function you write, it is a good idea to test it carefully to ensure it works correctly. The basis of one possible test for your Planck function is the well-known Stefan-Boltzmann radiation law which states that 0Bu(T)dx=T4/ where is the Stefan-Boltzmann constant above. Use the pumpuctranz function to verify that your Planck function reproduces this law. Make a table or plot to demonstrate this; submit the table or plot file as LastnameFirstname_Lab3_Fig2.png. The code that makes the plot should be included within the file LastnameFirstname_Lab3.py. COMMENT YOUR CODE: We might think that our code makes sense (especially if it is compiling), but someone else might not. We all have different problem-solving logic or naming conventions. It is essential to comment on your code, so that we can understand and mark/give feedback. Comments should be included within each script you submit. INSIGHT CHECK: Check your answers! Do your answers make sense? ERROR CHECK: If your program does not compile, make sure to run the debugger and check for problems to fix the errors before you submit your scripts. If you submit a code that does not compile without errors, make sure to submit a screenshot from VS Code that shows the problems along with your assignment as LastnameFirstname_Lab3_Debugger.jpgStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started