

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is the Solved Exam of Computational Science which includes Matrix Manipulation Functions, Acceleration Due to Gravity, Normal Distribution, Normalised Expression, Exponential with Several Bins, Acceptable Code, Normal Distribution etc. Key important points are: Acceleration Due to Gravity, Application of Linear Algebra, Built-In Matrix Manipulation Functions, Matrix Methods, User-Defined Functions, Matrix Datatype, Accuracy of Statistics
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


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)
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))])
(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.
(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