Trigonometry - M. Corral
Trigonometry - M. Corral
Trigonometry
by M. Corral1
Created by
S Sai Ashrith Reddy
B.Tech
Electrical Engineering
NITK
College Teacher
None
Cross-Checked by
Chaitanya Potti
Title: Trigonometry
Author: M. Corral
Edition: 2
Year: 2010
ISBN: 9781475074574
1
Scilab numbering policy used in this document and the relation to the
above book.
For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means
a scilab code whose theory is explained in Section 2.3 of the book.
2
Contents
2 General Triangles 49
3 Identities 69
4 Radian Measure 70
8 Appendix B 118
3
List of Scilab Codes
4
Exa 1.19 To solve the right triangle with given infor-
mation . . . . . . . . . . . . . . . . . . . . . 33
Exa 1.20 To find values of all trigonometric values of
given angle of 120 . . . . . . . . . . . . . . . 34
Exa 1.21 To find values of all trigonometric values of
given angle of 225 . . . . . . . . . . . . . . . 36
Exa 1.22 To find values of all trigonometric values of
given angle of 330 . . . . . . . . . . . . . . . 38
Exa 1.23 To find trigonometric ratios of 0 90 180 and
270 degrees . . . . . . . . . . . . . . . . . . 40
Exa 1.24 To determine reference angle and angle be-
tween 0 to 360 with same terminal side as
given angle . . . . . . . . . . . . . . . . . . 44
Exa 1.25 To find sin theta and tan theta when cos theta
is given . . . . . . . . . . . . . . . . . . . . 46
Exa 1.27 To find all the angles with a given sine func-
tion value . . . . . . . . . . . . . . . . . . . 47
Exa 2.1 To solve the triangle when one side and 2 an-
gles are given . . . . . . . . . . . . . . . . . 49
Exa 2.2 To solve the triangle when 2 sides and one
opposite angle is given . . . . . . . . . . . . 51
Exa 2.3 To solve the triangle when 2 sides and oppo-
site angle is given . . . . . . . . . . . . . . . 51
Exa 2.4 To solve the triangle when 2 sides and angle
between them is given . . . . . . . . . . . . 52
Exa 2.5 To solve the triangle when 2 sides and angle
between them is given . . . . . . . . . . . . 54
Exa 2.6 To solve the triangle when 3 sides are given 54
Exa 2.7 To determine solution of a triangle when 3
sides are given . . . . . . . . . . . . . . . . . 55
Exa 2.8 To solve the triangle when 2 sides and oppo-
site angle is given . . . . . . . . . . . . . . . 57
Exa 2.10 To solve the triangle when 2 sides and in-
cluded angle is given . . . . . . . . . . . . . 59
Exa 2.11 To check the solution of triangle using Moll-
weide equation . . . . . . . . . . . . . . . . 59
Exa 2.12 To determine if a triangle can be formed with
given dimension . . . . . . . . . . . . . . . . 60
5
Exa 2.13 To determine area of triangle when 2 sides
and an angle is given . . . . . . . . . . . . . 61
Exa 2.14 To determine area of triangle when 3 angles
and a side is given . . . . . . . . . . . . . . 62
Exa 2.15 To determine area of triangle when 3 sides are
given . . . . . . . . . . . . . . . . . . . . . . 63
Exa 2.16 To determine area of triangle when 3 sides are
given . . . . . . . . . . . . . . . . . . . . . . 64
Exa 2.17 To find radius of circumscribed circle for tri-
angle ABC . . . . . . . . . . . . . . . . . . 65
Exa 2.18 To find the radius of circumscribed circle for
triangle ABC . . . . . . . . . . . . . . . . . 66
Exa 2.19 To determine radius of inscribed circle ABC 67
Exa 3.8 To determine values of functions of sum of 2
angles when functions of 2 angles are given . 69
Exa 4.1 To convert a degree measure to radians . . . 70
Exa 4.2 To convert a radian measure to degree . . . 70
Exa 4.3 To determine length of the intercepted arc . 71
Exa 4.4 To determine length of the arc intercepted . 71
Exa 4.5 To determine angle in radians and degrees . 71
Exa 4.6 To determine the length of the rope . . . . . 72
Exa 4.7 To determine the length of the belt around
the pulleys . . . . . . . . . . . . . . . . . . . 74
Exa 4.8 To find the area of sector of circle . . . . . . 75
Exa 4.9 To determine area of sector of a circle . . . . 75
Exa 4.10 To determine area of sector of circle . . . . . 76
Exa 4.11 To determine area insude belt pulley system 77
Exa 4.12 To determine area of segment formed by a
chord in circle . . . . . . . . . . . . . . . . . 77
Exa 4.13 To determine area of intersection of 2 circles 79
Exa 4.14 To find linear and angular speed of a moving
object . . . . . . . . . . . . . . . . . . . . . 80
Exa 4.15 To find linear and angular speed of a moving
object . . . . . . . . . . . . . . . . . . . . . 81
Exa 4.16 To find the central angle swept by a moving
object . . . . . . . . . . . . . . . . . . . . . 81
Exa 4.17 To find the angular speed of larger gear inter-
locked with smaller gear . . . . . . . . . . . 82
6
Exa 5.1 To sketch the graph of minus sinx in a given
interval . . . . . . . . . . . . . . . . . . . . 84
Exa 5.2 To sketch the graph of given function of in
given interval . . . . . . . . . . . . . . . . . 86
Exa 5.4 To determine the period of given sinusoidal
function . . . . . . . . . . . . . . . . . . . . 87
Exa 5.5 To determine the period of 2 given cosine
functions . . . . . . . . . . . . . . . . . . . . 88
Exa 5.6 To determine the amplitude and period of
given function . . . . . . . . . . . . . . . . . 90
Exa 5.7 To find amplitude and period of given com-
posite function . . . . . . . . . . . . . . . . 92
Exa 5.8 To find the amplitude and period of given
function . . . . . . . . . . . . . . . . . . . . 96
Exa 5.9 To find the amplitude and period of given
function . . . . . . . . . . . . . . . . . . . . 97
Exa 5.10 To find the period of given function . . . . . 99
Exa 5.11 To find the amplitude phase shift and period
of given function . . . . . . . . . . . . . . . 101
Exa 5.12 To find the amplitude phase shift and period
of given function . . . . . . . . . . . . . . . 103
Exa 5.13 To determine inverse sine function of a given
value . . . . . . . . . . . . . . . . . . . . . . 104
Exa 5.14 To determine inverse sine function of a given
value . . . . . . . . . . . . . . . . . . . . . . 105
Exa 5.15 To determine inverse cosine function of a given
value . . . . . . . . . . . . . . . . . . . . . . 106
Exa 5.16 To determine inverse cosine function of a given
value . . . . . . . . . . . . . . . . . . . . . . 106
Exa 5.17 To determine inverse tan function of a given
value . . . . . . . . . . . . . . . . . . . . . . 107
Exa 5.18 To determine inverse tan function of a given
value . . . . . . . . . . . . . . . . . . . . . . 107
Exa 5.19 To determine exact value of given expression
involving inverse trigonometric functions . . 107
Exa 6.3 To solve the given equation . . . . . . . . . 109
Exa 6.4 To solve the given equation . . . . . . . . . 109
7
Exa 6.9 To find the result of basic operations on 2
given complex numbers . . . . . . . . . . . . 110
Exa 6.10 To represent given complex number in trigono-
metric form . . . . . . . . . . . . . . . . . . 111
Exa 6.11 To determine product and ratio of complex
numbers using formula . . . . . . . . . . . . 112
Exa 6.12 To find higher powers of complex number us-
ing demoivre theorem . . . . . . . . . . . . 112
Exa 6.13 To determine the cube roots of i . . . . . . . 113
Exa 6.15 To convert from polar to cartesian coordinates 114
Exa 6.16 To convert from cartesian to polar coordinates 115
Exa 6.17 To express an equation in polar coordinates 116
Exa 6.19 To express an equation in polar coordinates 116
Exa 8.1 To plot the function of sin x . . . . . . . . . 118
8
List of Figures
9
1.22 To determine reference angle and angle between 0 to 360 with
same terminal side as given angle . . . . . . . . . . . . . . . 45
1.23 To find sin theta and tan theta when cos theta is given . . . 46
1.24 To find all the angles with a given sine function value . . . . 48
2.1 To solve the triangle when one side and 2 angles are given . 50
2.2 To solve the triangle when 2 sides and one opposite angle is
given . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.3 To solve the triangle when 2 sides and angle between them is
given . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.4 To solve the triangle when 2 sides and angle between them is
given . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.5 To solve the triangle when 3 sides are given . . . . . . . . . 55
2.6 To determine solution of a triangle when 3 sides are given . . 56
2.7 To solve the triangle when 2 sides and included angle is given 58
2.8 To determine area of triangle when 2 sides and an angle is given 61
2.9 To determine area of triangle when 3 angles and a side is given 62
2.10 To determine area of triangle when 3 sides are given . . . . . 63
2.11 To find radius of circumscribed circle for triangle ABC . . . 65
2.12 To find the radius of circumscribed circle for triangle ABC . 66
2.13 To determine radius of inscribed circle ABC . . . . . . . . . 68
10
5.9 To determine the amplitude and period of given function . . 91
5.10 To determine the amplitude and period of given function . . 93
5.11 To find amplitude and period of given composite function . 93
5.12 To find amplitude and period of given composite function . 95
5.13 To find the amplitude and period of given function . . . . . 95
5.14 To find the amplitude and period of given function . . . . . 97
5.15 To find the amplitude and period of given function . . . . . 98
5.16 To find the amplitude and period of given function . . . . . 99
5.17 To find the period of given function . . . . . . . . . . . . . . 100
5.18 To find the period of given function . . . . . . . . . . . . . . 101
5.19 To find the amplitude phase shift and period of given function 102
5.20 To find the amplitude phase shift and period of given function 103
5.21 To find the amplitude phase shift and period of given function 104
5.22 To find the amplitude phase shift and period of given function 105
11
Chapter 1
1 clc , clear
2 // e x a m p l e 1 . 1
3 //To d e t e r m i n e unknown a n g l e i n 3 g i v e n t r i a n g l e s
4
5 // T r i a n g l e ABC
6 A = 35 // a n g l e a t v e r t e x A i n d e g r e e s
7 C = 20 // a n g l e a t v e r t e x C i n d e g r e e s
8 B =180 - ( A + C ) // unknown a n g l e
9 printf ( ’ T r i a n g l e ABC : B = %. 0 f d e g r e e \n ’ ,B )
10
11 // T r i a n g l e DEF
12
Figure 1.2: To determine length of unknown side in 3 given right triangles
12 E = 53 // a n g l e a t v e r t e x E i n d e g r e e
13 //F = 9 0 , DEF i s r i g h t t r i a n g l e
14 // So a n g l e s E and D a r e c o m p l i m e n t a r y
15 D = 90 - E // unknown a n g l e
16 printf ( ’ T r i a n g l e DEF : D = %. 0 f d e g r e e \n ’ ,D )
17
18 // T r i a n g l e XYZ
19 sum_multiple = 1+3+1 // f o r s o l v o n g f o r a l p h a
20 alpha = 180/ sum_multiple
21 X = alpha // unknown a n g l e
22 Y = 3* alpha // unknown a n g l e
23 Z = alpha // unknown a n g l e
24 printf ( ’ T r i a n g l e XYZ : X=%. 0 f d e g r e e Y=%. 0 f d e g r e e Z
=%. 0 f d e g r e e ’ ,X ,Y , Z )
Scilab code Exa 1.3 To determine length of unknown side in 3 given right triangles
1 clc , clear
2 // e x a m p l e 1 . 3
3 //To d e t e r m i n e l e n g t h o f unknown s i d e i n 3 g i v e n
right triangles
4
5 // T r i a n g l e ABC
6 AB =5 // g i v e n
13
7 AC =4 // g i v e n
8 a = sqrt ( AB ^2 - AC ^2) // by p y t h a g o r a s t h e o r e m
9 printf ( ’ T r i a n g l e ABC : a=%f u n i t s \n ’ ,a )
10
11 // T r i a n g l e DEF
12 DE =2 // g i v e n
13 EF =1 // g i v e n
14 e = sqrt ( DE ^2 - EF ^2) // by p y t h a g o r a s t h e o r e m
15 printf ( ’ T r i a n g l e DEF : e=%f u n i t s = s q r t ( %f ) u n i t s \n
’ ,e , e ^2)
16
17 // T r i a n g l e XYZ
18 XZ =1 // g i v e n
19 YZ =1 // g i v e n
20 z = sqrt ( XZ ^2+ YZ ^2) // by p y t h a g o r a s t h e o r e m
21 printf ( ’ T r i a n g l e XYZ : z=%f u n i t s = s q r t ( %f ) u n i t s \n
’ ,z , z ^2)
Scilab code Exa 1.4 To determine height of the top of ladder touching the wall
1 clc , clear
2 // e x a m p l e 1 . 4
3 //To d e t e r m i n e h e i g h t o f the top o f l a d d e r touching
the wall
4
5 ladder = 17 // l e n g t h o f l a d d e r o r h y p o t e n u s e i n f e e t
6 base = 8 // d i s t a n c e b e t w e e n l o w e r t i p o f l a d d e r and
wall in f e e t
7 // U s i n g p y t h a g o r a s t h e o r e m
8 h = sqrt ( ladder ^2 - base ^2) // r e q u i r e d h e i g h t
9 printf ( ’ R e q u i r e d h e i g h t o f t o p o f l a d d e r i n c o n t a c t
w i t h w a l l = %. 0 f f t ’ ,h )
14
Figure 1.3: To determine height of the top of ladder touching the wall
15
Figure 1.4: To find values of all trigonometric functions for angles A and B
Scilab code Exa 1.5 To find values of all trigonometric functions for angles A and
1 clc , clear
2 // e x a m p l e 1 . 5
3 //To f i n d v a l u e s of a l l trigonometric functions for
a n g l e s A and B
4
5 // A n g l e a t v e r t e x A
16
6 opposite = 3;
7 adjacent = 4;
8 hypotenuse =5;
9
10 sin_A = opposite / hypotenuse ;
11 cos_A = adjacent / hypotenuse ;
12 tan_A = opposite / adjacent ;
13 csc_A = hypotenuse / opposite ;
14 sec_A = hypotenuse / adjacent ;
15 cot_A = adjacent / opposite ;
16 printf ( ’ANGLE A ’ )
17 printf ( ’ \ n s i n (A)= %. 1 f ; c o s (A)= %. 2 f ; t a n (A)=
%. 2 f ; \ n ’ , sin_A , cos_A , tan_A )
18 printf ( ’ c s c (A)= %. 3 f ; s e c (A)= %. 2 f ; c o t (A)= %. 2 f
; ’ , csc_A , sec_A , cot_A )
19
20 // A n g l e a t v e r t e x B
21 opposite = 4;
22 adjacent = 3;
23 hypotenuse =5;
24
25 sin_B = opposite / hypotenuse ;
26 cos_B = adjacent / hypotenuse ;
27 tan_B = opposite / adjacent ;
28 csc_B = hypotenuse / opposite ;
29 sec_B = hypotenuse / adjacent ;
30 cot_B = adjacent / opposite ;
31 printf ( ’ \n\nANGLE B ’ )
32 printf ( ’ \ n s i n (B)= %. 1 f ; c o s (B)= %. 2 f ; t a n (B)=
%. 2 f ; \ n ’ , sin_B , cos_B , tan_B )
33 printf ( ’ c s c (B)= %. 2 f ; s e c (B)= %. 2 f ; c o t (B)= %. 2
f ; ’ , csc_B , sec_B , cot_B )
17
Figure 1.5: To find values of all trigonometric functions for 45 degree
18
Scilab code Exa 1.6 To find values of all trigonometric functions for 45 degree
1 clc , clear
2 // e x a m p l e 1 . 6
3 //To f i n d v a l u e s of a l l trigonometric functions for
45 d e g r e e
4
5 // C o n s i d e r a s q u a r e o f s i d e 1 and d i v i d e i t h a l f
diagonally
6 //ABC i s now an i s o s c e l e s t r i a n g l e
7 // a n g l e A and B a r e now e q u a l and = 45 d e g r e e
8
9 AC =1;
10 BC =1;
11 AB = sqrt ( AC ^2+ BC ^2) // by p y t h a g o r a s t h e o r e m
12 c = AB // we d e n o t e AB by c a s i t s o p p o s i t e t o C
13
14 // c o n s i d e a n g l e BAC=45 d e g r e e
15 opposite = BC ;
16 adjacent = AC ;
17 hypotenuse = c ;
18 sin_45 = opposite / hypotenuse ;
19 cos_45 = adjacent / hypotenuse ;
20 tan_45 = opposite / adjacent ;
21 csc_45 = hypotenuse / opposite ;
22 sec_45 = hypotenuse / adjacent ;
23 cot_45 = adjacent / opposite ;
24
25 printf ( ’ANGLE = 45 d e g r e e ’ )
26 printf ( ’ \ n s i n ( 4 5 )= %. 4 f ; c o s ( 4 5 )= %. 4 f ; t a n ( 4 5 )=
%. 2 f ; \ n ’ , sin_45 , cos_45 , tan_45 )
27 printf ( ’ c s c ( 4 5 )= %. 4 f ; s e c ( 4 5 )= %. 4 f ; c o t ( 4 5 )= %
. 2 f ; ’ , csc_45 , sec_45 , cot_45 )
19
Figure 1.6: To find values of all trigonometric functions for 60 degree
20
Scilab code Exa 1.7 To find values of all trigonometric functions for 60 degree
1 clc , clear
2 // e x a m p l e 1 . 7
3 //To f i n d v a l u e s of a l l trigonometric functions for
60 d e g r e e
4
5 // t a k e an e q u i l a t e r a l t r i a n g l e o f s i d e 2 and d i v i d e
i t by h a l f
6 // a l l 3 a n g l e s o f e q u i l a t e r a l t r i a n g l e a r e same a s
60 d e g r e e
7 // t h e b i s e c t o r o f a n g l e i s a l s o t h e p e r e p n d i c u a l
bisector of oppsoite side
8 // Thus , A=60 B=30 C=90 i n new t r i a n g l e a s shown i n
figure
9
10 AB = 2; c = AB ;
11 AC = AB /2; b = AC ;
12 a = sqrt ( c ^2 - b ^2) // p y t h a g o r a s t h e o r e m
13
14 // For a n g l e A=60 d e g r e e
15 opposite = a ;
16 adjacent = b ;
17 hypotenuse = c ;
18 sin_60 = opposite / hypotenuse ;
19 cos_60 = adjacent / hypotenuse ;
20 tan_60 = opposite / adjacent ;
21 csc_60 = hypotenuse / opposite ;
22 sec_60 = hypotenuse / adjacent ;
23 cot_60 = adjacent / opposite ;
24 printf ( ’ANGLE = 60 d e g r e e ’ )
25 printf ( ’ \ n s i n ( 6 0 )= %. 4 f ; c o s ( 6 0 )= %. 4 f ; t a n ( 6 0 )=
%. 4 f ; \ n ’ , sin_60 , cos_60 , tan_60 )
26 printf ( ’ c s c ( 6 0 )= %. 4 f ; s e c ( 6 0 )= %. 4 f ; c o t ( 6 0 )= %
. 4 f ; ’ , csc_60 , sec_60 , cot_60 )
27
28 // For a n g l e ABC=30 d e g r e e
29 opposite = b ;
21
30 adjacent = a ;
31 hypotenuse = c ;
32 sin_30 = opposite / hypotenuse ;
33 cos_30 = adjacent / hypotenuse ;
34 tan_30 = opposite / adjacent ;
35 csc_30 = hypotenuse / opposite ;
36 sec_30 = hypotenuse / adjacent ;
37 cot_30 = adjacent / opposite ;
38 printf ( ’ \n\nANGLE = 30 d e g r e e ’ )
39 printf ( ’ \ n s i n ( 3 0 )= %. 4 f ; c o s ( 3 0 )= %. 4 f ; t a n ( 3 0 )=
%. 4 f ; \ n ’ , sin_30 , cos_30 , tan_30 )
40 printf ( ’ c s c ( 3 0 )= %. 4 f ; s e c ( 3 0 )= %. 4 f ; c o t ( 3 0 )= %
. 4 f ; ’ , csc_30 , sec_30 , cot_30 )
Scilab code Exa 1.8 To find all trigonometric functions when sine functions is giv
1 clc , clear
2 // e x a m p l e 1 . 8
3 //To f i n d a l l t r i g o n o m e t r i c f u n c t i o n s when s i n e
functions i s given
4
5 sin_A =2/3 // g i v e n
6 // s i n c e s i n e f u n c t i o n i s o p p o s i t e / h y p o t e n u s e and
7 //T− r a t i o s a r e d e f i n e d i n t e r m s o f r a t i o o f s i d e d o f
right triangle
8 opposite =2;
9 hypotenuse =3;
10 BC = opposite ;
11 AB = hypotenuse ;
12 b = sqrt ( hypotenuse ^2 - opposite ^2) // by p y t h a g o r a s
theorem
13 adjacent = b ;
14
22
Figure 1.7: To find all trigonometric functions when sine functions is given
23
Figure 1.8: To convert given function into function of angle less than 45
Scilab code Exa 1.9 To convert given function into function of angle less than 45
1 clc , clear
2 // e x a m p l e 1 . 9
3 //To c o n v e r t g i v e n function into function of angle
l e s s t h a n 45
4
5 // ( a ) s i n 65
24
6 angle = 65 ;
7 complement_angle = 90 - 65 ;
8 // c o f u c t i o n o f s i n e i s c o s i n e
9 printf ( ’ ( a ) s i n ( %f )= c o s ( %f ) \n ’ , angle ,
complement_angle )
10
11 // ( b ) c o s 78
12 angle = 78;
13 complement_angle = 90 - 78 ;
14 // c o f u c t i o n o f c o s i n e i s s i n e
15 printf ( ’ ( b ) c o s ( %f )= s i n ( %f ) \n ’ , angle ,
complement_angle )
16
17 // ( c ) t a n 59
18 angle = 59 ;
19 complement_angle = 90 - 59 ;
20 // c o f u c t i o n o f t a n i s c o t
21 printf ( ’ ( c ) t a n ( %f )= c o t ( %f ) \n ’ , angle ,
complement_angle )
Scilab code Exa 1.10 To find sine cosine and tangent functions for 75 degree
1 clc , clear
2 // e x a m p l e 1 . 1 0
3 //To f i n d s i n e , c o s i n e and t a n g e n t f u n c t i o n s f o r 75
degree
4
5 // t r i a n g l e A D B , angle BAD = 30
6 AB = sqrt (3) ; BD =1;
7 AD = sqrt ( AB ^2+ BD ^2) ; // p y t h a g o r a s t h e o r e m
8
9 // angle DAB + angle CAB = 75
10 // t r i a n g l e A B C , angle BAC = 45
25
Figure 1.9: To find sine cosine and tangent functions for 75 degree
26
11 // p y t h a g o r a s t h e o r e m and 45 d e g r e e s
12 AC = AB / sqrt (2) ; BC = AC ;
13
14 angle_BAC = 45 ; angle_DAB = 30 ;
15 angle_DAE = angle_BAC + angle_DAB ; // r e q u i r e d a n g l e
16 angle_ADE = 90 - angle_DAE ; // complement o f DAE
17 angle_ADB = 90 - angle_DAB ; // complement o f DAB
18
19 // Draw BF p e r p e n d i c u l a r t o DE
20 angle_BDF = angle_ADB - angle_ADE ;
21 angle_DBF = 90 - angle_BDF ; // complement o f BDF
22 //By p y t h a g o r a s t h e o r e m and 45 d e g r e e
23 DF = sqrt ( BD /2) ; FB = DF ;
24
25 EC = FB ; // p a r a l l e l s i d e s o f r e c t a n g l e
26 FE = BC ; // p a r a l l e l s i d e s o f r e c t a n g l e
27 DE = DF + FE ; // from t h e f i g u r e
28 AE = AC - EC ; // from t h e f i g u r e
29
30 sin_DAE = DE / AD ;
31 cos_DAE = AE / AD ;
32 tan_DAE = DE / AE ;
33 csc_DAE = AD / DE ;
34 sec_DAE = AD / AE ;
35 cot_DAE = AE / DE ;
36
37 printf ( ’ s i n (%d)=%f\n ’ , angle_DAE , sin_DAE ) ;
38 printf ( ’ c o s (%d)=%f\n ’ , angle_DAE , cos_DAE ) ;
39 printf ( ’ t a n (%d)=%f\n ’ , angle_DAE , tan_DAE ) ;
40 printf ( ’ c s c (%d)=%f\n ’ , angle_DAE , csc_DAE ) ;
41 printf ( ’ s e c (%d)=%f\n ’ , angle_DAE , sec_DAE ) ;
42 printf ( ’ c o t (%d)=%f\n ’ , angle_DAE , cot_DAE ) ;
27
Figure 1.10: To find the height of the flagpole
28
Figure 1.11: To find the height of mountain
1 clc , clear
2 // e x a m p l e 1 . 1 1
3 //To f i n d t h e h e i g h t o f t h e f l a g p o l e
4
5 // c o n s i d e t h e a t t a c h e d f i g u r e
6 d =150 // d i s t a n c e o f p e r s o n from f l a g p o l e i n f e e t
7 angle_ele = 32 // a n g l e o f e l e v a t i o n i n d e g r e e
8 height_eyes =6 // h e i g h t o f man ’ s e y e s
9 h = d * tand ( angle_ele )
10 height_flagpole = height_eyes + h
11 printf ( ’ R e q u i r e d h e i g h t o f f l a g p o l e = %. 0 f f t ’ ,
height_flagpole )
29
Scilab code Exa 1.12 To find the height of mountain
1 clc , clear
2 // Example 1 . 1 2
3 //To f i n d t h e h e i g h t o f mountain
4
5 // from t h e f i g u r e
6 // h i s h e i g h t o f mountain i n d e g r e e
7 // x i s d i s t a n c e from b a s e o f mountain t o t h e p o i n t
u n d e r t o p o f mountain
8
9 d1 =400 // i n i t i a l d i t a n c e from b a s e o f mountain i n
feet
10 d2 =500 // f i n a l d i t a n c e from b a s e o f mountain i n f e e t
11 theta1 =25 // i n i t i a l a n g l e o f e l e v a t i o n i n d e g r e e s
12 theta2 =20 // f i n a l a n g l e o f e l e v a t i o n i n d e g r e e s
13
14 // from t h e f i g u r e
15 // h= ( x+d1 ) ∗ t a n d ( t h e t a 1 )
16 // h= ( x+d2 ) ∗ t a n d ( t h e t a 2 )
17 // e l i m i n a t i n g h and s o l v i n g f o r x
18 x =(( d1 + d2 ) * tand ( theta2 ) - d1 * tand ( theta1 ) ) /( tand (
theta1 ) - tand ( theta2 ) )
19 // s u b s t i t u t i n g x i n e x p r e s s i o n f o r h
20 h = ( x + d1 ) * tand ( theta1 )
21 printf ( ’ H e i g h t o f mountain = %. 0 f f e e t ’ ,h )
Scilab code Exa 1.13 To find the horizontal distance from blimp to house
1 clc , clear
30
Figure 1.12: To find the horizontal distance from blimp to house
2 // Example 1 . 1 3
3 //To f i n d t h e h o r i z o n t a l d i s t a n c e from b l i m p t o
house
4
5 // c o n s i d e r t h e f i g u r e a t t a c h e d
6 angle_dep = 24 // a n g l e o f d e p r e s s i o n i n d e g r e e s
7 theta = angle_dep // a n g l e o f e l e v a t i o n
8 height_blimp = 4280 // h e i g h t o f b l i m p from g r o u n d i n
feet
9 x = height_blimp / tand ( theta ) // r e q u i r e d d i s t a n c e
in f e e t
10
11 printf ( ’ The h o u s e i s %. 0 f f t f a r from b l i m p a l o n g
t h e g r o u n d ’ ,x )
31
Figure 1.13: To estimate radius of earth when angle of depression is known
32
Scilab code Exa 1.14 To estimate radius of earth when angle of depression is known
1 clc , clear
2 // Example 1 . 1 4
3 //To e s t i m a t e r a d i u s o f e a r t h when a n g l e o f
d e p r e s s i o n i s known
4
5 angle_dep = 2.23 // a n g l e o f d e p r e s s i o n i n d e g r e e s
6 // I n t h e f i g u r e ,
7 // r i s t h e r a d i u s o f e a r t h
8 //A r e p r e s e n t t h e t o p o f t h e mountain
9 //H be t h e o c e a n h o r i z o n i n t h e l i n e o f s i g h t from A
10 //O be t h e c e n t e r o f t h e e a r t h
11 //B i s a p o i n t on t h e h o r i z o n t a l l i n e o f s i g h t from
A
12
13 angle_OAH = 90 - angle_dep ;
14 theta = 180 - 90 - angle_OAH ;
15 height =3 // h e i g h t o f mountain
16 // r i s r a d i u s o f e a r t h t o be d e t e r m i n e d
17
18 // d i s t a n c e from t o p o f mountain from c e n t r e = r +
height
19 // c o s d ( t h e t a )= r / r+h e i g h t . . . s o l v i n g f u r t h e r
20 r = height * cosd ( theta ) /(1 - cosd ( theta ) ) ;
21 printf ( ’ R a d i u s o f e a r t h a s c a l c u l a t e d = %. 1 f m i l e s \n
’ ,r )
Scilab code Exa 1.15 To find the distance from centre of earth to sun
33
Figure 1.14: To find the distance from centre of earth to sun
34
Figure 1.15: To determine the radius of sun
1 clc , clear
2 // Example 1 . 1 5
3 // To f i n d t h e d i s t a n c e from c e n t r e o f e a r t h t o sun
4
5 alpha = 0.00244; // e q u i t o r i a l p a r a l a l x i n d e g r e e
6 OA = 3956.6; // r a d i u s o f e a r t h
7 angle_OAB = 90;
8
9 OB = OA / sind ( alpha ) ;
10 printf ( ’ D i s t a n c e i s o b t a i n e d a s %. 0 f m i l e s = %. 0 f
m i l l i o n m i l e s ’ ,OB , OB /10^6)
1 clc , clear
2 // Example 1 . 1 6
3 // To d e t e r m i n e t h e r a d i u s o f sun
4
35
5 angle_AEB =0 +(32/60) + (4/60) /60 // c o n v e r t i n g t o
degrees
6
7 // T r i a n g l e BES and AES a r e s i m i l a r
8 //BS=AS a s t h e y a r e r a d i u s
9 //ES i s common t o b o t h t r i a n g l e s
10 // a n g l e E B S=ang le AB S =90 a s t a n g e n t s a r e
perpendicualar to radius
11 // a n g l e A E S = a n g l e B E S
12 angle_AES = angle_AEB /2;
13 angle_BES = angle_AEB /2;
14
15 // t o f i n d d i t a n c e from sun t o c e n t r e o f e a r t h
16 // o b t a i n e d from p r e v i o u s e x a m p l e
17 alpha = 0.00244; // e q u i t o r i a l p a r a l a l x i n d e g r e e
18 OA = 3956.6 ; // r a d i u s o f e a r t h
19 angle_OAB = 90 ; // r a d i u s p e r p e n d i c u l a r t o t a n g e n t
20 OB = OA / sind ( alpha ) ;
21
22 //ES i s from e a r t h s u r f a c e t o sun c e n t r e
23 // c e n t r e o f e a r t h t o sun i s OB
24 // we i n i t i a l l y t r e a t e d sun a s p o i n t
25 // t h a t d i t a n c e i s d i s t a n c e b e t w e e n t h e i r c e n t r e s
26 radius_earth =3956.6 ; // i n m i l e s
27 ES = OB - radius_earth ; // i n m i l e s
28 AS = ES * sind ( angle_AES ) ; // i n m i l e s
29 printf ( ’ R e q u i r e d r a d i u s o f sun = %. 0 f m i l e s \n ’ , AS )
30 printf ( ’ Answer might v a r y due t o a p p r o x i m a t i o n s i n
book and s c i l a b p r e c i s i o n ’ )
1 clc , clear
36
Figure 1.16: To determine the diameter of larger roller
37
2 // Example 1 . 1 7
3 //To f i n d t h e d i a m e t e r o f l a r g e r r o l l e r
4
5 // s i n c e r a d i u s p e r p e n d i c u l a r t o t a n g e n t
6 angle_ODA =90;
7 angle_PEC =90
8 angle_OAD =37 ; // by symmetry
9 ED =1.38 ; // g i v e n
10 // s i n c e DOA i s r i g h t t r i a n g l e , DOA and OAD a r e
complementary a n g l e s
11 angle_DOA =90 - angle_OAD ;
12
13 // s i n c e r a d i u s p e r p e n d i c u l a r t o t a n g e n t
14 angle_OBC =90;
15 angle_PBC =90;
16
17 // s i n c e ODA and ODC a r e r i g h t t r i a n g l e ,
18 //OD = OB a s r a d i u s and BC=DC by p y t h a g o r a s
19 //OBC and ODC a r e now c o n g r u e n t
20 // angle BOC = angle DOC
21 // angle BOC + angle DOC =(90− angle OAD )
22 angle_BOC = (90 - angle_OAD ) /2;
23 angle_DOC = (90 - angle_OAD ) /2;
24
25 //BP=EP a s r a d i u s
26 // s i n c e r a d i u s p e r p e n d i c u l a r t o t a n g e n t
27 angle_PBC =90;
28 angle_PEC =90;
29 // Thus , BPC and EPC a r e c o n g r u e n t t r i a n g l e s
30 // T h e r e f o r e , BC=DC and BC+DC = ED
31 BC = ED /2;
32 DC = ED /2;
33 OB = BC / tand ( angle_BOC ) ; // r a d i u s o f l a r g e r o l l e r
34 diameter = 2* OB ;
35 printf ( ’ D i a m e t e r o f l a r g e r r o l l e r = %. 3 f u n i t s ’ ,
diameter )
38
Figure 1.17: To solve the right triangle with given information
Scilab code Exa 1.19 To solve the right triangle with given information
1 clc , clear
2 // Example 1 . 1 9
3 //To s o l v e t h e r i g h t t r i a n g l e with given i n f o r m a t i o n
4
39
5 // p a r t ( a )
6 c =10 ; // s i d e o p p o s i t e t o v e r t e x C
7 A =22 ; // A n g l e a t v e r t e x A
8 a = c * sind ( A ) ;
9 b = c * cosd ( A ) ;
10 B =90 - A ; // s i n c e C i s 9 0 , A and B a r e c o m p l i m e n t a r y
11 printf ( ’ ( a ) a= %. 2 f u n i t s ; b= %. 2 f u n i t s ; B = %. 0 f
d e g r e e \n ’ ,a ,b , B )
12
13 // p a r t ( b )
14 b =8 ; // s i d e o p p o s i t e t o v e r t e x B
15 A =40 ; // A n g l e a t v e r t e x A
16 a = b * tand ( A ) ;
17 c = b / cosd ( A ) ;
18 B =90 - A ; // s i n c e C i s 9 0 , A and B a r e c o m p l i m e n t a r y
19 printf ( ’ ( b ) a= %. 2 f u n i t s ; c= %. 2 f u n i t s ; B = %. 0 f
d e g r e e \n ’ ,a ,c , B )
20
21 // p a r t ( c )
22 a =3 ; // s i d e o p p o s i t e t o v e r t e x A
23 b =4 ; // s i d e o p p o s i t e t o v e r t e x B
24 c = sqrt ( a ^2+ b ^2) ; // by p y t h a g o r a s t h e o r e m
25 A = atand ( a / b ) ; // a n g l e a t v e r t e x A
26 B =90 - A ; // s i n c e C i s 9 0 , A and B a r e c o m p l i m e n t a r y
27 printf ( ’ ( c ) c=%. 0 f u n i t s ; A= %f d e g r e e ; B = %f
d e g r e e ’ ,c ,A , B )
Scilab code Exa 1.20 To find values of all trigonometric values of given angle of
1 clc , clear
2 // Example 1 . 2 0
3 //To f i n d v a l u e s of a l l trigonometric values of
g i v e n a n g l e o f 120
40
Figure 1.18: To find values of all trigonometric values of given angle of 120
41
4
5 theta =120; // g i v e n a n g l e i n d e g r e e
6 // C o n s i d e r a p o i n t ( −1 , s q r t ( 3 ) ) i n 2 nd q u a d r a n t
7 // T h i s p o i n t can be u s e d on t e r m i n a l s i d e o f 120
8 // Thus f o r a b a s i c r i g h t a n g l e d t r i a n g l e f o r m e d i n
second quadrant
9 adjacent = 1;
10 opposite = sqrt (3) ;
11 // by p y t h a g o r a s t h e o r e m
12 hypotenuse = sqrt ( adjacent ^2 + opposite ^2) ;
13
14 // s i n c e i t s t h i r d q u a d r a n t
15 x = - adjacent ;
16 y = opposite ;
17 r = hypotenuse ;
18
19 sin_120 = y / r ;
20 cos_120 = x / r ;
21 tan_120 = y / x ;
22 csc_120 = r / y ;
23 sec_120 = r / x ;
24 cot_120 = x / y ;
25
26 printf ( ’ \ n s i n (%d)= %f ; c o s (%d)= %f ; t a n (%d)= %f ; ’
, theta , sin_120 , theta , cos_120 , theta , tan_120 )
27 printf ( ’ \ n c s c (%d)= %f ; s e c (%d)= %f ; c o t (%d)= %f ; ’
, theta , csc_120 , theta , sec_120 , theta , cot_120 )
Scilab code Exa 1.21 To find values of all trigonometric values of given angle of
1 clc , clear
2 // Example 1 . 2 1
3 //To f i n d v a l u e s of a l l trigonometric values of
42
Figure 1.19: To find values of all trigonometric values of given angle of 225
43
g i v e n a n g l e o f 225
4
5 theta =225 ; // g i v e n a n g l e i n d e g r e e
6 // C o n s i d e r a p o i n t ( −1 , −1) i n 3 r d q u a d r a n t
7 // T h i s p o i n t can be u s e d on t e r m i n a l s i d e o f 225
8 // Thus f o r a b a s i c r i g h t a n g l e d t r i a n g l e f o r m e d i n 3
rd quadrant
9 adjacent = 1 ;
10 opposite = 1 ;
11 // by p y t h a g o r a s t h e o r e m
12 hypotenuse = sqrt ( adjacent ^2 + opposite ^2) ;
13
14 // s i n c e i t s t h i r d q u a d r a n t
15 x = - adjacent ;
16 y = - opposite ;
17 r = hypotenuse ;
18
19 sin_225 = y / r ;
20 cos_225 = x / r ;
21 tan_225 = y / x ;
22 csc_225 = r / y ;
23 sec_225 = r / x ;
24 cot_225 = x / y ;
25
26 printf ( ’ \ n s i n (%d)= %f ; c o s (%d)= %f ; t a n (%d)= %f ; ’
, theta , sin_225 , theta , cos_225 , theta , tan_225 )
27 printf ( ’ \ n c s c (%d)= %f ; s e c (%d)= %f ; c o t (%d)= %f ; ’
, theta , csc_225 , theta , sec_225 , theta , cot_225 )
Scilab code Exa 1.22 To find values of all trigonometric values of given angle of
1 clc , clear
2 // Example 1 . 2 2
44
Figure 1.20: To find values of all trigonometric values of given angle of 330
45
3 //To f i n d v a l u e s o f a l l t r i g o n o m e t r i c v a l u e s o f
g i v e n a n g l e o f 330
4
5 theta =330 ; // g i v e n a n g l e i n d e g r e e
6 // C o n s i d e r a p o i n t ( s q r t ( 3 ) , −1) i n 4 t h q u a d r a n t
7 // T h i s p o i n t can be u s e d on t e r m i n a l s i d e o f 330
8 // Thus f o r a b a s i c r i g h t a n g l e d t r i a n g l e f o r m e d i n 4
th quadrant
9 adjacent = sqrt (3) ;
10 opposite = 1 ;
11 hypotenuse = sqrt ( adjacent ^2 + opposite ^2) ;
12 // by p y t h a g o r a s t h e o r e m
13
14 // s i n c e i t s 4 t h q u a d r a n t
15 x = adjacent ;
16 y = - opposite ;
17 r = hypotenuse ;
18
19 sin_330 = y / r ;
20 cos_330 = x / r ;
21 tan_330 = y / x ;
22 csc_330 = r / y ;
23 sec_330 = r / x ;
24 cot_330 = x / y ;
25
26 printf ( ’ \ n s i n (%d)= %f ; c o s (%d)= %f ; t a n (%d)= %f ; ’
, theta , sin_330 , theta , cos_330 , theta , tan_330 )
27 printf ( ’ \ n c s c (%d)= %f ; s e c (%d)= %f ; c o t (%d)= %f ; ’
, theta , csc_330 , theta , sec_330 , theta , cot_330 )
Scilab code Exa 1.23 To find trigonometric ratios of 0 90 180 and 270 degrees
1 clc , clear
46
Figure 1.21: To find trigonometric ratios of 0 90 180 and 270 degrees
47
2 // Example 1 . 2 3
3 //To f i n d t r i g o n o m e t r i c f u n c t i o n s o f v a r i o u s a n g l e s
4 // Note : U n d e f i n e d r a t i o s a r e commented t o a v o i d
d i v i d e by z e r o e r r o r
5
6 // z e r o d e g r e e s
7 // c o n s i d e r a p o i n t ( 1 , 0 )
8 // L i n e s e g m e n t j o i n i n g ( 0 , 0 ) and ( 1 , 0 ) can be
t r e a t e d as t r i a n g l e
9
10 x =1 // b a s e
11 y =0 // h e i g h t
12 r =1 // h y p o t e n u s e
13 sin_0 = y / r ;
14 cos_0 = x / r ;
15 tan_0 = y / x ;
16 // c s c 0 =r / y ;
17 sec_0 = r / x ;
18 // c o t 0=x / y ;
19 printf ( ’ \nZERO DEGREES: \ n ’ )
20 printf ( ’ s i n ( 0 )= %f ; \ n ’ , sin_0 )
21 printf ( ’ c o s ( 0 )= %f ; \ n ’ , cos_0 )
22 printf ( ’ t a n ( 0 )= %f ; \ n ’ , tan_0 )
23 printf ( ’ c s c ( 0 )= u n d e f i n e d = ( 1 / 0 ) ; \ n ’ )
24 printf ( ’ s e c ( 0 )= %f ; \ n ’ , sec_0 )
25 printf ( ’ c o t ( 0 )= u n d e f i n e d = ( 1 / 0 ) ; \ n ’ )
26
27 // 90 d e g r e e s
28 // c o n s i d e r a p o i n t ( 0 , 1 )
29 // L i n e s e g m e n t j o i n i n g ( 0 , 0 ) and ( 0 , 1 ) can be
t r e a t e d as t r i a n g l e
30
31 x =0 // b a s e
32 y =1 // h e i g h t
33 r =1 // h y p o t e n u s e
34 sin_90 = y / r ;
35 cos_90 = x / r ;
36 // t a n 9 0 = y / x ;
48
37 csc_90 = r / y ;
38 // s e c 9 0 = r / x ;
39 cot_90 = x / y ;
40 printf ( ’ \ n90 DEGREES: \ n ’ )
41 printf ( ’ s i n ( 9 0 )= %f ; \ n ’ , sin_90 )
42 printf ( ’ c o s ( 9 0 )= %f ; \ n ’ , cos_90 )
43 printf ( ’ t a n ( 9 0 )= u n d e f i n e d = ( 1 / 0 ) ; \ n ’ )
44 printf ( ’ c s c ( 9 0 )= %f ; \ n ’ , csc_90 )
45 printf ( ’ s e c ( 9 0 )= u n d e f i n e d = ( 1 / 0 ) ; \ n ’ )
46 printf ( ’ c o t ( 9 0 )= %f ; \ n ’ , cot_90 )
47
48 // 180 d e g r e e s
49 // c o n s i d e r a p o i n t ( − 1 , 0 )
50 // L i n e s e g m e n t j o i n i n g ( 0 , 0 ) and ( − 1 , 0 ) can be
t r e a t e d as t r i a n g l e
51
52 x = -1 // b a s e
53 y =0 // h e i g h t
54 r =1 // h y p o t e n u s e
55 sin_180 = y / r ;
56 cos_180 = x / r ;
57 tan_180 = y / x ;
58 // c s c 1 8 0 =r / y ;
59 sec_180 = r / x ;
60 // c o t 1 8 0=x / y ;
61 printf ( ’ \ n180 DEGREES: \ n ’ )
62 printf ( ’ s i n ( 1 8 0 )= %f ; \ n ’ , sin_180 )
63 printf ( ’ c o s ( 1 8 0 )= %f ; \ n ’ , cos_180 )
64 printf ( ’ t a n ( 1 8 0 )= %f ; \ n ’ , tan_180 )
65 printf ( ’ c s c ( 1 8 0 )= u n d e f i n e d = ( 1 / 0 ) ; \ n ’ )
66 printf ( ’ s e c ( 1 8 0 )= %f ; \ n ’ , sec_180 )
67 printf ( ’ c o t ( 1 8 0 )= u n d e f i n e d = ( −1/0) ; \ n ’ )
68
69
70 // 270 d e g r e e s
71 // c o n s i d e r a p o i n t ( 0 , − 1 )
72 // L i n e s e g m e n t j o i n i n g ( 0 , 0 ) and ( 0 , − 1 ) can be
t r e a t e d as t r i a n g l e
49
73
74 x =0 // b a s e
75 y = -1 // h e i g h t
76 r =1 // h y p o t e n u s e
77 sin_270 = y / r ;
78 cos_270 = x / r
79 // t a n 9 0 = y / x ;
80 csc_270 = r / y ;
81 // s e c 9 0 = r / x ;
82 cot_270 = x / y ;
83 printf ( ’ \ n270 DEGREES: \ n ’ )
84 printf ( ’ s i n ( 2 7 0 )= %f ; \ n ’ , sin_270 )
85 printf ( ’ c o s ( 2 7 0 )= %f ; \ n ’ , cos_270 )
86 printf ( ’ t a n ( 2 7 0 )= u n d e f i n e d = ( −1/0) ; \ n ’ )
87 printf ( ’ c s c ( 2 7 0 )= %f ; \ n ’ , csc_270 )
88 printf ( ’ s e c ( 2 7 0 )= u n d e f i n e d = ( 1 / 0 ) ; \ n ’ )
89 printf ( ’ c o t ( 2 7 0 )= %f ; \ n ’ , cot_270 )
Scilab code Exa 1.24 To determine reference angle and angle between 0 to 360 with
1 clc , clear
2 // Example 1 . 2 4
3 //To d e t e r m i n e r e f e r e n c e a n g l e and a n g l e ( 0 t o 360
) w i t h same t e r m i n a l s i d e a s g i v e n a n g l e
4
5 theta = 928 ; // g i v e n a n g l e i n d e g r e e s
6
7 // The w h i l e l o o p w o r k s f o r ALL VALUES OF t h e t a
8 // I t k e e p s s u b t r a c t i n g 360 t i l l a v a l u e i n ( 0 t o
360) i s obtained
9 result = theta ;
10 while 1==1 ,
11 if result <360 then
50
Figure 1.22: To determine reference angle and angle between 0 to 360 with
same terminal side as given angle
51
Figure 1.23: To find sin theta and tan theta when cos theta is given
Scilab code Exa 1.25 To find sin theta and tan theta when cos theta is given
1 clc , clear
2 // Example 1 . 2 5
3 //To f i n d s i n t h e t a and t a n t h e t a when c o s t h e t a is
given
52
4
5 cos_theta = -4/5;
6 adjacent =4 ; hypotenuse =5 ;
7 opposite = sqrt ( hypotenuse ^2 - adjacent ^2) // by
pythagoras theorem
8
9 // minus s i g n o f c o s t h e t a i m p l i e s 2 nd o r 3 r d
quadrant
10 // P o s s i b i l i t y 1 : 2 nd q u a d r a n t
11 x = - adjacent ;
12 y = opposite ;
13 r = hypotenuse ;
14 sin_theta = y / r ;
15 tan_theta = y / x ;
16 printf ( ’ POSSIBILITY 1 : Theta i n 2 nd q u a d r a n t \n ’ )
17 printf ( ’ s i n ( t h e t a )= %. 2 f ; t a n ( t h e t a ) = %. 2 f ; \n\n ’
, sin_theta , tan_theta )
18
19 // P o s s i b i l i t y 2 : 3 r d q u a d r a n t
20 x = - adjacent ;
21 y = - opposite ;
22 r = hypotenuse ;
23 sin_theta = y / r ;
24 tan_theta = y / x ;
25 printf ( ’ POSSIBILITY 2 : Theta i n 3 r d q u a d r a n t \n ’ )
26 printf ( ’ s i n ( t h e t a )= %. 2 f ; t a n ( t h e t a ) = %. 2 f ; ’,
sin_theta , tan_theta )
Scilab code Exa 1.27 To find all the angles with a given sine function value
1 clc , clear
2 // Example 1 . 2 7
3 //To f i n d a l l t h e a n g l e s w i t h a g i v e n sine function
53
Figure 1.24: To find all the angles with a given sine function value
value
4
5 sin_theta = -0.682;
6 theta = asind ( sin_theta ) ;
7 // T h i s r e s u l t s −43 d e g r e e which i s n t i n 0 t o 360
range
8 //And t h e t a e x i s t s i n 4 t h q u a d r a n t
9 // A n g l e s i n 1 s t and 2 nd q u a d r a n t have +ve s i n e
values
10
11 theta1 = 180 - theta ; // r e f l e c t i o n o f t h e t a i n 3 r d
quadrant
12 theta2 = 360 + theta ; // b o t h t h e t a n t h e t a 2 have
same t r i g o n o m e t r i c v a l u e s
13 printf ( ’ R e q u i r e d a n g l e s a r e %. 0 f and %. 0 f d e g r e e s ’ ,
theta1 , theta2 )
54
Chapter 2
General Triangles
Scilab code Exa 2.1 To solve the triangle when one side and 2 angles are given
1 // Example 2 . 1
2 //To s o l v e t h e t r i a n g l e when one s i d e and 2 a n g l e s
are given
3 clc , clear
4
5 a =10 // s i d e o p p o s i t e t o v e r t e x A
6 A =41 // a n g l e a t v e r t e x A
7 C =75 // a n g l e a t v e r t e x C
8
9 B =180 - ( A + C )
10 b = a * sind ( B ) / sind ( A ) // law o f s i n e s
11 c = a * sind ( C ) / sind ( A ) // law o f s i n e s
12 printf ( ’ A n g l e B i s %. 0 f d e g r e e s \n l e n g t h o f s i d e b
i s %. 1 f u n i t s \n l e n g t h o f s i d e c i s %. 1 f u n i t s ’ ,B
,b , c )
55
Figure 2.1: To solve the triangle when one side and 2 angles are given
Figure 2.2: To solve the triangle when 2 sides and one opposite angle is given
56
Scilab code Exa 2.2 To solve the triangle when 2 sides and one opposite angle is g
1 // Example 2 . 2
2 //To s o l v e t h e t r i a n g l e when 2 s i d e s and one
opposite angle i s given
3 clc , clear
4
5 a =18 // s i d e o p o s i t e t o v e r t e x A
6 A =25 // a n g l e a t v e r t e x A
7 b =30 // s i d e o p p o s i t e t o v e r t e x B
8
9 sin_B =( b / a ) * sind ( A ) // law o f s i n e s
10
11 // c a s e 1
12 B = asind ( sin_B ) // law o f s i n e s
13 C =180 -( A + B )
14 c = a * sind ( C ) / sind ( A ) // law o f s i n e s
15 printf ( ’ 1 s t p o s s i b l e s o l u t i o n s e t \ nAngle a t B =%. 1 f
d e g r e e \ nAngle a t C=%. 1 f d e g r e e \ n l e n g t h o f s i d e c=
%. 0 f u n i t s \n ’ ,B ,C , c )
16
17 // c a s e 2
18 B =180 - asind ( sin_B ) // law o f s i n e s
19 C =180 -( A + B )
20 c = a * sind ( C ) / sind ( A ) // law o f s i n e s
21 printf ( ’ \n\ n2nd p o s s i b l e s o l u t i o n s e t \ nAngle a t B =%
. 1 f d e g r e e \ nAngle a t C=%. 1 f d e g r e e \ n l e n g t h o f
s i d e c=%. 1 f u n i t s \n ’ ,B ,C , c )
Scilab code Exa 2.3 To solve the triangle when 2 sides and opposite angle is given
1 // Example 2 . 3
57
Figure 2.3: To solve the triangle when 2 sides and angle between them is
given
Scilab code Exa 2.4 To solve the triangle when 2 sides and angle between them is g
1 // Example 2 . 4
58
Figure 2.4: To solve the triangle when 2 sides and angle between them is
given
59
Scilab code Exa 2.5 To solve the triangle when 2 sides and angle between them is g
1 // Example 2 . 5
2 //To s o l v e t h e t r i a n g l e when 2 s i d e s and a n g l e
b e t w e e n them i s g i v e n
3 clc , clear
4
5 c =5 // s i d e o p o s i t e t o v e r t e x C
6 A =30 // a n g l e a t v e r t e x A
7 b =4 // s i d e o p p o s i t e t o v e r t e x B
8
9 a = sqrt ( b ^2 + c ^2 -2* b * c * cosd ( A ) ) // from law o f
cosines
10 printf ( ’ Length o f a= %. 2 f u n i t s \n ’ ,a )
11 cos_B = ( c ^2+ a ^2 - b ^2) /(2* c * a ) // from law o f c o s i n e s
12 B = acosd ( cos_B )
13 printf ( ’ A n g l e B=%. 1 f d e g r e e s \n ’ ,B )
14 C =180 -( A + B )
15 printf ( ’ A n g l e C=%. 1 f d e g r e e s \n ’ ,C )
Scilab code Exa 2.6 To solve the triangle when 3 sides are given
1 // Example 2 . 6
2 //To s o l v e t h e t r i a n g l e when 3 s i d e s a r e g i v e n
3 clc , clear
4
5 c =4 // s i d e o p o s i t e t o v e r t e x C
6 a =2 // s i d e o p p o s i t e t o v e r t e x A
7 b =3 // s i d e o p p o s i t e t o v e r t e x B
8
60
Figure 2.5: To solve the triangle when 3 sides are given
Scilab code Exa 2.7 To determine solution of a triangle when 3 sides are given
1 // Example 2 . 7
2 //To d e t e r m i n e s o l u t i o n o f a t r i a n g l e when 3 s i d e s
61
Figure 2.6: To determine solution of a triangle when 3 sides are given
62
are given
3 clc , clear
4
5 c =6 // s i d e o p o s i t e t o v e r t e x C
6 a =2 // s i d e o p p o s i t e t o v e r t e x A
7 b =3 // s i d e o p p o s i t e t o v e r t e x B
8
9 cos_A = ( b ^2+ c ^2 - a ^2) /(2* c * b ) // from law o f c o s i n e s
10 printf ( ’ c o s (A)=%. 3 f a s c a l c u l a t e d \n ’ , cos_A )
11 printf ( ’ But m a g n i t u d e o f c o s (A) s h o u l d a l w a y s be
l e s s t h a n 1 . Hence NO SOLUTION e x i s t s \n\n ’ )
12
13 printf ( ’ Note : We o b s e r v e t h a t a+b < c . But sum o f
any 2 s i d e s s h o u l d a l w a y s e x c e e d t h i r d s i d e . ’ )
14 printf ( ’ \ nHence t h i s t r i a n g l e i s i m p o s s i b l e . ’ )
Scilab code Exa 2.8 To solve the triangle when 2 sides and opposite angle is given
1 // Example 2 . 8
2 //To s o l v e t h e t r i a n g l e when 2 s i d e s and o p p o s i t e
angle i s given
3 clc , clear
4
5 a =18 // s i d e o p o s i t e t o v e r t e x A
6 A =25 // a n g l e a t v e r t e x A
7 b =30 // s i d e o p p o s i t e t o v e r t e x B
8
9 // u s i n g law o f c o s i n e s s o l v i n g f o r c
10 c_polynomial =[1 -54.38 576]
11 root_c = roots ( c_polynomial )
12
13 // c a s e 1
14 c = root_c (1)
15 cos_B = ( c ^2+ a ^2 - b ^2) /(2* c * a ) // from law o f c o s i n e s
16 B = (180/ %pi ) * acos ( cos_B )
63
Figure 2.7: To solve the triangle when 2 sides and included angle is given
17 C =180 -( A + B )
18 printf ( ’ 1 s t p o s s i b l e a n s w e r s e t \ nAngle B=%. 1 f degree
\ nAngle C=%. 1 f d e g r e e \ n l e n g t h o f c=%. 0 f u n i t s \n\n
’ ,B ,C , c )
19
20 // c a s e 2
21 c = root_c (2)
22 cos_B = ( c ^2+ a ^2 - b ^2) /(2* c * a ) // from law o f c o s i n e s
23 B =(180/ %pi ) * acos ( cos_B )
24 C =180 -( A + B )
25 printf ( ’ 2 nd p o s s i b l e a n s w e r s e t ( which i s n o t s o l v e d
i n book ) \ nAngle B=%. 1 f d e g r e e \ nAngle C=%. 1 f
d e g r e e \ n l e n g t h o f c=%. 0 f u n i t s \n ’ ,B ,C , c )
64
Scilab code Exa 2.10 To solve the triangle when 2 sides and included angle is give
1 // Example 2 . 1 0
2 //To s o l v e t h e t r i a n g l e when 2 s i d e s and i n c l u d e d
angle i s given
3 clc , clear
4
5 a =5 // s i d e o p o s i t e t o v e r t e x a
6 b =3 // s i d e o p p o s i t e t o v e r t e x b
7 C =96 // a n g l e a t v e r t e x C
8
9 ApB =180 - C //A + B
10 // u s i n g law o f t a n g e n t s
11 AmB =2* atand ( tand ( ApB /2) *( a - b ) /( a + b ) ) //A−B
12
13 // s o l v i n g f o r A and B u s i n g AmB and ApB
14 A = ( AmB + ApB ) /2
15 B = ApB - A
16
17 c = a * sind ( C ) / sind ( A ) // law o f s i n e s
18 printf ( ’ A n g l e A= %. 1 f d e g r e e \ nAngle B=%. 1 f d e g r e e \
n l e n g t h o f c=%. 2 f u n i t s ’ ,A ,B , c )
Scilab code Exa 2.11 To check the solution of triangle using Mollweide equation
1 // Example 2 . 1 1
2 //To c h e c k t h e s o l u t i o n o f t r i a n g l e u s i n g M o l l w e i d e
equation
3 clc , clear
4
5 c =6.09 // s i d e o p o s i t e t o v e r t e x C
6 a =5 // s i d e o p p o s i t e t o v e r t e x A
7 b =3 // s i d e o p p o s i t e t o v e r t e x B
8
9 A =54.7 // a n g l e a t v e r t e x A
65
10 B =29.3 // a n g l e a t v e r t e x B
11 C =96 // a n g l e a t v e r t e x C
12
13 LHS = (a - b ) / c
14 RHS = sind (( A - B ) /2) / cosd ( C /2)
15 printf ( ’ LHS = ( a−b ) / c = %. 4 f \n ’ , LHS )
16 printf ( ’ RHS = s i n ( ( A−B) / 2 ) / c o s (C/ 2 ) = %. 4 f \n\n ’ ,
RHS )
17
18 printf ( ’ S m a l l d i f f e r e n c e i n LHS and RHS i s due t o
rounding o f f .\ ni . e . Mollweides equation i s holding
true .\ n ’)
19 printf ( ’THE SOLUTION OF TRIANGLE I S CORRECT ’ )
Scilab code Exa 2.12 To determine if a triangle can be formed with given dimension
1 // Example 2 . 1 2
2 //To d e t e r m i n e i f a t r i a n g l e can be f o r m e d w i t h
given dimension
3 clc , clear
4
5 c =9 // s i d e o p o s i t e t o v e r t e x C
6 a =6 // s i d e o p p o s i t e t o v e r t e x A
7 b =7 // s i d e o p p o s i t e t o v e r t e x B
8
9 A =55 // a n g l e a t v e r t e x A
10 B =60 // a n g l e a t v e r t e x B
11 C =65 // a n g l e a t v e r t e x C
12 printf ( ’ Sum o f a n g l e s =180\n ’ )
13 printf ( ’ S m a l l e s t and l a r g e s t s i d e s a r e o p p o s i t e t o
s m a l l e s t and l a r g e s t a n g l e r e s p e c t i v e l y \n\n ’ )
14
15 LHS = ( a + b ) / c
16 RHS = cosd (( A - B ) /2) / sind ( C /2)
17 printf ( ’ LHS = ( a+b ) / c = %. 2 f \n ’ , LHS )
66
Figure 2.8: To determine area of triangle when 2 sides and an angle is given
Scilab code Exa 2.13 To determine area of triangle when 2 sides and an angle is gi
1 // Example 2 . 1 3
2 //To d e t e r m i n e a r e a o f t r i a n g l e when 2 s i d e s and an
angle i s given
3 clc , clear
4
5 c =7 // s i d e o p o s i t e t o v e r t e x C
6 A =33 // a n g l e a t v e r t e x A
7 b =5 // s i d e o p p o s i t e t o v e r t e x B
67
Figure 2.9: To determine area of triangle when 3 angles and a side is given
8
9 area_K = b * c * sind ( A ) /2
10 printf ( ’ Area o f t r i a n g l e ABC = %. 2 f s q u a r e u n i t s ’ ,
area_K )
Scilab code Exa 2.14 To determine area of triangle when 3 angles and a side is giv
1 // Example 2 . 1 4
2 //To d e t e r m i n e a r e a o f t r i a n g l e when 3 a n g l e s and a
side i s given
3 clc , clear
4
5 A =115 // a n g l e a t v e r t e x A
6 a =12 // s i d e o p p o s i t e t o v e r t e x A
7 B =25 // a n g l e a t v e r t e x B
68
Figure 2.10: To determine area of triangle when 3 sides are given
8 C =40 // a n g l e a t v e r t e x C
9
10 area_K = a ^2* sind ( B ) * sind ( C ) /(2* sind ( A ) )
11 printf ( ’ Area o f t r i a n g l e ABC = %. 2 f s q u a r e units ’,
area_K )
Scilab code Exa 2.15 To determine area of triangle when 3 sides are given
1 // Example 2 . 1 5
2 //To d e t e r m i n e a r e a o f t r i a n g l e when 3 s i d e s a r e
given
3 clc , clear
4
5 c =7 // s i d e o p o s i t e to vertex C
69
6 a =5 // s i d e o p p o s i t e t o v e r t e x A
7 b =4 // s i d e o p p o s i t e t o v e r t e x B
8
9 s = ( a + b + c ) /2 // s e m i p e r i m e t e r
10 area_K = sqrt ( s *( s - a ) *( s - b ) *( s - c ) ) // u s i n g h e r o n s
formula
11 printf ( ’ Area o f t r i a n g l e ABC = %. 2 f s q u a r e u n i t s ’ ,
area_K )
Scilab code Exa 2.16 To determine area of triangle when 3 sides are given
1 // Example 2 . 1 6
2 //To d e t e r m i n e a r e a o f t r i a n g l e when 3 s i d e s a r e
given
3 clc , clear
4
5 c =0.0000029 // s i d e o p o s i t e t o v e r t e x C
6 a =1000000 // s i d e o p p o s i t e t o v e r t e x A
7 b =999999.9999979 // s i d e o p p o s i t e t o v e r t e x B
8
9 s = ( a + b + c ) /2 // s e m i p e r i m e t e r
10 area_K = sqrt ( s *( s - a ) *( s - b ) *( s - c ) ) // u s i n g h e r o n s
formula
11 printf ( ’ Area o f t r i a n g l e ABC = %. 3 f s q u a r e u n i t s \n\n
’ , area_K )
12
13 printf ( ’ Note : \ n ’ )
14 printf ( ’ I n c a l c u l a t o r s l i k e TI −83 p l u s , due t o
r o u n d i n g o f f e t c s w i l l be 1 0 0 0 0 0 0 \ n ’ )
15 printf ( ’ T h e r e f o r e ( s−a ) i s z e r o . And a r e a w i l l be
z e r o a c c o r d i n g t o h e r o n s f o r m u l a \n ’ )
16 printf ( ’ Due t o l a r g e number o f d i g i t s i n s c i l a b , ( s−a
) i s n o t z e r o . Thus , a r e a i s non−z e r o a b o v e . ’ )
70
Figure 2.11: To find radius of circumscribed circle for triangle ABC
Scilab code Exa 2.17 To find radius of circumscribed circle for triangle ABC
1 // Example 2 . 1 7
2 //To f i n d r a d i u s o f c i r c u m s c r i b e d c i r c l e f o r
t r i a n g l e ABC
3 clc , clear
71
Figure 2.12: To find the radius of circumscribed circle for triangle ABC
4
5 c =5 // s i d e o p o s i t e t o v e r t e x C
6 a =3 // s i d e o p p o s i t e t o v e r t e x A
7 b =4 // s i d e o p p o s i t e t o v e r t e x B
8
9 cos_A = ( c ^2+ b ^2 - a ^2) /(2* c * b ) // from law o f c o s i n e s
10 A = acosd ( cos_A )
11 diameter =( a / sind ( A ) )
12 radius = diameter /2
13 printf ( ’ R a d i u s o f c i r c u m s c r i b e d c i r c l e = %. 1 f u n i t s
\n ’ , radius )
14 printf ( ’ \ nNote : \ n D i a m e t e r i s same a s AB i . e . c . . .
So c e n t r e o f c i r c l e i s m i p o i n t o f AB ’ )
Scilab code Exa 2.18 To find the radius of circumscribed circle for triangle ABC
1 // Example 2 . 1 8
2 //To f i n d t h e r a d i u s o f c i r c u m s c r i b e d c i r c l e f o r
t r i a n g l e ABC
3 clc , clear
72
4
5 c =4 // s i d e o p o s i t e t o v e r t e x C
6 a =2 // s i d e o p p o s i t e t o v e r t e x A
7 b =3 // s i d e o p p o s i t e t o v e r t e x B
8
9 cos_A = ( c ^2+ b ^2 - a ^2) /(2* c * b ) // from law o f c o s i n e s
10 A = acosd ( cos_A )
11 diameter =( a / sind ( A ) )
12 radius = diameter /2
13 printf ( ’ R a d i u s o f c i r c u m s c r i b e d c i r c l e = %. 2 f u n i t s
\n\n ’ , radius )
14
15 //To draw t h e t r i a n g l e
16 printf ( ’NOTE: \nPROCEDURE TO DRAW THE TRIANGLE ABC\n ’
)
17 printf ( ’ Use a r u l e r t o draw t h e l o n g e s t s i d e AB o f
length c = 4.\n ’)
18 printf ( ’ Use a compass t o draw a r c s o f r a d i u s 3 and 2
c e n t e r e d a t A and B r e s p e c t i v e l y . \ n ’ )
19 printf ( ’ The i n t e r s e c t i o n o f t h e a r c s i s t h e v e r t e x C
. \ n\n ’ )
20
21 //To draw t h e c i r c u m s c r i b e d c i r c l e
22 printf ( ’PROCEDURE TO DRAW CIRCUMSCRIBED CIRCLE\n ’ )
23 printf ( ’ Draw t h e p e r p e n d i c u l a r b i s e c t o r s o f AB and
AC. \ n ’ )
24 printf ( ’ T h e i r i n t e r s e c t i o n i s t h e c e n t e r O o f t h e
c i r c l e .\n ’)
25 printf ( ’ Use a compass t o draw t h e c i r c l e c e n t e r e d a t
O which p a s s e s t h r o u g h A . ’ )
73
Figure 2.13: To determine radius of inscribed circle ABC
1 // Example 2 . 1 9
2 //To d e t e r m i n e r a d i u s o f i n s c r i b e d c i r c l e ABC
3 clc , clear
4
5 c =4 // s i d e o p o s i t e t o v e r t e x C
6 a =2 // s i d e o p p o s i t e t o v e r t e x A
7 b =3 // s i d e o p p o s i t e t o v e r t e x B
8
9 s = ( a + b + c ) /2 // s e m i p e r i m e t e r
10 radius_r = sqrt (( s - a ) *( s - b ) *( s - c ) / s )
11 printf ( ’ R a d i u s o f i n s c r i b e d c i r c l e i s %. 3 f u n i t s=
s q r t ( 5 / 1 2 ) u n i t s ’ , radius_r )
12 printf ( ’ \n\ nNote : To o b t a i n i n s c r i b e d c i r c l e : \ n ( 1 )
I n t e r s e c t p e r p e n d i c u l a r b i s e c t o r s o f A and B\n ’ )
13 printf ( ’ ( 2 ) P o i n t o f i n t e r s e c t i o n i s t h e c e n t r e o f
c i r c l e \n ’ )
14 printf ( ’ ( 3 ) The r a d i u s i s 0 . 6 4 5 a s c a c u l a t e d a b o v e \n ’
)
15 printf ( ’ ( 4 ) U s i n g a compass draw a c i r c l e w i t h t h i s
c e n t r e \n ’ )
74
Chapter 3
Identities
Scilab code Exa 3.8 To determine values of functions of sum of 2 angles when funct
1 clc , clear
2 // Example 3 . 8
3 //To d e t e r m i n e v a l u e s o f f u n c t i o n s o f sum o f 2
a n g l e s when f u n c t i o n s o f 2 a n g l e s a r e g i v e n
4
5 sin_A = 4/5 ;
6 cos_A = 3/5 ;
7
8 sin_B = 12/13 ;
9 cos_B = 5/13 ;
10
11 //Apb r e f e r s t o A p l u s B
12 sin_ApB = sin_A * cos_B + cos_A * sin_B ;
13 cos_ApB = cos_A * cos_B - sin_A * sin_B ;
14 tan_ApB = sin_ApB / cos_ApB ;
15
16 printf ( ’ s i n (A+B) = %f\n ’ , sin_ApB ) ;
17 printf ( ’ c o s (A+B) = %f\n ’ , cos_ApB ) ;
18 printf ( ’ t a n (A+B) = %f\n ’ , tan_ApB ) ;
75
Chapter 4
Radian Measure
1 clc , clear
2 // Example 4 . 1
3 //To c o n v e r t a d e g r e e m e a s u r e t o r a d i a n s
4
5 deg =18 // d e g r e e m e a s u r e
6 radian = deg *( %pi /180) // r a d i a n m e a s u r e
7 printf ( ’ Radian m e a s u r e i s %f r a d \n ( o r ) \n ’ , radian )
8 printf ( ’ Radian m e a s u r e i s ( p i /%. 0 f ) r a d ’ ,1/( radian /
%pi ) )
1 clc , clear
2 // Example 4 . 2
3 //To c o n v e r t a r a d i a n m e e a s u r e t o d e g r e e
4
5 radian = %pi /9 // r a d i a n m e a s u r e
6 deg = radian /( %pi /180) // d e g r e e m e a s u r e
7 printf ( ’ D e g r e e m e a s u r e i s %. 0 f d e g r e e ’ , deg )
76
Scilab code Exa 4.3 To determine length of the intercepted arc
1 clc , clear
2 // Example 4 . 3
3 //To d e t e r m i n e l e n g t h o f t h e i n t e r c e p t e d a r c
4
5 r =2 // r a d i u s o f c i r c l e
6 theta =1.2 // c e n t r a l a n g l e i n r a d i a n
7
8 s = r * theta // l e n g t h o f a r c
9 printf ( ’ Length o f a r c i n t e r c e p t e d = %. 1 f cm ’ ,s )
1 clc , clear
2 // Example 4 . 4
3 //To d e t e r m i n e l e n g t h o f t h e a r c i n t e r c e p t e d
4
5 r =10 // r a d i u s o f c i r c l e
6 theta =41*( %pi /180) // c e n t r a l a n g l e i n r a d i a n
7
8 s = r * theta // l e n g t h o f a r c
9 printf ( ’ Length o f a r c i n t e r c e p t e d = %. 2 f f t ’ ,s )
1 clc , clear
2 // Example 4 . 5
3 //To d e t e r m i n e a n g l e i n r a d i a n s and d e g r e e s
77
4
5 r =5 // r a d i u s o f c i r c l e
6 s =2 // l e n g t h o f a r c
7 theta = s / r // c e n t r a l a n g l e i n r a d i a n
8 printf ( ’ Measure o f c e n t r a l a n g l e = %. 2 f r a d \n ’ , theta
)
9 printf ( ’ Measure o f c e n t r a l a n g l e = %. 2 f d e g r e e ’ ,
theta *(180/ %pi ) )
1 clc , clear
2 // Example 4 . 6
3 //To d e t e r m i n e t h e l e n g t h o f t h e r o p e
4
5 d =8 // d i s t a n c e b e t w e e n p l a c e s i n f e e t
6 r =2 // r a d i u s o f c y l i n d e r i n f e e t
7 // from t h e f i g u r e
8 DA = d /2 , BE = r
9 DE =3 // d i s t a n c e from c e n t r e o f c o n t a i n e r t o w a l l
10
11 AE = sqrt ( DE ^2 + DA ^2) // p y t h a g o r a s t h e o r e m
12 AB = sqrt ( AE ^2 - BE ^2) // p y t h a g o r a s t h e o r e m
13
14 // a l l a n g l e s b e l o w a r e i n r a d i a n s
15 angle_AED = atan (( d /2) / DE )
16 angle_AEB = acos ( BE / AE )
17 angle_BEC = %pi - ( angle_AED + angle_AEB )
18 arc_BC = BE * angle_BEC // l e n g t h o f a r c BC
19 L = 2*( AB + arc_BC ) // l e n g t h o f r o p e
20 printf ( ’ Length o f t h e r o p e = %. 1 f f t ’ ,L )
78
Figure 4.1: To determine the length of the rope
79
Figure 4.2: To determine the length of the belt around the pulleys
Scilab code Exa 4.7 To determine the length of the belt around the pulleys
1 clc , clear
2 // Example 4 . 7
3 //To d e t e r m i n e t h e l e n g t h o f the b e l t around the
pulleys
4
5 AE = 5 // r a d i u s o f f i r s t p u l l e y i n cm
6 BF = 8 // r a d i u s o f s e c o n d p u l l e y i n cm
7 AB =15 // d i s t a n c e b e t w e e n c e n t r e o f p u l l e y s i n cm
8
9 // from t h e f i g u r e
10 CF = AE // p a r a l l e l s i d e o f r e c t a n g l e ACFE
11 BC = BF - CF
12 AC = sqrt ( AB ^2 - BC ^2) // by p y t h a g o r a s t h e o r e m
13 EF = AC // p a r a l l e l s i d e o f r e c t a n g l e ACFE
80
14
15 angle_EAC = %pi /2
16 angle_BAC = asin ( BC / AB )
17 angle_DAE = %pi - angle_EAC - angle_BAC
18 angle_ABC = angle_DAE //AE and BF a r e p a r a l l e l
19 angle_GBF = %pi - angle_ABC
20
21 arc_DE = AE * angle_ABC // l e n g t h o f a r c DE
22 arc_FG = BF * angle_GBF // l e n g t h o f a r c FG
23 L =2*( arc_DE + EF + arc_FG ) // l e n g t h o f b e l t
24 printf ( ’ Length o f b e l t a r o u n d p u l l e y = %f cm ’ ,L )
1 clc , clear
2 // Example 4 . 8
3 //To f i n d t h e a r e a o f s e c t o r o f c i r c l e
4
5 theta = %pi /5 // a n g l e i n r a d i a n
6 r =4 // r a d i u s i n cm
7 A = r * r * theta /2 // Area o f s e c t o r
8 printf ( ’ Area o f s e c t o r = %. 1 f ∗ p i cmˆ2\ n ( o r ) \n ’ ,A / %pi
)
9 printf ( ’ Area o f s e c t o r = %f cmˆ2 ’ ,A )
1 clc , clear
2 // Example 4 . 9
3 //To d e t e r m i n e a r e a o f s e c t o r o f a c i r c l e
4
5 theta = 117*( %pi /180) // a n g l e i n r a d i a n
6 r =3.5 // r a d i u s i n m
81
Figure 4.3: To determine area insude belt pulley system
7 A = r * r * theta /2 // Area o f s e c t o r
8 printf ( ’ Area o f s e c t o r = %. 2 f mˆ2 ’ ,A )
1 clc , clear
2 // Example 4 . 1 0
3 //To d e t e r m i n e a r e a o f s e c t o r o f c i r c l e
4
5 s =6 // a r c l e n g t h i n cm
6 r =9 // r a d i u s i n cm
7 A = r * s /2 // Area o f s e c t o r
8 printf ( ’ Area o f s e c t o r = %. 0 f cmˆ2\ n\n ’ ,A )
9 printf ( ’ Note : A n g l e s u b t e n d e d by a r c = %f r a d ’ ,s / r )
82
Scilab code Exa 4.11 To determine area insude belt pulley system
1 clc , clear
2 // Example 4 . 1 1
3 //To d e t e r m i n e a r e a i n s u d e b e l t p u l l e y s y s t e m
4
5 AE = 5 // r a d i u s o f f i r s t p u l l e y
6 BF = 8 // r a d i u s o f s e c o n d p u l l e y
7 AB =15 // d i s t a n c e b e t w e e n c e n t r e o f p u l l e y s
8
9 // from t h e f i g u r e
10 CF = AE
11 BC = BF - CF
12 AC = sqrt ( AB ^2 - BC ^2)
13 // from t h e f i g u r e
14 angle_EAC = %pi /2
15 angle_BAC = asin ( BC / AB )
16 angle_DAE = %pi - angle_EAC - angle_BAC
17 angle_ABC = angle_DAE //AE and BF a r e p a r a l l e l
18 angle_GBF = %pi - angle_ABC
19
20 area_DAE = AE ^2* angle_DAE /2 // a r e a o f s e c t o r DAE
21 area_GBF = BF ^2* angle_GBF /2 // a r e a o f s e c t o r GBF
22 area_AEFC = AE * AC // a r e a o f r e c t a n g l e AEFC
23 area_ABC = AC * BC /2 // a r e a o f t r i a n g l e ABC
24
25 area_K =2*( area_DAE + area_AEFC + area_ABC + +
area_GBF )
26 printf ( ’ Area e n c l o s e d by b e l t p u l l e y s y s t e m = %. 2 f
cmˆ2 ’ , area_K )
27 printf ( ’ \n\ nNote : a n s w e r d i f f e r s from book due t o
a p p r o x i m a t i o n s by them ’ )
83
Figure 4.4: To determine area of segment formed by a chord in circle
84
Figure 4.5: To determine area of intersection of 2 circles
Scilab code Exa 4.12 To determine area of segment formed by a chord in circle
1 clc , clear
2 // Example 4 . 1 2
3 //To d e t e r m i n e a r e a o f s e g m e n t f o r m e d by a c h o r d i n
circle
4
5 radius = 2
6 chord = 3
7 // Use law o f c o s i n e s
8 cos_theta = ( radius ^2+ radius ^2 - chord ^2) /(2* radius *
radius )
9 theta = acos ( cos_theta ) // s u b t e n d e d c e n t r a l a n g l e i n
radians
10
11 area_K = radius ^2* ( theta - sin ( theta ) ) /2
12 printf ( ’ R e q u i r e d a r e a o f s e g m e n t = %. 3 f s q u a r e u n i t s
’ , area_K )
85
1 clc , clear
2 // Example 4 . 1 3
3 //To d e t e r m i n e a r e a o f i n t e r s e c t i o n o f 2 c i r c l e s
4
5 d =7 // d i s t a n c e b e t w e e n c e n t r e s i n cm
6 r1 = 5 // r a d i u s o f f i r s t c i r c l e i n cm
7 r2 = 4 // r a d i u s o f s e c o n d c i r c l e i n cm
8
9 // u s e law o f c o s i n e s
10 cos_alpha =( d ^2+ r1 ^2 - r2 ^2 ) /(2* d * r1 )
11 cos_beeta =( d ^2+ r2 ^2 - r1 ^2 ) /(2* d * r2 )
12
13 // from t h e g e o m e t r y o f t h e f i g u r e
14 // a l l t h e a n g l e s b e l o w a r e i n r a d i a n s
15 alpha = acos ( cos_alpha )
16 beeta = acos ( cos_beeta )
17 angle_BAC = alpha
18 angle_ABC = beeta
19 angle_CAD =2* angle_BAC
20 angle_CBD =2* angle_ABC
21
22 // r e q u i r e d a r e a = a r e a a t s e g m e n t CD i n c i r c l e a t A
and a t B
23 area_K = r1 ^2*( angle_CAD - sin ( angle_CAD ) ) /2 + r2
^2*( angle_CBD - sin ( angle_CBD ) ) /2
24 printf ( ’ Area o f i n t e r s e c t i o n o f 2 c i r c l e s = %. 2 f cm
ˆ2 ’ , area_K )
Scilab code Exa 4.14 To find linear and angular speed of a moving object
1 clc , clear
2 // Example 4 . 1 4
3 //To f i n d l i n e a r and a n g u l a r s p e e d o f a moving
object
4
86
5 t =0.5 // t i m e i n s e c o n d
6 r = 3 // r a d i u s i n m o f t h e c i r c l e
7 theta = %pi /3 // c e n t r a l a n g l e i n r a d i a n
8 w = theta / t // a n g u l a r s p e e d i n r a d / s e c
9 v = w * r // l i n e a r s p e e d i n m/ s e c
10
11 printf ( ’ A n g u l a r s p e e d= %f r a d i a n / s e c \n ’ ,w )
12 printf ( ’ L i n e a r s p e e d = %f m/ s e c ’ ,v )
13
14 printf ( ’ \n\n ( o r ) \n\ n A n g u l a r s p e e d= %f∗ p i r a d i a n / s e c \
n ’ ,w / %pi )
15 printf ( ’ L i n e a r s p e e d = %f∗ p i m/ s e c ’ ,v / %pi )
Scilab code Exa 4.15 To find linear and angular speed of a moving object
1 clc , clear
2 // Example 4 . 1 5
3 //To f i n d l i n e a r and a n g u l a r s p e e d o f a moving
object
4
5 t =2.7 // t i m e i n s e c o n d
6 r = 2 // r a d i u s i n f t o f t h e c i r c l e
7 s =35 // d i s t a n c e i n f e e t
8
9 v = s / t // l i n e a r s p e e d i n f t / s e c
10 w = v / r // a n g u l a r s p e e d i n r a d / s e c
11
12 printf ( ’ L i n e a r s p e e d = %. 2 f f t / s e c \n ’ ,v )
13 printf ( ’ A n g u l a r s p e e d= %. 2 f r a d i a n / s e c \n ’ ,w )
Scilab code Exa 4.16 To find the central angle swept by a moving object
1 clc , clear
87
Figure 4.6: To find the angular speed of larger gear interlocked with smaller
gear
2 // Example 4 . 1 6
3 //To f i n d t h e c e n t r a l a n g l e s w e p t by a moving o b j e c t
4
5 t =3.1 // t i m e i n s e c o n d
6 v = 10 // l i n e a r s p e e d i n m/ s e c
7 r = 4 // r a d i u s i n m o f t h e c i r c l e
8 s = v * t // d i s t a n c e i n m
9
10 theta = s / r // c e n t r a l a n g l e s w e p t
11 printf ( ’ c e n t r a l a n g l e s w e p t = %. 2 f r a d i a n ’ , theta )
88
Scilab code Exa 4.17 To find the angular speed of larger gear interlocked with sma
1 clc , clear
2 // Example 4 . 1 7
3 //To f i n d t h e a n g u l a r s p e e d o f l a r g e r gear
i n t e r l o c k e d with s m a l l e r gear
4
5 r1 =5 // r a d i u s o f l a r g e r g e a r
6 r2 =4 // r a d i u s s m a l l e r g e a r
7 w2 =25 // a n g u l a r s p e e d o f s m a l l e r g e a r
8
9 // I m a g i n e a p a r t i c l e on o u t e r r a d i i o f e a c h g e a r
10 // At any time , f o r e v e r y r o t a t i o n , c i r c u l a r
displacement o f each p a r t i c l e i s same
11 // ( o r ) s 1=s 2 i m p l i e s v1 ∗ t=v2 ∗ t
12 // v1= v2 i m p l i e s w1∗ r 1=w2∗ r 2
13
14 w1 =( w2 * r2 ) / r1 // a n g u l a r s p e e d o f l a r g e r g e a r
15 printf ( ’ A n g u l a r s p e e d o f l a r g e r g e a r= %. 0 f rpm ’ , w1 )
89
Chapter 5
Scilab code Exa 5.1 To sketch the graph of minus sinx in a given interval
1 // Example 5 . 1
2 //To s k e t c h t h e g r a p h o f minus s i n x i n a g i v e n
interval
3 clear , clc ;
4
5 x = linspace ( -0 ,2* %pi ,50) ;
6 y = - sin ( x ) ;
7 set ( gca () ,” g r i d ” ,[5 5]) ;
8 plot (x , y ) ;
9 xlabel ( ” $0 \ l e x \ l e 2∗ p i $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ”
);
10 ylabel ( ” $y ( x )=−s i n ( x ) $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ” ) ;
11 title ( ” Example 5 . 1 ” ,” c o l o r ” ,” b l u e ” ,” f o n t s i z e ” ,9) ;
90
Figure 5.1: To sketch the graph of minus sinx in a given interval
91
Figure 5.3: To sketch the graph of given function of in given interval
Scilab code Exa 5.2 To sketch the graph of given function of in given interval
1 // Example 5 . 2
2 //To s k e t c h t h e g r a p h o f f u n c t i o n o f 1+ c o s ( x ) i n
given i n t e r v a l
3 clear , clc ;
4
5 x = linspace ( -0 ,2* %pi ,50) ;
6 y = 1+ cos ( x ) ;
7 set ( gca () ,” g r i d ” ,[5 5]) ;
8 plot (x , y ) ;
9 xlabel ( ” $0 \ l e x \ l e 2∗ p i $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ”
);
10 ylabel ( ” $y ( x )=1+c o s ( x ) $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ” )
;
11 title ( ” Example 5 . 2 ” ,” c o l o r ” ,” b l u e ” ,” f o n t s i z e ” ,9) ;
92
Figure 5.4: To sketch the graph of given function of in given interval
Scilab code Exa 5.4 To determine the period of given sinusoidal function
1 // Example 5 . 4
93
2 //To d e t e r m i n e t h e p e r i o d o f g i v e n s i n u s o i d a l
function
3 clear , clc ;
4
5 multiple = 2; // m u l t i p l i c i t y o f a n g l e
6 period_sinx = 2* %pi ; // p e r i o d o f s i n ( x ) i n r a d i a n s
7 required_period = period_sinx / multiple ;
8 printf ( ’ R e q u i r e d p e r i o d i s %f r a d i a n s ’ ,
required_period ) ;
9
10 // Note t h a t s i n 2 x goes twice as f a s t as s i n x
.
11 // While s i n x t a k e s a f u l l 2∗ p i r a d i a n s t o go
t h r o u g h an e n t i r e c y c l e
12 // s i n 2 x g o e s t h r o u g h an e n t i r e c y c l e i n j u s t p i
radians
13
14 x = linspace ( -0 ,2* %pi ,100) ;
15 y = sin (2* x ) ;
16 z = sin ( x ) ;
17 set ( gca () ,” g r i d ” ,[4 4]) ;
18 plot (x ,y , ’ r− ’ ) ;
19 plot (x ,z , ’ b− ’ ) ;
20 xlabel ( ” $0 \ l e x \ l e 2∗ p i $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ”
);
21 ylabel ( ” $y ( x )=s i n ( 2 x ) $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ” ) ;
22 title ( ” Example 5 . 4 ” ,” c o l o r ” ,” b l u e ” ,” f o n t s i z e ” ,9) ;
23 legend ([ ” s i n ( 2 x ) ” ; ” s i n ( x ) ” ]) ;
Scilab code Exa 5.5 To determine the period of 2 given cosine functions
94
Figure 5.6: To determine the period of given sinusoidal function
95
1 // Example 5 . 5
2 //To d e t e r m i n e t h e p e r i o d o f 2 g i v e n c o s i n e
functions
3 clear , clc ;
4
5 // y=c o s ( 3 ∗ x )
6 multiple = 3; // m u l t i p l i c i t y o f a n g l e
7 period_cosx = 2* %pi ; // p e r i o d o f s i n ( x ) i n r a d i a n s
8 required_period = period_cosx / multiple ;
9 printf ( ’ P e r i o d o f c o s ( 3 ∗ x ) i s %f r a d i a n s \n ’ ,
required_period ) ;
10
11 // y=c o s ( 0 . 5 ∗ x )
12 multiple = 1/2; // m u l t i p l i c i t y o f a n g l e
13 period_cosx = 2* %pi ; // p e r i o d o f s i n ( x ) i n r a d i a n s
14 required_period = period_cosx / multiple ;
15 printf ( ’ P e r i o d o f c o s ( x / 2 ) i s %f r a d i a n s ’ ,
required_period ) ;
16
17 x = linspace ( -0 ,4* %pi ,200) ;
18 y = cos (3* x ) ;
19 z = cos ( x /2) ;
20 set ( gca () ,” g r i d ” ,[4 4]) ;
21 plot (x ,y , ’ r− ’ ) ;
22 plot (x ,z , ’ b− ’ ) ;
23 xlabel ( ” $0 \ l e x \ l e 4∗ p i $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ”
);
24 title ( ” Example 5 . 5 ” ,” c o l o r ” ,” b l u e ” ,” f o n t s i z e ” ,9) ;
25 legend ([ ” y = c o s ( 3 x ) ” ; ” y = c o s ( x / 2 ) ” ]) ;
Scilab code Exa 5.6 To determine the amplitude and period of given function
96
Figure 5.8: To determine the period of 2 given cosine functions
97
1 // Example 5 . 6
2 //To d e t e r m i n e t h e a m p l i t u d e and p e r i o d o f g i v e n
function
3 clear , clc ;
4
5 x = linspace ( -0 ,4* %pi ,200) ;
6 y = 3* cos (2* x ) ; // g i v e n f u n c t i o n
7 amplitude = y / cos (2* x ) ;
8 printf ( ’ A m p l i t u d e = %f ’ , amplitude ) ;
9
10 multiple = 2; // m u l t i p l i c i t y o f a n g l e
11 period_cosx =2* %pi ; // p e r i o d od c o s ( x )
12 period_required = period_cosx / multiple ;
13 printf ( ’ \ n P e r i o d = %f r a d i a n s ’ , period_required ) ;
14
15 x = linspace ( -0 ,2* %pi ,50) ;
16 y = 3* cos (2* x ) ;
17 set ( gca () ,” g r i d ” ,[5 5]) ;
18 plot (x , y ) ;
19 xlabel ( ” $0 \ l e x \ l e 2∗ p i $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ”
);
20 ylabel ( ” $y ( x ) =3∗ c o s ( 2 ∗ x ) $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d
”);
21 title ( ” Example 5 . 6 ” ,” c o l o r ” ,” b l u e ” ,” f o n t s i z e ” ,9) ;
Scilab code Exa 5.7 To find amplitude and period of given composite function
1 // Example 5 . 7
2 //To f i n d a m p l i t u d e and p e r i o d o f g i v e n c o m p o s i t e
function
3 clear , clc ;
98
Figure 5.10: To determine the amplitude and period of given function
99
4
5 x = linspace (0 ,3 ,200) ;
6 y1 =2 ; // 1 s t p a r t o f g i v e n f u n c t i o n
7 amplitude1 = y1 ; // a m p l i t u d e n u m e r i c a l l y same f o r
constant function
8 y2 = -3* sin ((2* %pi /3) * x ) ; // s e c o n d p a r t o f g i v e n
function
9 amplitude2 = abs ( y2 / sin ((2* %pi /3) * x ) ) ; // a m p l i t u d e
of part 2
10 // Note : a d d i n g 2 d o e s n t c h a n g e a m p i t u d e
11 // I t j u s t c a u s e s t h e upward s h i f t o f g r a p h
12 maax = amplitude1 + amplitude2 ; // a l t e r e d maximum due
to adding of 2
13 minn = amplitude1 - amplitude2 ; // a l t e r e d minimum due
to adding of 2
14 amplitude = ( maax - minn ) /2; // r e q u i r e d a m p l i t u d e
15 printf ( ’ A m p l i t u d e = %f ’ , amplitude ) ;
16
17 multiple =2* %pi /3 ; // m u l t i p l i c i t y o f a n g l e
18 period_sinx =2* %pi ; // p e r i o d o f s i n x
19 period_required = period_sinx / multiple ;
20 printf ( ’ \ n R e q u i r e d p e r i o d i s %f r a d i a n s ’ ,
period_required ) ;
21
22 x = linspace (0 ,3 ,200) ;
23 y = 2 -3* sin ((2* %pi /3) * x )
24 set ( gca () ,” g r i d ” ,[5 5]) ;
25 plot (x , y ) ;
26 xlabel ( ” $0 \ l e x \ l e 3 $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ” ) ;
27 ylabel ( ” $y ( x )= 2 −3∗ s i n ( ( 2 ∗ %pi / 3 ) ∗ x ) $ ” ,” f o n t s i z e ” ,4 ,
” c o l o r ” ,” r e d ” ) ;
28 title ( ” Example 5 . 7 ” ,” c o l o r ” ,” b l u e ” ,” f o n t s i z e ” ,9) ;
100
Figure 5.12: To find amplitude and period of given composite function
101
Scilab code Exa 5.8 To find the amplitude and period of given function
1 // Example 5 . 8
2 //To f i n d t h e a m p l i t u d e and p e r i o d o f g i v e n f u n c t i o n
3 clear , clc ;
4
5 // P e r i o d
6 printf ( ’PERIOD : \ n ’ )
7 printf ( ’ T h i s i s n t a p e r i o d i c f u n c t i o n a s x ˆ2 i s
l i n e a r l y r e l a t e d t o x \n ’ )
8 printf ( ’ and h e n c e p e r i o d d o e s n t e x i s t \n ’ )
9
10 // A m p l i t u d e
11 x = linspace (0 ,2* %pi ,200) ;
12 y = 2* sin ( x ^2) ;
13 amplitude = y / sin ( x ^2) ;
14 printf ( ’AMPLITUDE: \ n ’ )
15 printf ( ’ A m p l i t u d e e x i s t s u n l i k e p e r i o d \n ’ )
16 printf ( ’ B e c a u s e s i n e component o f t h e g i v e n function
n e v e r e x c e e d s 1\ n ’ )
17 printf ( ’ F u n c t i o n v a l u e i s a l w a y s ; e s s t h a n c o n s t a n t
f a c t o r a d j a c e n t t o s i n e \n ’ )
18 printf ( ’ Hence a m p l i t u d e i s t h e c o n s t a n t f a c t o r
m u l t i p l i e d w i t h s i n e component \n\n ’ )
19 printf ( ’ A m p l i t u d e = %f a s c a l c u l a t e d \n ’ , amplitude )
20
21
22 x = linspace (0 ,2* %pi ,200) ;
23 y = 2* sin ( x ^2) ;
24 set ( gca () ,” g r i d ” ,[5 5]) ;
25 plot (x ,y , ’ b ’ ) ;
26 xlabel ( ” $0 \ l e x \ l e 2∗ p i $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ”
);
27 ylabel ( ” $y ( x )= 2∗ s i n ( x ˆ 2 ) $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,”
102
Figure 5.14: To find the amplitude and period of given function
red ”);
28 title ( ” Example 5 . 8 ” ,” c o l o r ” ,” r e d ” ,” f o n t s i z e ” ,9) ;
Scilab code Exa 5.9 To find the amplitude and period of given function
1 // Example 5 . 9
2 //To f i n d t h e a m p l i t u d e and p e r i o d o f g i v e n f u n c t i o n
3 clear , clc ;
4
5 // a m p l i t u d e
6 x = linspace ( -0 ,4* %pi ,200) ;
7 y1 =3* sin ( x ) ; // 1 s t p a r t o f g i v e n f u n c t i o n
8 amplitude1 = y1 / sin ( x ) ; // a m p l i t u d e o f p a r t 1
103
Figure 5.15: To find the amplitude and period of given function
9 y2 = 4* cos ( x ) ; // s e c o n d p a r t o f g i v e n f u n c t i o n
10 amplitude2 = y2 /( cos ( x ) ) ; // a m p l i t u d e o f p a r t 2
11
12 // g i v e n f u n c t i o n i s a c o m p o s i t i o n o f 2 f u n c t i o n s
13 // U s i n g t r i g o n o m e t r i c i d e n t i t i e s , merge them i n t o 1
14 // t h e a m p l i t u d e o f r e s u l t a n t i s t h e r e q u i r e d
amplitude
15 // I n t h i s c a s e t h e merged f u n c t i o n can be s i n e o r
cos
16 // m e r g i n g s i n e and c o s i n t o s i n e ,
17 amplitude = sqrt ( amplitude1 ^2 + amplitude2 ^2) ;
18 printf ( ’ A m p l i t u d e = %f ’ , amplitude ) ;
19
20 // p e r i o d
21 period_cosx =2* %pi ; // p e r i o d o f c o s ( x ) i s 2 p i
22 period_sinx =2* %pi ; // p e r i o d o f s i n ( x ) i s 2 p i
23 locm = 2* %pi ; // lcm o f p e r i o d s i n x and p e r i o d c o s x
24 printf ( ’ \ n R e q u i r e d p e r i o d i s %f r a d i a n s ’ , locm ) ;
104
Figure 5.16: To find the amplitude and period of given function
1 // Example 5 . 1 0
105
Figure 5.17: To find the period of given function
2 //To f i n d t h e p e r i o d o f g i v e n f u n c t i o n
3 clear , clc ;
4
5 x = linspace ( -0 ,2* %pi ,200) ;
6 y1 = cos (6* x ) ; // 1 s t p a r t o f g i v e n f u n c t i o n
7 multiple1 =6; // m u l t i p l i c i t y o f a n g l e
8 period_cosx =2* %pi ; // p e r i o d o f c o s ( x ) i s 2 p i
9 period1 = period_cosx / multiple1 ;
10 printf ( ’ Note : P e r i o d o f c o s (%d∗ x )= %f r a d i a n s \n ’ ,
multiple1 , period1 ) ;
11 y2 = sin (4* x ) ; // s e c o n d p a r t o f g i v e n f u n c t i o n
12 multiple2 =4; // m u l t i p l i c i t y o f a n g l e
13 period_sinx =2* %pi ; // p e r i o d o f s i n ( x ) i s 2 p i
14 period2 = period_sinx / multiple2 ;
15 printf ( ’ P e r i o d o f s i n (%d∗ x )= %f r a d i a n s \n ’ , multiple2
, period2 ) ;
16
17 locm = %pi ; //LCM o f p e r i o d 1 and p e r i o d 2
106
Figure 5.18: To find the period of given function
18 period = locm ; // f i n a l p e r i o d
19 printf ( ’ \ n R e q u i r e d p e r i o d i s %f r a d i a n s ’ , period ) ;
20 x = linspace (0 ,2* %pi ,200) ;
21 y = cos (6* x ) + sin (4* x ) ; // g i v e n f u n c t i o n
22 set ( gca () ,” g r i d ” ,[5 5]) ;
23 plot (x ,y , ’ r ’ ) ;
24 xlabel ( ” $0 \ l e x \ l e 2∗ p i $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ”
);
25 ylabel ( ” $y ( x )= s i n ( 4 ∗ x ) +c o s ( 6 ∗ x ) $ ” ,” f o n t s i z e ” ,4 , ”
c o l o r ” ,” r e d ” ) ;
26 title ( ” Example 5 . 1 0 ” ,” c o l o r ” ,” r e d ” ,” f o n t s i z e ” ,9) ;
Scilab code Exa 5.11 To find the amplitude phase shift and period of given functio
107
Figure 5.19: To find the amplitude phase shift and period of given function
1 // Example 5 . 1 1
2 //To f i n d t h e a m p l i t u d e p h a s e s h i f t and p e r i o d o f
given function
3 clear , clc ;
4
5 x = linspace ( -0 ,2* %pi ,200) ;
6 deviation = %pi ; // d e v i a t i o n from m u l t i p l e s o f x
7 y = 3* cos (2* x - deviation ) ; // g i v e n f u n c t i o n
8 amplitude = y / cos (2* x - %pi ) ;
9 printf ( ’ A m p l i t u d e = %f\n ’ , amplitude ) ;
10 multiple = 2; // m u l t i p l i c i t y o f a n g l e
11 period_cosx = 2* %pi ; // p e r i o d o f s i n ( x ) i n r a d i a n s
12 required_period = period_cosx / multiple ;
13 printf ( ’ R e q u i r e d p e r i o d = %f r a d i a n s \n ’ ,
required_period ) ;
14 phase_shift = deviation / multiple ;
15 printf ( ’ Phase s h i f t = %f r a d i a n s ’ , phase_shift ) ;
16
17 x = linspace ( -0 ,2* %pi ,200) ;
18 y = 3* cos (2* x - %pi ) ;
19 set ( gca () ,” g r i d ” ,[5 5]) ;
20 plot (x , y ) ;
21 xlabel ( ” $0 \ l e x \ l e 2∗ p i $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ”
);
108
Figure 5.20: To find the amplitude phase shift and period of given function
22 ylabel ( ” $y ( x ) =3∗ c o s ( 2 ∗ x− p i ) $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,
” red ”);
23 title ( ” Example 5 . 1 1 ” ,” c o l o r ” ,” b l u e ” ,” f o n t s i z e ” ,9) ;
Scilab code Exa 5.12 To find the amplitude phase shift and period of given functio
1 // Example 5 . 1 2
2 //To f i n d t h e a m p l i t u d e p h a s e s h i f t and p e r i o d o f
given function
3 clear , clc ;
4
5 x = linspace ( - %pi /6 ,4* %pi /3 ,200) ;
6 deviation = - %pi /2; // d e v i a t i o n from m u l t i p l e s of x
109
Figure 5.21: To find the amplitude phase shift and period of given function
Scilab code Exa 5.13 To determine inverse sine function of a given value
110
Figure 5.22: To find the amplitude phase shift and period of given function
1 clc , clear ;
2 // Example 5 . 1 3
3 //To d e t e r m i n e inverse sine function of a given
value
4
5 given = sin ( %pi /4) ; // g i v e n v a l u e
6 answer = asin ( given ) ; // f i n a l a n s w e r
7
8 printf ( ’ R e q u i r e d a n s w e r i s %f r a d i a n s ’ , answer ) ;
9 printf ( ’ \n\nOR \n\n ( p i / 4 ) ∗%f r a d i a n s ’ , answer *(4/ %pi )
);
Scilab code Exa 5.14 To determine inverse sine function of a given value
1 clc , clear ;
2 // Example 5 . 1 4
111
3 //To d e t e r m i n e i n v e r s e s i n e f u n c t i o n o f a g i v e n
value
4
5 given = sin (5* %pi /4) ; // g i v e n v a l u e
6 answer = asin ( given ) ; // f i n a l a n s w e r
7
8 printf ( ’ R e q u i r e d a n s w e r i s %f r a d i a n s ’ , answer ) ;
9 printf ( ’ \n\nOR \n\n ( p i / 4 ) ∗%f r a d i a n s ’ , answer *(4/ %pi )
);
Scilab code Exa 5.15 To determine inverse cosine function of a given value
1 clc , clear ;
2 // Example 5 . 1 5
3 //To d e t e r m i n e inverse cosine function of a given
value
4
5 given = cos ( %pi /3) ; // g i v e n v a l u e
6 answer = acos ( given ) ; // f i n a l a n s w e r
7
8 printf ( ’ R e q u i r e d a n s w e r i s %f r a d i a n s ’ , answer ) ;
9 printf ( ’ \n\nOR \n\n ( p i / 3 ) ∗%f r a d i a n s ’ , answer *(3/ %pi )
);
Scilab code Exa 5.16 To determine inverse cosine function of a given value
1 clc , clear ;
2 // Example 5 . 1 6
3 //To d e t e r m i n e inverse cosine function of a given
value
4
5 given = cos (4* %pi /3) ; // g i v e n v a l u e
6 answer = acos ( given ) ; // f i n a l a n s w e r
112
7
8 printf ( ’ R e q u i r e d a n s w e r i s %f r a d i a n s ’ , answer ) ;
9 printf ( ’ \n\nOR \n\n ( p i / 3 ) ∗%f r a d i a n s ’ , answer *(3/ %pi )
);
Scilab code Exa 5.17 To determine inverse tan function of a given value
1 clc , clear ;
2 // Example 5 . 1 7
3 //To d e t e r m i n e i n v e r s e t a n f u n c t i o n o f a g i v e n v a l u e
4
5 given = tan ( %pi /4) ; // g i v e n v a l u e
6 answer = atan ( given ) ; // f i n a l a n s w e r
7
8 printf ( ’ R e q u i r e d a n s w e r i s %f r a d i a n s ’ , answer ) ;
9 printf ( ’ \n\nOR \n\n ( p i / 4 ) ∗%f r a d i a n s ’ , answer *(4/ %pi )
);
Scilab code Exa 5.18 To determine inverse tan function of a given value
1 clc , clear ;
2 // Example 5 . 1 8
3 //To d e t e r m i n e i n v e r s e t a n f u n c t i o n o f a g i v e n v a l u e
4
5 given = tan ( %pi ) ; // g i v e n v a l u e
6 answer = atan ( given ) ; // f i n a l a n s w e r
7
8 printf ( ’ R e q u i r e d a n s w e r i s %f r a d i a n s ’ , answer ) ;
Scilab code Exa 5.19 To determine exact value of given expression involving invers
113
1 clc , clear ;
2 // Example 5 . 1 9
3 //To d e t e r m i n e e x a c t v a l u e o f g i v e n
expression
involving inverse trigonometric functions
4
5 expression = cos ( asin ( -1/4) ) ; // g i v e n e x p r e s i o n
6
7 printf ( ’ V a l u e o f g i v e n e x p r e s s i o n i s %f r a d i a n s ’ ,
expression ) ;
114
Chapter 6
Additional Topics
1 clc , clear
2 // Example 6 . 3
3 //To s o l v e t h e g i v e n e q u a t i o n
4
5 sec_theta = 1/2
6 cos_theta = 1 / sec_theta
7 printf ( ’ c o s ( t h e t a ) = %f a s c a l c u l a t e d \n ’ , cos_theta )
8 printf ( ’ But v a l u e o f c o s f u n c t i o n can n e v e r e x c e e d
u n i t y \n ’ )
9 printf ( ’ Thus , NO SOLUTION e x i s t s ’ )
1 clc , clear
2 // Example 6 . 4
3 //To s o l v e t h e g i v e n e q u a t i o n
4
5 // Given e q u a t i o n i s c o s t h e t a = t a n t h e t a
115
6 // s i m p l y f y i n g g i v e n e q u a t i o n , we g e t
7 // ( s i n t h e t a ) ˆ2 + s i n t h e t a − 1 = 0
8 // S o l v e f o r s i n t h e t a a s f o l l o w s
9 p =[1 1 -1]
10 sin_theta = roots ( p )
11 printf ( ’ V a l u e s o f s i n ( t h e t a ) a f t e r s i m p l i f y i n g and
s o l v i n g = %f and %f\n ’ , sin_theta (1) , sin_theta (2) )
12 printf ( ’ E l i m i n a t e %f a s s i n t h e t a c a n t be b e l o w −1 ’ ,
sin_theta (1) )
13
14 // S i n c e s i n t h e t a i s +ve , 2 s o l u t i o n s e x i s t . i n 1 s t
and 2 nd q u a d r a n t
15 theta_1 = asin ( sin_theta (2) ) ; // i n 1 s t q u a d r a n t
16 theta_2 = %pi - asin ( sin_theta (2) ) ; // t h e r e f l e c t i o n i n 2
nd q u a d r a n t
17
18 printf ( ’ \n\nSOLUTIONS : \ n ’ )
19 printf ( ’ %f r a d i a n s \ n%f r a d i a n s ’ , theta_1 , theta_2 )
20
21 printf ( ’ \n\nGENERAL SOLUTIONS : \ n ’ )
22 printf ( ’ %f + i n t e g e r m u l t i p l e s o f 2 p i \n ’ , theta_1 )
23 printf ( ’ %f + i n t e g e r m u l t i p l e s o f 2 p i \n ’ , theta_2 )
Scilab code Exa 6.9 To find the result of basic operations on 2 given complex numb
1 clc , clear
2 // Example 6 . 9
3 //To f i n d t h e r e s u l t o f b a s i c o p e r a t i o n s on 2 g i v e n
c o m p l e x numbers
4
5 z1 = complex ( -2 ,3)
6 z2 = complex (3 ,4)
7
8 summ = z1 + z2
9 difference = z1 - z2
116
10 product = z1 * z2
11 ratio = z1 / z2
12 mag_z1 = abs ( z1 ) // modulus o f z 1
13 mag_z2 = abs ( z2 ) // modulus o f z 2
14 // p r i n t f ( ’ Note : P l e a s e go t h r o u g h c o m p l e x n o s s c i l a b
s y n t a x e s t o comprehend t h i s e x a m p l e c o d e \n\n ’ )
15 printf ( ’ z 1 + z 2 = %. 0 f + %. 0 f ∗ i \n ’ , real ( summ ) , imag (
summ ) )
16 printf ( ’ z 1 − z 2 = %. 0 f + %. 0 f ∗ i \n ’ , real ( difference ) ,
imag ( difference ) )
17 printf ( ’ z 1 ∗ z 2 = %. 0 f + %. 0 f ∗ i \n ’ , real ( product ) ,
imag ( product ) )
18 printf ( ’ z 1 / z 2 = %f + %f∗ i \n ’ , real ( ratio ) , imag (
ratio ) )
19 printf ( ’ | z 1 |= s q r t (%. 0 f )= %f \n ’ , mag_z1 ^2 , mag_z1 )
20 printf ( ’ | z 2 | = %. 0 f ’ , mag_z2 )
Scilab code Exa 6.10 To represent given complex number in trigonometric form
1 clc , clear
2 // Example 6 . 1 0
3 //To r e p r e s e n t g i v e n c o m p l e x number i n trigonometric
form
4
5 z = -2 + -1* %i ; // g i v e n number
6 x = real ( z ) ; // r e a l p a r t
7 y = imag ( z ) ; // i m a g i n a r y p a r t
8
9 // t h e t a i s i n t h i r d q u a d r a n t a s x and y a r e −ve
10 theta =180 + atand ( y / x ) ;
11 r = sqrt ( x ^2+ y ^2) ; // modulus o f z
12 printf ( ’ z= %f + i ∗ %f can be w r i t t e n a s : \n ’ , real ( z
) , imag ( z ) )
13 printf ( ’ z = s q r t (%. 0 f ) ∗ ( c o s (%. 1 f )+ i ∗ s i n (%. 1 f ) ) ’ ,r ^2 ,
theta , theta )
117
Scilab code Exa 6.11 To determine product and ratio of complex numbers using formu
1 clc , clear
2 // Example 6 . 1 1
3 //To d e t e r m i n e p r o d u c t and r a t i o o f c o m p l e x numbers
using formula
4
5 // g i v e n v a l u e s
6 z1 = 6*( cosd (70) + %i * sind (70) ) ;
7 z2 = 2*( cosd (31) + %i * sind (31) ) ;
8
9 // a r g u e m e n t s o f c o m p l e x numbers
10 theta1 = phasemag ( z1 ) ;
11 theta2 = phasemag ( z2 ) ;
12 // modulus o f c o m p l e x numbers
13 r1 = abs ( z1 ) ;
14 r2 = abs ( z2 ) ;
15 theta_1p2 = theta1 + theta2 ; // t h e t a 1 + t h e t a 2
16 theta_1m2 = theta1 - theta2 ; // t h e t a 1 − t h e t a 2
17 // a c c o r d i n g t o t h e f o r m u l a u s e d i n book
18 product = r1 * r2 *( cosd ( theta_1p2 ) + %i * sind ( theta_1p2 ) )
;
19 ratio = ( r1 / r2 ) *( cosd ( theta_1m2 ) + %i * sind ( theta_1m2 ) )
;
20
21 printf ( ’ z 1 ∗ z 2 = %. 0 f ∗ ( c o s (%. 0 f )+ i ∗ s i n (%. 0 f ) ) \n ’ , r1 *
r2 , phasemag ( product ) , phasemag ( product ) )
22 printf ( ’ z 1 / z 2 = %. 0 f ∗ ( c o s (%. 0 f )+ i ∗ s i n (%. 0 f ) ) \n ’ , r1 /
r2 , phasemag ( ratio ) , phasemag ( ratio ) )
Scilab code Exa 6.12 To find higher powers of complex number using demoivre theore
118
1 clc , clear
2 // Example 6 . 1 2
3 //To f i n d h i g h e r p o w e r s o f c o m p l e x number u s i n g
demoivre theorem
4
5 z = complex (1 ,1) ;
6 r = abs ( z ) ; // modulus o f z
7 theta = phasemag ( z ) ; // a r g u e m e n t o f z
8 power =10;
9 // u s i n g d e m o i v r e f o r m u l a
10 answer = ( r ^ power ) *( cosd ( theta * power ) + %i * sind ( theta *
power ) ) ;
11 // p r i n t f ( ’ ( 1 + i ) ˆ10 = (%. 0 f ) ∗ ( c o s (%. 0 f )+ i ∗ s i n (%. 0 f ) )
’ , r ˆ power , t h e t a ∗ power , t h e t a ∗ power ) ;
12 printf ( ’ \n %. 0 f + %. 0 f ∗ i ’ , real ( answer ) , imag ( answer ) )
;
13 printf ( ’ \n (OR) \n %. 0 f ∗ i ’ , imag ( answer ) ) ;
1 clc , clear
2 // Example 6 . 1 3
3 //To d e t e r m i n e t h e c u b e r o o t s o f i
4
5 z = %i // g i v e n c o m p l e x number
6 // m o d u l i i f o r c u b e r o o t s
7 r1 = abs ( z ) ^(1/3)
8 r2 = abs ( z ) ^(1/3)
9 r3 = abs ( z ) ^(1/3)
10
11 // a r g u e m e n t s f o r c u b e r o o t s
12 theta1 = ( phasemag ( z ) +360*0) /3
13 theta2 = ( phasemag ( z ) +360*1) /3
14 theta3 = ( phasemag ( z ) +360*2) /3
15
119
16 cube_root_1 = r1 *( cosd ( theta1 ) + %i * sind ( theta1 ) )
17 cube_root_2 = r2 *( cosd ( theta2 ) + %i * sind ( theta2 ) )
18 cube_root_3 = r3 *( cosd ( theta3 ) + %i * sind ( theta3 ) )
19
20 printf ( ’ c u b e r o o t 1 : %f + %f∗ i \n ’ , real ( cube_root_1 ) ,
imag ( cube_root_1 ) )
21 printf ( ’ c u b e r o o t 2 : %f + %f∗ i \n ’ , real ( cube_root_2 ) ,
imag ( cube_root_2 ) )
22 printf ( ’ c u b e r o o t 3 : %f + %f∗ i \n ’ , real ( cube_root_3 ) ,
imag ( cube_root_3 ) )
1 clc , clear
2 // Example 6 . 1 5
3 //To c o n v e r t from p o l a r t o c a r t e s i a n c o o r d i n a t e s
4
5 // p a r t ( a )
6 r =2 ;
7 theta =30 ;
8 x = r * cosd ( theta ) ;
9 y = r * sind ( theta ) ;
10 printf ( ’ ( a ) ( x , y )= ( %f , %f ) \n ’ ,x , y ) ;
11
12 // p a r t ( b )
13 r =3 ;
14 theta =3* %pi /4 ;
15 x = r * cos ( theta ) ;
16 y = r * sin ( theta ) ;
17 printf ( ’ ( b ) ( x , y )= ( %f , %f ) \n ’ ,x , y ) ;
18
19 // p a r t ( c )
20 r = -1 ;
21 theta =5* %pi /3 ;
22 x = r * cos ( theta ) ;
120
23 y = r * sin ( theta ) ;
24 printf ( ’ ( c ) ( x , y )= ( %f , %f ) ’ ,x , y ) ;
1 clc , clear
2 // Example 6 . 1 6
3 //To c o n v e r t from c a r t e s i a n t o p o l a r c o o r d i n a t e s
4
5 // p a r t ( a )
6 x =3 ;
7 y =4 ;
8
9 // 5 3 . 1 3 i s i n same q u a d r a n t a s ( 3 , 4 )
10 r = sqrt ( x ^2+ y ^2) ;
11 theta = atand ( y / x ) ;
12 printf ( ’PART A\n ( r , t h e t a )= %f , %f ’ ,r , theta ) ;
13 printf ( ’ \nOR\n ’ ) ;
14 r = - sqrt ( x ^2+ y ^2) ;
15 // t a n t h e t a i s +ve i n 3 r d q u a d r a n t
16 // s o 180 + 5 3 . 3 3 i s a l s o a p e r m i s s i b l e v a l u e
17 theta =180 + atand ( y / x ) ;
18 printf ( ’ ( r , t h e t a )= %f , %f ’ ,r , theta ) ;
19
20 // p a r t ( b )
21 x = -5 ;
22 y = -5 ;
23
24 // 225 i s i n same q u a d r a n t a s ( −5 , −5)
25 // t a n t h e t a i s +ve i n 3 r d q u a d r a n t
26 r = sqrt ( x ^2+ y ^2) ;
27 theta =180+ atand ( y / x ) ;
28 printf ( ’ \n\nPART B\n ( r , t h e t a )= %f , %f ’ ,r , theta ) ;
29 printf ( ’ \nOR\n ’ ) ;
30 r = - sqrt ( x ^2+ y ^2) ;
121
31 theta = atand ( y / x ) ;
32 printf ( ’ ( r , t h e t a )= %f , %f ’ ,r , theta ) ;
1 clc , clear
2 // Example 6 . 1 7
3 // t o e x p r e s s an e q u a t i o n i n p o l a r c o o r d i n a t e s
4
5 RHS =9 ;
6 // Note t h a t LHS i s b a s i c a l l y an e q u a t i o n o f c i r c l e
7 // But a t any i n s t a n t , i t i s n u m b e r i c a l l y same a s 9
8 LHS_numerically = RHS ;
9 r = sqrt ( LHS_numerically ) ;
10
11 printf ( ’ The e q u a t i o n i n t e r m s o f p o l a r c o o r d i n a t e s
i s : r =%. 0 f ’ ,r )
1 clc , clear
2 // Example 6 . 1 9
3 // t o e x p r e s s an e q u a t i o n i n p o l a r c o o r d i n a t e s
4
5 // Given e q u a t i o n i s : y=x
6 y_by_x =1; // r a t i o o f y and x
7 tan_theta = y_by_x ;
8 theta = atand ( tan_theta ) ; // a z i m u t h a n g l e
9
10 printf ( ’ The g i v e n e q u a t i o n i n p o l a r c o o r d i n a t e s is :
t h e t a = %. 0 f d e g r e e \n ’ , theta )
11 printf ( ’ \ nNote : P o l a r form i s same r e g a r d l e s s o f
value of r ’)
122
123
Chapter 8
Appendix B
1 // Example 8 . 1
2 //To p l o t t h e f u n c t i o n o f s i n ( x )
3 clear , clc ;
4
5 x = linspace ( -0 ,2* %pi ,50) ;
6 y = sin ( x ) ;
7
8 // For g r i d , uncomment b e l o w l i n e
9 // s e t ( g c a ( ) , ” g r i d ” , [ 5 5 ] ) ;
10
11 printf ( ’NOTE: \ nTo e n a b l e t h e g r i d , c h e c k t h e c o d e ’ )
12 plot (x ,y , ’ r ’ ) ;
13 xlabel ( ” $0 \ l e x \ l e 2∗ p i $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ”
);
14 ylabel ( ” $y ( x )=s i n ( x ) $ ” ,” f o n t s i z e ” ,4 , ” c o l o r ” ,” r e d ” ) ;
15 title ( ” Example 8 . 1 ” ,” c o l o r ” ,” b l u e ” ,” f o n t s i z e ” ,9) ;
16 legend ( ” s i n ( x ) ” ) ;
124
Figure 8.1: To plot the function of sin x
125
Figure 8.2: To plot the function of sin x
126