{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

practical10

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

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

COSC 1002/1902 Computational Science in C Practical 10 This practical session introduces numerical root ﬁnding using the bisection method and Newton- Raphson method. The exercises include ﬁnding 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 conﬁrm 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 ﬁnding 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 ﬁrst positive root of g ( r ) ? Answer: (b) Modify the code find_root_bisec.c so that it ﬁnds the the ﬁrst 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

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

View Full Document
Answer: (c) If you were to apply the code find_root_bisec.c to ﬁnd the ﬁrst root of f ( r ) rather than the ﬁrst 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 ﬁnding the ﬁrst 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.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online