Sir James the Wise is a brave and noble knight Each day he r
Sir James the Wise is a brave and noble knight. Each day he rides out with his sword, lance, and shining armour to seek adventure in the halls of the Mathematics Department. On each day there is a 5% probability that Sir James will rescue a princess, there is a 2% probability that Sir James will slay a dragon, and a 93% probability that he simply has a cup of tea and goes home again without rescuing a princess or slaying a dragon. Write a Matlab script file to estimate the probability that Sir James slays 5 or more dragons in one year. In any given week, what is the probability that Sir James has a cup of tea more often than he rescues a princess? (Write a Matlab script file to compute this.)
Solution
% Clears the screen and deletes all the variables in the workspace
clc;
clear;
%finds the probability of slaying 5 or more dragons in one year
d = 5 * (2 / 365 );
%displays the probability
disp(d)
%finds the probability of having a cup of tea more often than to rescue a princess
t = 1 - abs(93 / 7) + abs (5/7);
disp(t)
