{ "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 }