practical10 - COSC 1002/1902 Computational Science in C...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COSC 1002/1902 Computational Science in C Practical 10 This practical session introduces numerical root finding using the bisection method and Newton- Raphson method. The exercises include finding the natural frequencies of vibration of the Earth, and determining the position of a planet around the Sun. Before you begin these exercises, you should review the material in lecture 10. Download the code find root bisec.c from the Unit web pages and compile and run the code to confirm the results obtained in the lectures. If you succeed with this then you are ready to begin the exercises. If not consult a tutor, who can provide assistance. The exercises are for students in both units except where indicated (‘1002’ means that the question is just for students in COSC 1002, and ‘1902’ means that the question is just for students in COSC 1902). Remember to have a tutor mark off checkpoints as you reach them. Exercises 1. The probability of finding an electron in the 4 s excited state of Hydrogen at a distance r from the nucleus is proportional to f ( r ) = g ( r ) 2 e - r/ 2 (1) with g ( r ) = 1 - 3 r 4 + r 2 8 - r 3 192 , (2) where r is in units of the Bohr radius ( 5 × 10 - 11 m ). (a) Plot the polynomial g ( r ) using gnuplot, for 0 < r < 10 . Also plot the x -axis on the same plot. [Note that the x -axis can be plotted using the command plot 0 .] Based on the plot, what are suitable bracketing values for the first positive root of g ( r ) ? Answer: (b) Modify the code find_root_bisec.c so that it finds the the first positive root of g ( r ) . What is the root? How many iterations were required? Is the result accurate? How far from the nucleus, in meters, is the electron? 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Answer: (c) If you were to apply the code find_root_bisec.c to find the first root of f ( r ) rather than the first root of g ( r ) , the code would fail. Explain why. Answer: 2. In this question you will implement the Newton-Raphson method in code and apply it to the problem of finding the first positive root of f ( x ) = sin x - 1 2 x . You should modify the code find_root_bisec.c , and keep the same general structure for the code.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/29/2009 for the course COSC 1002 taught by Professor Wheatland during the Three '09 term at University of Sydney.

Page1 / 6

practical10 - COSC 1002/1902 Computational Science in C...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online