From c780204350f8d08ea045ce039f993334e5a229af Mon Sep 17 00:00:00 2001 From: Trupti Kini Date: Tue, 7 Jun 2016 23:30:29 +0600 Subject: Added(A)/Deleted(D) following books A sample_notebooks/HirenPattani/chapter5.ipynb --- sample_notebooks/HirenPattani/chapter5.ipynb | 317 +++++++++++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 sample_notebooks/HirenPattani/chapter5.ipynb diff --git a/sample_notebooks/HirenPattani/chapter5.ipynb b/sample_notebooks/HirenPattani/chapter5.ipynb new file mode 100644 index 00000000..2056bd4b --- /dev/null +++ b/sample_notebooks/HirenPattani/chapter5.ipynb @@ -0,0 +1,317 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 : Partial Differentiation And Its Applications" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 5.5, page no. 195" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2*(4*x**2/(x**2 + y**2 + z**2) - 1)/(x**2 + y**2 + z**2)**2 + 2*(4*y**2/(x**2 + y**2 + z**2) - 1)/(x**2 + y**2 + z**2)**2 + 2*(4*z**2/(x**2 + y**2 + z**2) - 1)/(x**2 + y**2 + z**2)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "x = sympy.Symbol('x')\n", + "y = sympy.Symbol('y')\n", + "z = sympy.Symbol('z')\n", + "v = (x**2+y**2+z**2)**(-1/2)\n", + "a = sympy.diff(v,x,2)\n", + "b = sympy.diff(v,y,2)\n", + "c = sympy.diff(v,z,2)\n", + "print a+b+c" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.14, page no. 203" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x*(-0.5*x**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2) + y*(-0.5*y**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2)\n", + "0\n", + "x**2*((0.25*x**(-1.5)*(x + y)/(x**0.5 + y**0.5)**2 + 0.5*x**(-1.0)*(x + y)/(x**0.5 + y**0.5)**3 - 1.0*x**(-0.5)/(x**0.5 + y**0.5)**2)/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2) + (-0.5*x**(-0.5)*(x + y)**2/(x**0.5 + y**0.5)**3 + (2*x + 2*y)/(2*(x**0.5 + y**0.5)**2))*(-0.5*x**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/(1 - (x + y)**2/(x**0.5 + y**0.5)**2)**(3/2)) + 2*x*y*((0.5*x**(-0.5)*y**(-0.5)*(x + y)/(x**0.5 + y**0.5)**3 - 0.5*x**(-0.5)/(x**0.5 + y**0.5)**2 - 0.5*y**(-0.5)/(x**0.5 + y**0.5)**2)/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2) + (-0.5*x**(-0.5)*(x + y)**2/(x**0.5 + y**0.5)**3 + (2*x + 2*y)/(2*(x**0.5 + y**0.5)**2))*(-0.5*y**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/(1 - (x + y)**2/(x**0.5 + y**0.5)**2)**(3/2)) + y**2*((0.25*y**(-1.5)*(x + y)/(x**0.5 + y**0.5)**2 + 0.5*y**(-1.0)*(x + y)/(x**0.5 + y**0.5)**3 - 1.0*y**(-0.5)/(x**0.5 + y**0.5)**2)/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2) + (-0.5*y**(-0.5)*(x + y)**2/(x**0.5 + y**0.5)**3 + (2*x + 2*y)/(2*(x**0.5 + y**0.5)**2))*(-0.5*y**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/(1 - (x + y)**2/(x**0.5 + y**0.5)**2)**(3/2))\n", + "-(x + y)*cos(2*asin((x + y)/(x**0.5 + y**0.5)))/(4*(1 - (x + y)**2/(x**0.5 + y**0.5)**2)**(3/2)*(x**0.5 + y**0.5))\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "x = sympy.Symbol('x')\n", + "y = sympy.Symbol('y')\n", + "u = sympy.asin((x+y)/(x**0.5+y**0.5))\n", + "a = sympy.diff(u,x)\n", + "b = sympy.diff(u,y)\n", + "c = sympy.diff(a,x)\n", + "d = sympy.diff(b,y)\n", + "e = sympy.diff(b,x)\n", + "print x*a+y*b\n", + "print (1/2)*sympy.tan(u)\n", + "print (x**2)*c+2*x*y*e+(y**2)*d\n", + "print (-sympy.sin(u)*sympy.cos(2*u))/(4*(sympy.cos(u))**3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.25.1, page no. 204" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "r*sin(l)**2 + r*cos(l)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "r = sympy.Symbol('r')\n", + "l = sympy.Symbol('l')\n", + "x = r*sympy.cos(l)\n", + "y = r*sympy.sin(l)\n", + "a = sympy.diff(x,r)\n", + "b = sympy.diff(x,l)\n", + "c = sympy.diff(y,r)\n", + "d = sympy.diff(y,l)\n", + "A = sympy.Matrix([[a,b],[c,d]])\n", + "print A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.25.2, page no. 204" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "r*sin(l)**2 + r*cos(l)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "r = sympy.Symbol('r')\n", + "l = sympy.Symbol('l')\n", + "z = sympy.Symbol('z')\n", + "x = r*sympy.cos(l)\n", + "y = r*sympy.sin(l)\n", + "m = z\n", + "a = sympy.diff(x,r)\n", + "b = sympy.diff(x,l)\n", + "c = sympy.diff(x,z)\n", + "d = sympy.diff(y,r)\n", + "e = sympy.diff(y,l)\n", + "f = sympy.diff(y,z)\n", + "g = sympy.diff(m,r)\n", + "h = sympy.diff(m,l)\n", + "i = sympy.diff(m,z)\n", + "A = sympy.Matrix([[a,b,c],[d,e,f],[g,h,i]])\n", + "print A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.25.3, page no. 205" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "r**2*sin(l)**2*sin(m)**3 + r**2*sin(l)**2*sin(m)*cos(m)**2 + r**2*sin(m)**3*cos(l)**2 + r**2*sin(m)*cos(l)**2*cos(m)**2\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "r = sympy.Symbol('r')\n", + "l = sympy.Symbol('l')\n", + "m = sympy.Symbol('m')\n", + "x = r*sympy.cos(l)*sympy.sin(m)\n", + "y = r*sympy.sin(l)*sympy.sin(m)\n", + "z = r*sympy.cos(m)\n", + "a = sympy.diff(x,r)\n", + "b = sympy.diff(x,m)\n", + "c = sympy.diff(x,l)\n", + "d = sympy.diff(y,r)\n", + "e = sympy.diff(y,m)\n", + "f = sympy.diff(y,l)\n", + "g = sympy.diff(z,r)\n", + "h = sympy.diff(z,m)\n", + "i = sympy.diff(z,l)\n", + "A = sympy.Matrix([[a,b,c],[d,e,f],[g,h,i]])\n", + "print A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.26, page no. 206" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "x1 = sympy.Symbol('x1')\n", + "x2 = sympy.Symbol('x2')\n", + "x3 = sympy.Symbol('x3')\n", + "y1 =(x2*x3)/x1\n", + "y2 =(x3*x1)/x2\n", + "y3 =(x1*x2)/x3\n", + "a = sympy.diff(y1,x1)\n", + "b = sympy.diff(y1,x2)\n", + "c = sympy.diff(y1,x3)\n", + "d = sympy.diff(y2,x1)\n", + "e = sympy.diff(y2,x2)\n", + "f = sympy.diff(y2,x3)\n", + "g = sympy.diff(y3,x1)\n", + "h = sympy.diff(y3,x2)\n", + "i = sympy.diff(y3,x3)\n", + "A = sympy.Matrix([[a,b,c],[d,e,f],[g,h,i]])\n", + "print A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.30, page no. 210" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-1.0*x*y*(-x**2 + 1)**(-0.5)/sqrt(-y**2 + 1) + 1.0*x*y*(-y**2 + 1)**(-0.5)/sqrt(-x**2 + 1)\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "x = sympy.Symbol('x')\n", + "y = sympy.Symbol('y')\n", + "u = x*(1-y**2)**0.5+y*(1-x**2)**0.5\n", + "v = sympy.asin(x)+sympy.asin(y)\n", + "a = sympy.diff(u,x)\n", + "b = sympy.diff(u,y)\n", + "c = sympy.diff(v,x)\n", + "d = sympy.diff(v,y)\n", + "A = sympy.Matrix([[a,b],[c,d]])\n", + "print A.det()" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} -- cgit