You are on page 1of 3

A)

x=(3/17)*(pi)
x=
0.5544

i)

tan(2*x)

ans =
2.0083
(2*tan(x))/(1-(tan(x)*tan(x)))
ans =
2.0083
tan(2*x)=(2*tan(x))/(1-(tan(x)*tan(x)))

ii)

tan(x/2)

ans =
0.2845
sqrt((1-cos(x))/(1+cos(x)))
ans =
0.2845
tan(x/2)= sqrt((1-cos(x))/(1+cos(x)))

B)

function cuberoot(x)
cuberoot=((sqrt(x))^3)
end

cuberoot(3)
cuberoot =
5.1962
function fourthroot(x)
fourthroot=((sqrt(x))^4)
end

fourthroot(5)
fourthroot =

25.0000
function fifthroot(x)
fifthroot=((sqrt(x))^5)
end

fifthroot(2)
fifthroot =
5.6569
function sixthroot(x)
sixthroot=((sqrt(x))^6)
end

sixthroot(9)
sixthroot =
729

C)

x=2;
y=15;
power=1;
while(power<=y)
fprintf('x to the power of %d is %d \n',power,x^power)
power=power+1;
end

x
x
x
x
x
x
x
x
x
x
x
x
x
x
x

to
to
to
to
to
to
to
to
to
to
to
to
to
to
to

D)

the
the
the
the
the
the
the
the
the
the
the
the
the
the
the

power
power
power
power
power
power
power
power
power
power
power
power
power
power
power

of
of
of
of
of
of
of
of
of
of
of
of
of
of
of

1 is 2
2 is 4
3 is 8
4 is 16
5 is 32
6 is 64
7 is 128
8 is 256
9 is 512
10 is 1024
11 is 2048
12 is 4096
13 is 8192
14 is 16384
15 is 32768

f=[-3;-5]
f=
-3
-5
a=[3 2;1 0;0 1;-1 0;0 -1]
a=
3
1
0
-1
0

2
0
1
0
-1

b=[18;4;6;0;0]
b=
18
4
6
0
0
[x,fmin]=linprog(f,a,b)
Optimization terminated.
x=
2.0000
6.0000
fmin =
-36.0000
fmax=
36.0000

You might also like