summaryrefslogtreecommitdiff
path: root/2915/CH6
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /2915/CH6
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '2915/CH6')
-rwxr-xr-x2915/CH6/EX6.10/Ex6_10.sce14
-rwxr-xr-x2915/CH6/EX6.11/Ex6_11.sce22
-rwxr-xr-x2915/CH6/EX6.12/Ex6_12.sce13
-rwxr-xr-x2915/CH6/EX6.13/Ex6_13.sce22
-rwxr-xr-x2915/CH6/EX6.15/Ex6_15.sce24
-rwxr-xr-x2915/CH6/EX6.16/Ex6_16.sce32
-rwxr-xr-x2915/CH6/EX6.17/Ex6_17.sce11
-rwxr-xr-x2915/CH6/EX6.19/Ex6_19.sce11
-rwxr-xr-x2915/CH6/EX6.3/Ex6_3.sce9
-rwxr-xr-x2915/CH6/EX6.4/Ex6_4.sce23
-rwxr-xr-x2915/CH6/EX6.9/Ex6_9.sce20
11 files changed, 201 insertions, 0 deletions
diff --git a/2915/CH6/EX6.10/Ex6_10.sce b/2915/CH6/EX6.10/Ex6_10.sce
new file mode 100755
index 000000000..65e4316b1
--- /dev/null
+++ b/2915/CH6/EX6.10/Ex6_10.sce
@@ -0,0 +1,14 @@
+clc,clear
+//Example 6.10
+//To represent given complex number in trigonometric form
+
+z=-2 + -1*%i ;//given number
+x=real(z) ;//real part
+y=imag(z) ;//imaginary part
+
+//theta is in third quadrant as x and y are -ve
+theta=180 + atand(y/x);
+r=sqrt(x^2+y^2) ;//modulus of z
+printf('z= %f + i* %f can be written as: \n',real(z),imag(z))
+printf('z = sqrt(%.0f)*(cos(%.1f)+i*sin(%.1f))',r^2,theta,theta)
+
diff --git a/2915/CH6/EX6.11/Ex6_11.sce b/2915/CH6/EX6.11/Ex6_11.sce
new file mode 100755
index 000000000..146fc00a3
--- /dev/null
+++ b/2915/CH6/EX6.11/Ex6_11.sce
@@ -0,0 +1,22 @@
+clc,clear
+//Example 6.11
+//To determine product and ratio of complex numbers using formula
+
+//given values
+z1 = 6*(cosd(70)+ %i*sind(70));
+z2 = 2*(cosd(31)+ %i*sind(31));
+
+//arguements of complex numbers
+theta1=phasemag(z1);
+theta2=phasemag(z2);
+//modulus of complex numbers
+r1=abs(z1);
+r2=abs(z2);
+theta_1p2 =theta1 + theta2 ;//theta1 + theta 2
+theta_1m2 =theta1 - theta2 ;//theta1 - theta 2
+//according to the formula used in book
+product = r1*r2*(cosd(theta_1p2)+%i*sind(theta_1p2));
+ratio = (r1/r2)*(cosd(theta_1m2)+%i*sind(theta_1m2));
+
+printf('z1*z2 = %.0f*(cos(%.0f)+i*sin(%.0f))\n',r1*r2,phasemag(product),phasemag(product))
+printf('z1/z2 = %.0f*(cos(%.0f)+i*sin(%.0f))\n',r1/r2,phasemag(ratio),phasemag(ratio))
diff --git a/2915/CH6/EX6.12/Ex6_12.sce b/2915/CH6/EX6.12/Ex6_12.sce
new file mode 100755
index 000000000..876856cfb
--- /dev/null
+++ b/2915/CH6/EX6.12/Ex6_12.sce
@@ -0,0 +1,13 @@
+clc,clear
+//Example 6.12
+//To find higher powers of complex number using demoivre theorem
+
+z= complex(1,1);
+r= abs(z);//modulus of z
+theta=phasemag(z) ;//arguement of z
+power=10;
+//using demoivre formula
+answer= (r^power)*(cosd(theta*power)+%i*sind(theta*power));
+//printf('(1+i)^10 = (%.0f)*(cos(%.0f)+ i*sin(%.0f))',r^power,theta*power,theta*power);
+printf('\n %.0f + %.0f*i',real(answer),imag(answer));
+printf('\n(OR)\n %.0f*i',imag(answer));
diff --git a/2915/CH6/EX6.13/Ex6_13.sce b/2915/CH6/EX6.13/Ex6_13.sce
new file mode 100755
index 000000000..09ab024c2
--- /dev/null
+++ b/2915/CH6/EX6.13/Ex6_13.sce
@@ -0,0 +1,22 @@
+clc,clear
+//Example 6.13
+//To determine the cube roots of i
+
+z=%i //given complex number
+//modulii for cuberoots
+r1=abs(z)^(1/3)
+r2=abs(z)^(1/3)
+r3=abs(z)^(1/3)
+
+//arguements for cuberoots
+theta1= (phasemag(z)+360*0)/3
+theta2= (phasemag(z)+360*1)/3
+theta3= (phasemag(z)+360*2)/3
+
+cube_root_1 = r1 *(cosd(theta1)+ %i*sind(theta1))
+cube_root_2 = r2 *(cosd(theta2)+ %i*sind(theta2))
+cube_root_3 = r3 *(cosd(theta3)+ %i*sind(theta3))
+
+printf('cuberoot 1: %f + %f*i\n',real(cube_root_1),imag(cube_root_1))
+printf('cuberoot 2: %f + %f*i\n',real(cube_root_2),imag(cube_root_2))
+printf('cuberoot 3: %f + %f*i\n',real(cube_root_3),imag(cube_root_3))
diff --git a/2915/CH6/EX6.15/Ex6_15.sce b/2915/CH6/EX6.15/Ex6_15.sce
new file mode 100755
index 000000000..0fe744500
--- /dev/null
+++ b/2915/CH6/EX6.15/Ex6_15.sce
@@ -0,0 +1,24 @@
+clc,clear
+//Example 6.15
+//To convert from polar to cartesian coordinates
+
+//part(a)
+r=2 ;
+theta=30 ;
+x=r*cosd(theta) ;
+y=r*sind(theta) ;
+printf('(a)(x,y)= (%f,%f)\n',x,y) ;
+
+//part(b)
+r=3 ;
+theta=3*%pi/4 ;
+x=r*cos(theta) ;
+y=r*sin(theta) ;
+printf('(b)(x,y)= (%f,%f)\n',x,y) ;
+
+//part(c)
+r=-1 ;
+theta=5*%pi/3 ;
+x=r*cos(theta) ;
+y=r*sin(theta) ;
+printf('(c)(x,y)= (%f,%f)',x,y) ;
diff --git a/2915/CH6/EX6.16/Ex6_16.sce b/2915/CH6/EX6.16/Ex6_16.sce
new file mode 100755
index 000000000..78ab025be
--- /dev/null
+++ b/2915/CH6/EX6.16/Ex6_16.sce
@@ -0,0 +1,32 @@
+clc,clear
+//Example 6.16
+//To convert from cartesian to polar coordinates
+
+//part(a)
+x=3 ;
+y=4 ;
+
+//53.13 is in same quadrant as(3,4)
+r=sqrt(x^2+y^2) ;
+theta=atand(y/x) ;
+printf('PART A\n(r,theta)= %f,%f',r,theta) ;
+printf('\nOR\n') ;
+r=-sqrt(x^2+y^2) ;
+//tan theta is +ve in 3rd quadrant
+//so 180 + 53.33 is also a permissible value
+theta=180 + atand(y/x) ;
+printf('(r,theta)= %f,%f',r,theta) ;
+
+//part(b)
+x=-5 ;
+y=-5 ;
+
+//225 is in same quadrant as(-5,-5)
+//tan theta is +ve in 3rd quadrant
+r=sqrt(x^2+y^2) ;
+theta=180+ atand(y/x) ;
+printf('\n\nPART B\n(r,theta)= %f,%f',r,theta) ;
+printf('\nOR\n') ;
+r=-sqrt(x^2+y^2) ;
+theta= atand(y/x) ;
+printf('(r,theta)= %f,%f',r,theta) ;
diff --git a/2915/CH6/EX6.17/Ex6_17.sce b/2915/CH6/EX6.17/Ex6_17.sce
new file mode 100755
index 000000000..a6c7aa5f8
--- /dev/null
+++ b/2915/CH6/EX6.17/Ex6_17.sce
@@ -0,0 +1,11 @@
+clc,clear
+//Example 6.17
+//to express an equation in polar coordinates
+
+RHS=9 ;
+//Note that LHS is basically an equation of circle
+//But at any instant , it is numberically same as 9
+LHS_numerically=RHS ;
+r=sqrt(LHS_numerically) ;
+
+printf('The equation in terms of polar coordinates is : r =%.0f',r)
diff --git a/2915/CH6/EX6.19/Ex6_19.sce b/2915/CH6/EX6.19/Ex6_19.sce
new file mode 100755
index 000000000..32d451137
--- /dev/null
+++ b/2915/CH6/EX6.19/Ex6_19.sce
@@ -0,0 +1,11 @@
+clc,clear
+//Example 6.19
+//to express an equation in polar coordinates
+
+//Given equation is : y=x
+y_by_x =1; //ratio of y and x
+tan_theta = y_by_x;
+theta=atand(tan_theta); //azimuth angle
+
+printf('The given equation in polar coordinates is : theta = %.0f degree\n',theta)
+printf('\nNote: Polar form is same regardless of value of r ')
diff --git a/2915/CH6/EX6.3/Ex6_3.sce b/2915/CH6/EX6.3/Ex6_3.sce
new file mode 100755
index 000000000..952bb7556
--- /dev/null
+++ b/2915/CH6/EX6.3/Ex6_3.sce
@@ -0,0 +1,9 @@
+clc,clear
+//Example 6.3
+//To solve the given equation
+
+sec_theta = 1/2
+cos_theta = 1 / sec_theta
+printf('cos(theta) = %f as calculated\n',cos_theta)
+printf('But value of cos function can never exceed unity\n')
+printf('Thus, NO SOLUTION exists')
diff --git a/2915/CH6/EX6.4/Ex6_4.sce b/2915/CH6/EX6.4/Ex6_4.sce
new file mode 100755
index 000000000..79b55174d
--- /dev/null
+++ b/2915/CH6/EX6.4/Ex6_4.sce
@@ -0,0 +1,23 @@
+clc,clear
+//Example 6.4
+//To solve the given equation
+
+//Given equation is cos_theta = tan_theta
+//simplyfying given equation, we get
+//(sin_theta)^2 + sin_theta - 1 = 0
+//Solve for sin_theta as follows
+p=[1 1 -1]
+sin_theta= roots(p)
+printf('Values of sin(theta) after simplifying and solving = %f and %f\n',sin_theta(1),sin_theta(2))
+printf('Eliminate %f as sin_theta cant be below -1',sin_theta(1))
+
+//Since sin_theta is +ve, 2 solutions exist. in 1st and 2nd quadrant
+theta_1=asin(sin_theta(2)); //in 1st quadrant
+theta_2=%pi-asin(sin_theta(2));//the reflection in 2nd quadrant
+
+printf('\n\nSOLUTIONS:\n')
+printf('%f radians\n%f radians',theta_1,theta_2)
+
+printf('\n\nGENERAL SOLUTIONS:\n')
+printf('%f + integer multiples of 2pi \n',theta_1)
+printf('%f + integer multiples of 2pi \n',theta_2)
diff --git a/2915/CH6/EX6.9/Ex6_9.sce b/2915/CH6/EX6.9/Ex6_9.sce
new file mode 100755
index 000000000..5e6306d2d
--- /dev/null
+++ b/2915/CH6/EX6.9/Ex6_9.sce
@@ -0,0 +1,20 @@
+clc,clear
+//Example 6.9
+//To find the result of basic operations on 2 given complex numbers
+
+z1 = complex(-2,3)
+z2 = complex(3,4)
+
+summ = z1+z2
+difference = z1-z2
+product = z1*z2
+ratio = z1/z2
+mag_z1= abs(z1) //modulus of z1
+mag_z2= abs(z2)//modulus of z2
+//printf('Note: Please go through complex nos scilab syntaxes to comprehend this example code\n\n')
+printf('z1 + z2 = %.0f + %.0f*i\n',real(summ),imag(summ))
+printf('z1 - z2 = %.0f + %.0f*i\n',real(difference),imag(difference))
+printf('z1 * z2 = %.0f + %.0f*i\n',real(product),imag(product))
+printf('z1 / z2 = %f + %f*i\n',real(ratio),imag(ratio))
+printf('|z1|= sqrt(%.0f)= %f \n',mag_z1^2,mag_z1)
+printf('|z2| = %.0f',mag_z2)