{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3 Elementry Operations in Algebra"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3_5 pgno:33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3x**4/6x**6\n"
     ]
    }
   ],
   "source": [
    "#3x**4/6x**6\n",
    "\n",
    "x=('x')#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convince   poly(0,'a');poly(0,'x');\n",
    "p1='3*x**4';\n",
    "p2='6*x**6';\n",
    "#p=p1/p2\n",
    "print '3x**4/6x**6'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3_6 pgno:34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "val=8*x/15\n"
     ]
    }
   ],
   "source": [
    "#x/3 + x/5\n",
    "\n",
    "x=('x')#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convince   poly(0,'a');poly(0,'x');poly(0,'x');\n",
    "p1='x/3';\n",
    "p2='x/5';\n",
    "p=p1+p2;\n",
    "q='8*x/15';\n",
    "if(p==q):\n",
    "    print\"val=8*x/15 \\n\"\n",
    "print\"val=8*x/15\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3_9 pgno:35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ans=\n",
      "(a+b)/k 8 25 60\n"
     ]
    }
   ],
   "source": [
    "#2a/15 + 5b/12\n",
    "\n",
    "\n",
    "d=60#\"L.C.M of denominators\"\n",
    "k=d;\n",
    "a_coeff=60/15*2;\n",
    "b_coeff=60/12*5;\n",
    "print'ans='\n",
    "print\"(a+b)/k\",a_coeff,b_coeff,k"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3_10 pgno:35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ans=\n",
      "(bx-ay)/a**2b**2 3 2 36\n"
     ]
    }
   ],
   "source": [
    "#x/12a**2b - y/18ab**2\n",
    "\n",
    "k=36#lcm(d);#L.C.M of denominators\n",
    "\n",
    "#\"L.C.M of a**2*b and a*b**2 is a**2*b**2\"\n",
    "x_coeff=36/12;\n",
    "y_coeff=36/18;\n",
    "print'ans='\n",
    "print\"(bx-ay)/a**2b**2\",x_coeff,y_coeff,k"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3_11 pgno:36"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "val=\n",
      "/*x**2/y**2 2 3\n"
     ]
    }
   ],
   "source": [
    "#4*x**3*y/(6*x*y**3)\n",
    "\n",
    "gcd_d=1#GCD of 4 and 6 is 2\n",
    "m=4/gcd_d\n",
    "n=6/gcd_d\n",
    "x=1#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convincepoly(0,'x');\n",
    "y=1#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convincepoly(0,'y');\n",
    "p1=x**3;p2=x;p=p1/p2;\n",
    "q1=y;q2=y**3;q=q1/q2;\n",
    "#val=m/n*p*q \n",
    "print'val='\n",
    "print\"/*x**2/y**2\",m/2,n/2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3_12 pgno:36"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "val=\n",
      "*x**2*y/a**3 0.285714285714\n"
     ]
    }
   ],
   "source": [
    "#6*a*x**4*2*y**3/(14*x**2*y**2*3*a**4)\n",
    "\n",
    "\n",
    "x=('x')#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convincepoly(0,'x');poly(0,'x');\n",
    "y=('y')#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convincepoly(0,'x');poly(0,'y');\n",
    "a=('a')#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convincepoly(0,'x');poly(0,'a');\n",
    "num=6.*2./(14.*3.);\n",
    "p1='x**4';p2='x**2';p='p1/p2';\n",
    "q1='y**3';q2='y**2';q='q1/q2';\n",
    "r1='a';r2='a**4';r='r1/r2';\n",
    "#val=num*p*q*r\n",
    "print'val='\n",
    "print\"*x**2*y/a**3\",num"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3_13 pgno:36"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "val=\n",
      "*x/(a*y) 1.2\n"
     ]
    }
   ],
   "source": [
    "#(8x**3)/(5a**2y) *(3a)/(4x**2)\n",
    "\n",
    "\n",
    "x=('x')#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convincepoly(0,'x');poly(0,'x');\n",
    "y=('y')#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convincepoly(0,'x');poly(0,'y');\n",
    "a=('a')#is polynomial function of degree zero poly(0,'x');#for this I assume it to be 1 for my convincepoly(0,'x');poly(0,'a');\n",
    "p1='x**3';p2='x**2';p='p1/p2';\n",
    "q='1/y';\n",
    "r1='a';r2='a**2';r='r1/r2';\n",
    "num=8.*3./(5.*4.);\n",
    "#val=num*p*q*r\n",
    "print('val=')\n",
    "print\"*x/(a*y)\",num"
   ]
  }
 ],
 "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
}