Back to tutorial index

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

>> 1 + 2*(3 + 4^5)
ans =

2055



Back to the top

Exercise 2

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

16.965773809523810



Back to the top

Exercise 3

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

5.308176100628931



Back to the top

Exercise 4

>> (4.34 + 5.61)^8.1
ans =

1.208834800102942e+08



Back to the top

Exercise 5

>> 3.1e12*4.5e-2
ans =

1.395000000000000e+11



Back to the top

Exercise 6

>> (-1)^(1/3)
ans =

0.500000000000000 + 0.866025403784439i



Back to the top

Exercise 7

>> nthroot(-1,3)
ans =

-1



Back to the top

Exercise 8

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

10



Back to the top

Exercise 9

>> 10^sqrt(2)
ans =

25.954553519470089



Back to the top

Exercise 10

>> 2.1^(0.3^4.6)
ans =

1.002922529144916



Back to the top

Exercise 11

>> 5 + 1/(2*sin(2))
ans =

5.549875085147308



Back to the top

Exercise 12

>> (2+sin(2.3))^(5*cos(5.6))
ans =

50.237152849829172



Back to the top

Exercise 13

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

-1



Back to the top

Exercise 14

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

2.887248214706980e-11



Back to the top

Exercise 15

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

0



Back to the top

Exercise 16

>> 1 + tan(5.4)^2 - sec(5.4)^2
ans =

4.440892098500626e-16



Back to the top

Exercise 17

>> sqrt(16*atan(1)^2/(cos(pi/2)^2 - sin(pi/2)^2))
ans =

0.000000000000000 + 3.141592653589793i



Back to the top

Exercise 18

>> acos(-0.23)
ans =

1.802874009657610



Back to the top

Exercise 19

>> acos(0.6)
ans =

0.927295218001612



Back to the top

Exercise 20

>> cosd(46)
ans =

0.694658370458997



Back to the top

Exercise 21

>> acosd(123)
ans =

0.000000000000000e+00 + 3.154313150184429e+02i



Back to the top

Exercise 22

>> log(11)/log(2)
ans =

3.459431618637298



Back to the top

Exercise 23

>> (2+3i)*(2-3i)

complex(2,3)*complex(2,-3)
ans =

13

ans =

13



Back to the top

Exercise 24

>> z = complex(2,3)
sin(z) - (exp(1i*z) - exp(-1i*z))/2i
z =

2.000000000000000 + 3.000000000000000i

ans =

1.776356839400250e-15



Back to the top

Exericse 25

>> log(-2)
ans =

0.693147180559945 + 3.141592653589793i



Back to the top

Exerciese 26

>> atan2(3,-2)
ans =

2.158798930342464



Back to the top