blob: 034d727ad4b0e83d89541c01148f5a9d9d2c891d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
clc,clear
//Example 1.25
//To find sin_theta and tan_theta when cos_theta is given
cos_theta = -4/5;
adjacent =4 ; hypotenuse =5 ;
opposite = sqrt(hypotenuse ^2 - adjacent ^2) //by pythagoras theorem
//minus sign of cos_theta implies 2nd or 3rd quadrant
//Possibility 1 : 2nd quadrant
x= -adjacent ;
y= opposite ;
r= hypotenuse ;
sin_theta = y/r ;
tan_theta = y/x ;
printf('POSSIBILITY 1:Theta in 2nd quadrant\n')
printf('sin(theta)= %.2f ; tan(theta) = %.2f; \n\n',sin_theta,tan_theta)
//Possibility 2 : 3rd quadrant
x=-adjacent ;
y=-opposite ;
r=hypotenuse ;
sin_theta = y/r ;
tan_theta = y/x ;
printf('POSSIBILITY 2:Theta in 3rd quadrant\n')
printf('sin(theta)= %.2f ; tan(theta) = %.2f; ',sin_theta,tan_theta)
|