Showing posts with label Python Program. Show all posts
Showing posts with label Python Program. Show all posts

Friday, 13 March 2015

1.4 Specific Gravity

Specific gravity is defined as the ratio of the density of the given substance to that of the standard substance. It is denoted by the symbol SG. It should be noted that the standard substances are water for solids and liquids whereas dry air is taken as standard for gaseous fluids. Therefore Specific Gravity can be written as

For Solids or liquids:

SGsolids or fluids = (Densitysolid or fluid / Density water)

For Gaseous Substances:
 
SGFluid = (DensityFluid / Density air)
   
It can be seen that as Specific Gravity is the ratio of two densities there will be no units. 
  Note:
  1. Remember that the density of water is 1000 kg/m3, and that of air is 1.28 kg/m3.
  2. Thus the specific gravity of mercury becomes 13.6, as density of mercury is 13600 kg/m3.
  3. Specific Gravity is an important topic in the concept of buoyancy.
  4. Specific gravity is also called as relative density.
 Video:

 
Example problem:
Find the specific gravity of gold whose density is measured to be 19,300kg/m3.(Take density of water to be 1000kg/m3).
Solution:
We know that specific gravity is the ratio of the density of the substance to that of the water for solid substances.
Therefore 
SGGold = 19300/1000
=>19.3
Therefore the specific gravity of gold is found to be 19.3(No units).

Ignore the program and continue to the next topic if you don't know programming in python. This is just for the sake of programmers.

Python Program


def specific_gravity_solid(density):
"""Specific Gravity for solid or liquid
density = The density of the substance"""
sg = density/1000
return sg

def specific_gravity_gas(density):
"""Specific Gravity for gaseous substances
density = The density of the gas"""
sg = density/1.28
return sg

#Find the density of carbon di-oxide

print specific_gravity_gas(1.98) #Prints 1.546875


Output:


1.546875

References:

http://www.britannica.com/EBchecked/topic/558700/specific-gravity
http://dictionary.reference.com/browse/specific+gravity
http://en.wikipedia.org/wiki/Specific_gravity

Thursday, 12 March 2015

3. Specific Volume

Specific Volume is defined as amount of volume occupied by unit mass of the fluid. It can also be defined as the ratio of volume and mass. It is denoted by v.

v = v/m


where v is the specific volume.
m is the mass of the body.
v is the volume of the body.

In SI units mass has units of Kg.
In SI units volume has the units of m3 
Therefore units of specific volume becomes v = v(m3)/m(kg).

It's units are m3/kg in SI units.

It can be found that it is the reciprocal of density(ρ).
Therefore, (Specific volume)v = 1/(density)ρ 

Note:
  1.   Specific volume of water = 0.001m3/kg
  2. Specific volume of air = 0.78125 m3/kg
Video:

Example Problem:
 Find the specific volume of mercury whose density is found to be 13600kg/m3
Sol
We know that specific volume is equal to the inverse of density. Therefore,
specific volume is equal to 1/13600m3/kg
=>vmercury = 0.000073529m3/kg
 Python Program:
Input:

def specific_volume(mass,volume):
return (volume/mass)

def specificVolume(density):
return (1/density)

 

Wednesday, 11 March 2015

2. Specific Weight

Specific weight is defined as the weight per unit volume. It can also be defined as the product of Density and gravitational force. It is denoted by the symbol γ(Pronounced as Gamma). Mathematically it can be shown as:
γ=ρ.g 
Its units are kg/s2.m2

It's units can also be expressed as N/m3


Note:
  1. Specific weight of the substance changes from place to place as there is a change in gravity from one place to other.
  2. It is also called as weight density. 
  3.  It can also be expressed as γ = w/v, Where w-weight of the body(m.g),v-volume of the body.
  4. If we consider the ideal case of gravity as 9.81m2. Then γair = 12.5568, γwater = 9810, γmercury = 133416. All in N/m3
 Example Problem

Find the specific mass of the substance whose density is 0.085kg/m2.s2 .(Consider the gravity at the place is 9.81 m2).

Solution:
Specific weight (γ) = ρ.g 
=> 0.085x9.81
=>0.83385N/m3.
Therefore the specific mass of the body is found 0.83385N/m3.


Python Program:


 #!/usr/bin/python
# -*- coding: utf-8 -*-
def specific_mass(density,gravity=9.81):
specific_mass = density*gravity
print u"The specific mass(γ) of the substance is found to be {}".format(specific_mass)

def weight_density(mass,volume,gravity=9.81):
weight_density = mass*gravity/volume
print u"The Weight Density/Specific mass(γ) of the substance is found to be {}".format(weight_density)

def take_user_input():
print "Choose with what you want to calculate specific_mass/weight_density."
print "Type 1 for: denstiy and gravity input."
print "Type 2 for: mass, volume and gravity input."
print "However entering the gravity value is optional."
choice = raw_input("> ")
print "Do you want to enter the gravity value? 'y'-Yes, 'n'- No"
yes_no = raw_input("> ")
if yes_no == 'Y' or 'y':
gravity = raw_input("Enter the value of gravity > ")
elif yes_no == 'N' or 'n':
gravity = 9.81
else:
print "Wrong input please choose again"
take_user_input()

if choice == "1":
density = raw_input("Enter the value of density > ")
specific_mass(float(density),float(gravity))
elif choice == "2":
mass = raw_input("Enter the mass value > ")
volume = raw_input("Enter the volume > ")
weight_density(float(mass),float(volume),float(gravity))
else:
print "Your choice was not in the given options. Please choose again."
take_user_input()

take_user_input()
 
Output:

Choose with what you want to calculate specific_mass/weight_density.
Type 1 for: denstiy and gravity input.
Type 2 for: mass, volume and gravity input.
However entering the gravity value is optional.
> 1
Do you want to enter the gravity value? 'y'-Yes, 'n'- No
> y
Enter the value of gravity > 9.63
Enter the value of density > 98653
The specific mass(γ) of the substance is found to be 950028.39

 

Tuesday, 10 March 2015

1.Density

Density: It is defined as the ratio of mass per unit volume of the substance. It is denoted by the symbol ρ can be pronounced as rho. Mathematically it can be written as 
ρ = (m/v)
Where,
ρ - Density of the substance.
m - Mass of the substance.
V - Volume of the substance. 

Units:
We will derive the units in S.I. system. 
 In SI system mass is in Kg.
In SI system Volume(v) is in m3.

Therefore,

Density(ρ) = mass(kg)/Volume(m3)

Units of ρ are kg/m3.

Note:
  1. Density is also called as mass density or volume mass density.
  2. Density of pure water is 1000kg/m3.
  3. Density of air is 1.28 kg/m3.
  4. Density of mercury is 13600kg/m3.  
Video:

Example Problem:

Find the density of the substance whose mass is measured to be 5kg and a volume of 3.91 m3.

Solution: We know that density is the ratio of mass and volume. Therefore,density(ρ) =mass(5kg)/volume(3.91m3).
 = 5/3.91(kg/m3)
 = 1.28(kg/m3) = Density of air.

The density of the fluid is found to be 1.28(kg/m3)

Python Program:

#!/usr/bin/python
# -*- coding: utf-8 -*-
def density(mass,volume):
density = float(mass)/float(volume)
print u"Density(ρ) of the substance is found to be {}".format(density)

mass = raw_input("Enter the value of mass > ")
volume = raw_input("Enter the value of volume > ")

density(mass,volume)
 Output:

Enter the value of mass > 46546
Enter the value of volume > 6546
Density(ρ) of the substance is found to be 7.11060189429