Date of issue: Nov 2020 Date of submission: 30 Nov 2020 There are 20 marks in total for this assignment.
Intended learning Outcomes
1. Solve straightforward problems using functions.
2. Write simple code to describe a physical process.
2Instructions for the taskEach of you will be assigned (at random) one of the following equations to model in JavaScript (that is by creating an html document to display the results):
1) Coulomb’s law of electrostatic force: 20214rqqFel2) The radius of an orbit in the hydrogen atom according to Bohr’s model: 2022mehnr3) Poiseuille’s law for laminar fluid flow through a circular pipe: LPrQ48
4) The luminosity of a star modeled as a black body: 424TRL5) The radius of a white dwarf: 3174sunsunMMRR6)
The total resistance of n resistors in parallel: nRRRR1…111217) The photoelectric effect: hfvme2max218) Conservation of energy in freefall:
constant212mvmgh9) Escape velocity, e.g. on different planets: RGMv2
310) Kepler’s Third law: )(421322mmGaP11) Angular momentum:
sinmrvLorprL12) Boltzmann’s distribution: kTEAeEP)(Tips for success
1. You need to code the equation by declaring variables and you should use JavaScript’s Math class where applicable, e.g. to obtain an accurate value for pi or to square-root a value. You should display the output to the user when your html document is executed as a web page in a browser. (5 marks)
2. Part of the mark will be awarded for useful code: we could use a pocket calculator to compute the formula for one set of parameters, but computers allow us to carry out multiple calculations very rapidly so you should consider using your code to compute the output from your equation for a range of inputs, perhaps by using a loop or conditional execution.
Alternatively, you may like to make the code interactive, requesting an input from the user, e.g. from a textbox and then carrying out the computation when the user clicks on a button. You should add comments if you think they help make your code easier to understand. (5 marks
)3. You should summarise what each line of your JavaScript is doing, to demonstrate that you understand the code you have written. You may do this using code comments if you wish. (5 marks)
4. You should write no more than 300 words explaining the background physics of your equation, e.g. what does the equation mean, what does it do and how is it used? You will need to research this.
You must also use your own words, so do not include technical terms without defining them. You may incorporate your 300 words as part of your app if you wish. (5 marks)