Lab 1 : Solutions


Topics in this lab

First, make sure the formatting is set so that we see all the digits.

>> format long

Back to the top

Exercise 1

>> 17 + 3/11 + 1/(4-2^5)
ans =

  17.237012987012989

Back to the top

Exercise 2

>> (4.34 + 5.61)^8.1
ans =

     1.208834800102942e+08

Back to the top

Exercise 3

>> log(1/exp(1))
ans =

    -1

Back to the top

Exercise 4

>> sqrt(pi/(cos(1) + sin(1)))
ans =

   1.507844442112363

Back to the top

Exercise 5

>> (10^2)^(1/2)
ans =

    10

Back to the top

Exercise 6

>> 10^(2^(1/2))
ans =

  25.954553519470089

Back to the top

Exercise 7

>> (log10(sin(4.3) - tan(1.1) + 5)^(3.1^exp(1)))
ans =

     2.887248214706980e-11

Back to the top

Exercise 8

>> 5 + 1/(3 + 1/(4 + 1/12))
ans =

   5.308176100628931

Back to the top

Exercise 9

>> cosh(pi) - (exp(pi) + exp(-pi))/2
ans =

     0

Back to the top

Exercise 10

>> 1/7^0 + 1/7^1 + 1/7^2 + 1/7^3 + 1/7^4
ans =

   1.166597251145356

Back to the top

Exercise 11

>> 2.1^(0.3^4.6)
ans =

   1.002922529144916

Back to the top

Exercise 12

>> sin(2 + 3*i) - (exp(i*(2 + 3*i)) - exp(-i*(2 + 3*i)))/(2*i)
ans =

     1.776356839400250e-15

Back to the top

Get the code

Do you want to try the above code fragments on your own? Download the Matlab script that produces this page here. (lab_1_solns.m)

Powered by MathJax

Published with MATLAB® 8.2