summaryrefslogtreecommitdiff
path: root/24/DEPENDENCIES
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /24/DEPENDENCIES
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 '24/DEPENDENCIES')
-rwxr-xr-x24/DEPENDENCIES/Bernauli.sci17
-rwxr-xr-x24/DEPENDENCIES/Example11_7.sce19
-rwxr-xr-x24/DEPENDENCIES/Example17_1.sce30
-rwxr-xr-x24/DEPENDENCIES/Example2_1a.sce10
-rwxr-xr-x24/DEPENDENCIES/Example2_1b.sce8
-rwxr-xr-x24/DEPENDENCIES/Example4_2a.sce15
-rwxr-xr-x24/DEPENDENCIES/Example4_3.sce12
-rwxr-xr-x24/DEPENDENCIES/Gravitation.sci29
-rwxr-xr-x24/DEPENDENCIES/collision.sci13
-rwxr-xr-x24/DEPENDENCIES/cross_product.sci6
-rwxr-xr-x24/DEPENDENCIES/degree_rad.sci9
-rwxr-xr-x24/DEPENDENCIES/electrostatics.sci16
-rwxr-xr-x24/DEPENDENCIES/quantum.sci24
13 files changed, 208 insertions, 0 deletions
diff --git a/24/DEPENDENCIES/Bernauli.sci b/24/DEPENDENCIES/Bernauli.sci
new file mode 100755
index 000000000..270934eef
--- /dev/null
+++ b/24/DEPENDENCIES/Bernauli.sci
@@ -0,0 +1,17 @@
+//function to calculate the water flow rate
+//V(1) = water flow rate at 1 in m/s
+//V(2) = water flow rate at 2 in m/s
+//**Already defined variables**
+//A(1) = cross-sectional area 1 in m^2
+//A(2) = cross-sectional area 2 in m^2
+//h = vertical height difference in water level in m (h(2)-h(1))
+//deltaP = difference in pressure in N/m^2 (P(2)-P(1))
+//density = density of fluid in kg/m^3
+g = 9.8 //acceleration due to gravity in m/s^2
+function [f] = Bernauli (V)
+ f = zeros(2,1)
+ //equation of continuity
+ f(1) = A(1)*V(1) - A(2)*V(2)
+ //Bernauli's equation
+ f(2) = (V(2)^2 - V(1)^2) + 2*g*h + 2*deltaP/density
+endfunction \ No newline at end of file
diff --git a/24/DEPENDENCIES/Example11_7.sce b/24/DEPENDENCIES/Example11_7.sce
new file mode 100755
index 000000000..6eca1a825
--- /dev/null
+++ b/24/DEPENDENCIES/Example11_7.sce
@@ -0,0 +1,19 @@
+//Given that
+M = 2.5 //in kg
+R = 0.20 //i meter
+m = 1.2 //in kg
+g = 9.8 //in m/s^2
+I = 0.5*M*R^2
+
+//Sample Problem 11-7
+printf("**Sample Problem 11-7**\n")
+//mg - T = ma
+//T*R = I*a/R
+//T = I*a/R^2
+//on adding =>
+a = m*g/(m+I/R^2)
+T = m*(g-a)
+alpha = a/R
+printf("The acceleration of the block is %fm/s^2\n", a)
+printf("The angular acceleration of the pulley is %frad/s^2\n", alpha)
+printf("The tension in the string is %fN", T) \ No newline at end of file
diff --git a/24/DEPENDENCIES/Example17_1.sce b/24/DEPENDENCIES/Example17_1.sce
new file mode 100755
index 000000000..01f1e2f81
--- /dev/null
+++ b/24/DEPENDENCIES/Example17_1.sce
@@ -0,0 +1,30 @@
+//Given that
+funcprot(0)
+deff('[y] = wave(t, x)', 'y = 0.00327*sin(72.1*x - 2.72*t)')
+//Comparing the given equation with the standard wave equation
+A = 0.00327 //in m
+k = 72.1 //in rad/s
+w = 2.72 //in rad/s
+
+//Sample Problem 17-1a
+printf("**Sample Problem 17-1a**\n")
+printf("The amplitude of the wave is %fm\n", A)
+
+//Sample Problem 17-1b
+printf("\n**Sample Problem 17-1b**\n")
+lambda = 2*%pi/k
+printf(" wavelength = %fm\n", lambda)
+T = 2*%pi/w
+printf(" period = %fs\n",T)
+f = 1/T
+printf(" frequency = %fHz\n", f)
+
+//Sample Problem 17-1c
+printf("\n**Sample Problem 17-1c**\n")
+v = w/k
+printf("The velocity of the wave is %fm/s\n", v)
+
+//Sample Problem 17-1d
+printf("\n**Sample Problem 17-1d**\n")
+y = wave(18.9, 22.5*10^-2)
+printf("Displacement of the wave is %fm", y) \ No newline at end of file
diff --git a/24/DEPENDENCIES/Example2_1a.sce b/24/DEPENDENCIES/Example2_1a.sce
new file mode 100755
index 000000000..8bce2b73d
--- /dev/null
+++ b/24/DEPENDENCIES/Example2_1a.sce
@@ -0,0 +1,10 @@
+//Given that
+velocity = 70 //in km/h
+distance_covered = 8.4 //in km
+next_time = 30 //in min
+next_walk = 2 //in km
+
+//Sample Problem 2-1a
+printf("**Sample Problem 2-1a**\n")
+overall_displacement = distance_covered + next_walk
+printf("Overall displacement from begining of the drive to the station is %f km", overall_displacement) \ No newline at end of file
diff --git a/24/DEPENDENCIES/Example2_1b.sce b/24/DEPENDENCIES/Example2_1b.sce
new file mode 100755
index 000000000..9d9923e9d
--- /dev/null
+++ b/24/DEPENDENCIES/Example2_1b.sce
@@ -0,0 +1,8 @@
+exec('Example2_1a.sce', -1)
+clc
+
+//Sample Problem 2-1b
+printf("\n**Sample Problem 2-1b**\n")
+time = distance_covered / velocity //in hr
+delta_t = time + next_time /60 //in hr
+printf("Time interval from the begining of the drive to the arrival at the station is %f hr", delta_t) \ No newline at end of file
diff --git a/24/DEPENDENCIES/Example4_2a.sce b/24/DEPENDENCIES/Example4_2a.sce
new file mode 100755
index 000000000..7906b6654
--- /dev/null
+++ b/24/DEPENDENCIES/Example4_2a.sce
@@ -0,0 +1,15 @@
+exec("degree_rad.sci",-1)
+
+//Given that
+t = poly(0,'t')
+x = -0.31 *t^2 + 7.2 *t +28 //in meter
+y = 0.22 *t^2 - 9.1 *t + 30 //in meter
+
+//Sample Problem 4-2a
+printf("**Sample Problem 4-2a**\n")
+time_t =15 //in sec
+position_r = [horner(x,time_t),horner(y,time_t)]
+printf("The position vector of the rabbit at t=15sec in meter is")
+disp(position_r)
+printf("The magnitude of the position vector is %f m\n", norm(position_r))
+printf("The angle made by the position vector with the x axis in degrees at the same time %f", rtod(atan(position_r(2)/position_r(1)))) \ No newline at end of file
diff --git a/24/DEPENDENCIES/Example4_3.sce b/24/DEPENDENCIES/Example4_3.sce
new file mode 100755
index 000000000..11ac5d1a0
--- /dev/null
+++ b/24/DEPENDENCIES/Example4_3.sce
@@ -0,0 +1,12 @@
+exec("Example4_2a.sce",-1)
+clc
+
+//Sample Problem 4-3
+printf("\n**Sample Problem 4-3**\n")
+velocity_v_x = derivat(x)
+velocity_v_y = derivat(y)
+v_time_t = [horner(velocity_v_x,time_t),horner(velocity_v_y,time_t)]
+printf("The velocity vector of the rabbit at t=15sec in m/s is")
+disp(v_time_t)
+printf("The magnitude of the velocity vector is %f m/s\n", norm(v_time_t))
+printf("The angle made by the velocity vector with the x axis in degrees at the same time %f", rtod(atan(v_time_t(2)/v_time_t(1)))) \ No newline at end of file
diff --git a/24/DEPENDENCIES/Gravitation.sci b/24/DEPENDENCIES/Gravitation.sci
new file mode 100755
index 000000000..a6ddc1705
--- /dev/null
+++ b/24/DEPENDENCIES/Gravitation.sci
@@ -0,0 +1,29 @@
+//Universal constant G
+G = 6.67*(10^-11)
+//Radius of earth
+Re = 6.37* 10^6 //in meter
+//mass of earth
+Me = 5.98 * 10^24; //in kg
+//Mass of Sun
+Ms = 1.99 * 10^30 //in kg
+
+//calculates the gravitational force
+//m1&m2 = mass of the particle
+//d = distanece between m1 & m2
+function [Force] = GForce(m1,m2,d)
+ Force = G*m1*m2/(d*d)
+endfunction
+
+//calculates the gravitational potential
+//m1&m2 = mass of the particle
+//d = distanece between m1 & m2
+function [Potential] = GPotential(m1,m2,d)
+ Potential = - G*m1*m2/d;
+endfunction
+
+//Kepler's Law
+//M = mass
+//T = time period
+function [radius] = KeplerRadius (M,T)
+ radius = (G*M*T*T/(4*%pi*%pi))^(1/3)
+endfunction \ No newline at end of file
diff --git a/24/DEPENDENCIES/collision.sci b/24/DEPENDENCIES/collision.sci
new file mode 100755
index 000000000..7083d5076
--- /dev/null
+++ b/24/DEPENDENCIES/collision.sci
@@ -0,0 +1,13 @@
+//To calculate velocities after a two particle head on collision
+//Vf = velocities after collision
+//**Already defined variables**
+//e = newton's constant for collision
+//m1&m2 = masses of the particles
+//Vi = initial velocities of the particle
+function [f] = collision(Vf)
+ f=zeros(2,1);
+ //newton's equation for collision
+ f(2)= e*(Vi(1)-Vi(2))-(Vf(2)-Vf(1));
+ //Momentum conservation
+ f(1)=(m1*Vi(1)+m2*Vi(2))-(m1*Vf(1)+m2*Vf(2))
+endfunction \ No newline at end of file
diff --git a/24/DEPENDENCIES/cross_product.sci b/24/DEPENDENCIES/cross_product.sci
new file mode 100755
index 000000000..c00b7ebdf
--- /dev/null
+++ b/24/DEPENDENCIES/cross_product.sci
@@ -0,0 +1,6 @@
+//Vector Product of two given vectors
+function [val] = crossproduct(A, B)
+ val = [A(2) * B(3) - A(3) * B(2),
+ A(3) * B(1) - A(1) * B(3),
+ A(1) * B(2) - A(2) * B(1)]
+endfunction \ No newline at end of file
diff --git a/24/DEPENDENCIES/degree_rad.sci b/24/DEPENDENCIES/degree_rad.sci
new file mode 100755
index 000000000..66d25534c
--- /dev/null
+++ b/24/DEPENDENCIES/degree_rad.sci
@@ -0,0 +1,9 @@
+//degrees to radian conversion
+function [radians] = dtor(degrees)
+ radians = degrees*(%pi/180);
+endfunction
+
+//radian to degrees conversion
+function [degrees] = rtod(radian)
+ degrees = radian*(180/%pi);
+endfunction \ No newline at end of file
diff --git a/24/DEPENDENCIES/electrostatics.sci b/24/DEPENDENCIES/electrostatics.sci
new file mode 100755
index 000000000..ef708effe
--- /dev/null
+++ b/24/DEPENDENCIES/electrostatics.sci
@@ -0,0 +1,16 @@
+//permitivity constant
+Eo = 8.85*10^-12 //in C^2/N.m^2
+//electric consatnt
+k = 1/(4*%pi*Eo)
+//charge on proton
+e = 1.6*10^-19 //in C
+
+//calculates coloumb force on two charged particle having charge q1, q2 seprated by distance equal to r
+function [F] = coulomb(q1, q2, r)
+ F = k*q1*q2/r^2
+endfunction
+
+//calculates the potential due to a particle having charge q at a distance d from the particle
+function [V] = EPotential(q, r)
+ V = k*q/r
+endfunction \ No newline at end of file
diff --git a/24/DEPENDENCIES/quantum.sci b/24/DEPENDENCIES/quantum.sci
new file mode 100755
index 000000000..3dbfb762b
--- /dev/null
+++ b/24/DEPENDENCIES/quantum.sci
@@ -0,0 +1,24 @@
+//Sone universal constant
+h = 6.62*10^-34 //in J.s
+c = 3*10^8 //in m/s
+Me = 9.11*10^-31 //in kg
+conv = 1.6*10^-19 //ev to Joule conversion factor
+
+//calculates the energy difference between the two Energy levels n1 & n2
+//M = mass of the particle
+//L = width of the region
+function [E] = Ediff(n2, n1, M, L)
+ E = (n2^2-n1^2)*h^2/(8*M*L^2)
+endfunction
+
+//calculates the palnck's wavelength
+//E = energy of the particle
+function [lambda] = wavelength(E)
+ lambda = h*c/E
+endfunction
+
+//calculates the palnck's energy
+//w = wavelength of the particle
+function [E] = Energy(w)
+ E = h*c/w
+endfunction \ No newline at end of file