Docsity

Acceleration Due to Gravity - Computational Science - Solved Exam, Exams of Computational Physics

Toggle sidebar
bg1
COSC1001/1901 (Semester Two, 2010) Exam Solutions and Marking Scheme
Computational Science in MATLAB
COSC1001 (Normal) & COSC1901 (Advanced)
Exam Solutions and Marking Scheme
1. Measuring acceleration due to gravity
This question assesses week 8 (ā€œReview the application of linear algebra to physical prob-
lemsā€, ā€œUnderstand the built-in matrix manipulation functionsā€ and ā€œApply matrix methods
to problems in linear algebra...ā€), week 3 (ā€œWrite user-defined functionsā€), week 4 (ā€œUnder-
stand the matrix datatypeā€) and week 7 (ā€œCalculate the accuracy of statistics drawn from
limited populationsā€)
(a) (3 marks)
0.072g+ 0.07b+c= 0 (1)
0.532g+ 0.53b+c= 2 (2)
0.852g+ 0.85b+c= 6 (3)


0.0720.07 1
0.5320.53 1
0.8520.85 1



g
b
c

=

0
2
6

(4)
(b) 3 marks
>> A=[0.07^2 0.07 1; 0.53^2 0.53 1; 0.85^2 0.85 1];
>> y = [0; 2; 6];
>> gbc = inv(A)*y
(c) 2 marks
function g = calcg(t)
% This function computes the acceleration due to gravity, based on
% an experiment that includes sensors placed at 0, 1 and 2 m
A=[t(1)^2 t(1) 1; t(2)^2 t(2) 1; t(3)^2 t(3) 1];
gbc = A\[0; 2; 6];
g=gbc(1);
(d) 2 marks
disp([’g = ’ num2str(mean(g)) ’ +/- ’ num2str(std(g)/length(g))])
1
pf3

Partial preview of the text

Download Acceleration Due to Gravity - Computational Science - Solved Exam and more Exams Computational Physics in PDF only on Docsity!

Computational Science in MATLAB

COSC1001 (Normal) & COSC1901 (Advanced)

Exam Solutions and Marking Scheme

  1. Measuring acceleration due to gravity

This question assesses week 8 (ā€œReview the application of linear algebra to physical prob- lemsā€, ā€œUnderstand the built-in matrix manipulation functionsā€ and ā€œApply matrix methods to problems in linear algebra...ā€), week 3 (ā€œWrite user-defined functionsā€), week 4 (ā€œUnder- stand the matrix datatypeā€) and week 7 (ā€œCalculate the accuracy of statistics drawn from limited populationsā€)

(a) (3 marks)

  1. 072 g + 0. 07 b + c = 0 (1)
  2. 532 g + 0. 53 b + c = 2 (2)
  3. 852 g + 0. 85 b + c = 6 (3)

g b c

(b) 3 marks

A=[0.07^2 0.07 1; 0.53^2 0.53 1; 0.85^2 0.85 1]; y = [0; 2; 6]; gbc = inv(A)*y

(c) 2 marks function g = calcg(t) % This function computes the acceleration due to gravity, based on % an experiment that includes sensors placed at 0, 1 and 2 m A=[t(1)^2 t(1) 1; t(2)^2 t(2) 1; t(3)^2 t(3) 1]; gbc = A[0; 2; 6]; g=gbc(1);

(d) 2 marks disp([’g = ’ num2str(mean(g)) ’ +/- ’ num2str(std(g)/length(g))])

  1. Biased Coin This assesses Week 5 (mostly ā€œGenerate a sequence and a matrix of random numbersā€ and ā€œSimulate random processes (e.g. tossing a coin)ā€) and Week 8 (ā€œCalculate the accuracy of statistics drawn from limited populationsā€)

(a) (3 marks)

(^00 )

100

200

300

400

500

600

700

(b) (4 marks)

clear trials=1e5; for n=1:trials results(n)=sum(round(rand(1,10)+0.1) ==1)<2; end disp([’Probability of less than 2 heads: ’ num2str(sum(results)/trials)])

(c) (3 marks) Decreasing the number of trials to 1000 would mean that the probability returned would only be given as a percentage to 1 decimal place and would be highly variable.

  1. xy coodinates and example code. This assesses weeks 1 through 4.

(4 marks) (a) t = [0:0.01:2]; x = exp(-t); y = t.*(2-t); d2 = x.^2+y.^2; t(d2==max(d2))

(b) i. (2 marks) 4 4. ii. (2 marks) 4 7 iii. (2 marks) 8 9