Assignment Solution

Scalars

Source code

download solutions as an m-file

% sample solutions to assignment 01
% Author: Michael Goldwasser

% Problem A)
answerA = (28.5 * 3^3 - sqrt(1500)) / (11^2 + 37.3)

% Problem B)
answerB = (7/3)^2 * 4^3 * 18 - 6^7 / (9^3 - 652)

% Problem C)
x = 9.75;
answerC =  4*x^3 - 14*x^2 - 6.32*x + 7.3

% Problem D)
n = 12; r = 5;
answerD = factorial(n) / (factorial(r) * (factorial(n-r)))

% Problem E)
bigQuake = 10^(4.4 + 3 * 7.1 / 2);
smallQuake = 10^(4.4 + 3 * 6.9 / 2);
answerE = bigQuake / smallQuake

% Problem F)
R = 95; h = 20;
answerF = R * exp(-h/173)

% Problem G)
x0 = 3; y0 = -4;
A = 2; B = -7; C = -10;
answerG = abs(A*x0 + B*y0 + C) / sqrt(A^2 + B^2)

Output

answerA =

    4.6164


answerB =

   2.6365e+03


answerC =

   2.3222e+03


answerD =

   792


answerE =

    1.9953


answerF =

   84.6284


answerG =

    3.2967

Last modified: Thursday, 22 January 2009