summaryrefslogtreecommitdiff
path: root/Materials_Science_by_Dr._M._Arumugam/Chapter1.ipynb
blob: 223b1028c1e2f8e724f22e28a5db3b4851faf798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#1: Introduction"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 1.1, Page number 1.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of Al is 37.18 *10**3\n",
      "ratio of Mg is 30.9 *10**3\n",
      "ratio of steel is 17.69 *10**3\n",
      "ratio of glass is 25.55 *10**3\n",
      "Aluminium alloy is the best material\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "ws_al=103;     #working stress of Al\n",
    "ws_mg=55;     #working stress of Mg\n",
    "ws_st=138;     #working stress of steel\n",
    "ws_g=35;     #working stress of glass\n",
    "d_al=2770;   #density of Al\n",
    "d_mg=1780;   #density of Mg\n",
    "d_st=7800;   #density of steel\n",
    "d_g=1370;   #density of glass\n",
    "A=10**6;   #area\n",
    "l=1;      #length\n",
    "\n",
    "#Calculation\n",
    "L_al=ws_al*A;    #load of Al\n",
    "L_mg=ws_mg*A;    #load of Mg\n",
    "L_st=ws_st*A;    #load of steel\n",
    "L_g=ws_g*A;    #load of glass\n",
    "W_al=d_al*l;    #weight of Al\n",
    "W_mg=d_mg*l;    #weight of Mg\n",
    "W_st=d_st*l;    #weight of steel\n",
    "W_g=d_g*l;    #weight of glass\n",
    "r_al=L_al/W_al;     #ratio of Al\n",
    "r_mg=L_mg/W_mg;     #ratio of Mg\n",
    "r_st=L_st/W_st;     #ratio of steel\n",
    "r_g=L_g/W_g;     #ratio of glass\n",
    "\n",
    "#Result\n",
    "print \"ratio of Al is\",round(r_al/10**3,2),\"*10**3\"\n",
    "print \"ratio of Mg is\",round(r_mg/10**3,2),\"*10**3\"\n",
    "print \"ratio of steel is\",round(r_st/10**3,2),\"*10**3\"\n",
    "print \"ratio of glass is\",round(r_g/10**3,2),\"*10**3\"\n",
    "print \"Aluminium alloy is the best material\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}