{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "

SymPy: Open Source Symbolic Mathematics

" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from sympy import init_printing; init_printing()\n", "from IPython.display import display" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from __future__ import division\n", "from sympy import *\n", "x, y, z = symbols(\"x y z\")\n", "k, m, n = symbols(\"k m n\", integer=True)\n", "f, g, h = map(Function, 'fgh')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Elementary operations

" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHAAAAAzBAMAAAC9ApG6AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIom7VJlmdt1E7xDN\nMqsI8sYEAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACiUlEQVRIDe1WPWgTURz/3SXNXXJNLhQp2ikt\nBIsfEKgKImgHpYvQFIkOVsyk61mIERRTXUQXQ0GcJMXJr+EUoZNJBgeHw0YQHJtNUcRUKirBnknu\n3uX/LnchdLGDb3m/z7x/HlxywKArN2jQnXvnFrYtv1+HmPvwlcw3MnGAMF+4t4mrsertri+kMZvt\nUj8kvFxEbZgGpQ2oi35xogc0QI0TIfwYlSrhfrDyClhDjbMHGRUnRaExiQQtKjeBgmmaP6jI4Rf5\nOZTHlY9LCzrRhcmzEPfPjF6iX4D4QPgGRjiBkT3F9xiX+PGZ197HppVzlDs48hRIxegUjtUBny9e\n9jCFOAIbiNZlPkzZJiUOVpvt4lBW9fhQO/TdCVMQSUFeR0VXi1Tl8ENA4oQOCWUxq+EKIolez1au\nQZnzMO9lDgOHEPMvSmcuePS2gxTUtjjF/6Jzca0nmK1GSxQN480zw6i3faZ77u2Aa/37W00e9H/i\nuGFdo4rxWJXzfYmrKMej635ZITNV63ruYlH43TV5VIZIPCXOuwg2XYJDvwBPHNILZM3SZnqsR8A3\nMqvbT9pCb3FV71cMpX2LLeOu7j6nxVeu71rQsIQHlmefqOQ0jLF42Ou3U0mEbsnV6OvjR7iiGFxG\ngR0j1xkiu6iLzWA8YpoNS7RP3DFUxRSLZRigu4LhlMP3GcYdw3jb4npEw09bl9JOgAOqRim71ZIe\n/WPrJ9D67/FYazUqsuI8pGVLj6YheRSDegGS3q2y4lEE6pa6cyL5qes7qDR9DKMOA1jxFEpZS141\nzV8kwGA5v3LaTnQkVizvPu8xH2t57KwIzHu4faTnlherKuRZ6pN3W3K2/Za1hRXOt99B/gKXcLQk\n1LMH6AAAAABJRU5ErkJggg==\n", "text/latex": [ "$$\\frac{3 \\pi}{2} + \\frac{e^{i x}}{x^{2} + y}$$" ], "text/plain": [ " ⅈ⋅x \n", "3⋅π ℯ \n", "─── + ──────\n", " 2 2 \n", " x + y" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rational(3,2)*pi + exp(I*x) / (x**2 + y)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAACkAAAAPBAMAAACLu/vuAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMlTvq5l2Zoki\nu0Rn3bgMAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAh0lEQVQYGWNgQAOM3asdkIRYE8EcpgBGG4So\nePtHMGcZA8MmhCgDJ0T0OgNDvABCGCr6nYHhfQC6KOMPoOgEdFGe3wwM/hswRIFqgaJCxiCgwgC1\nDbsJDEDb4jFsY7jLwLBeAN1cBqAvmhCCYHPlFRiYAxhTEKIcZZ+qGJgLGBh3TndAiKKwANhYJhGy\nykcOAAAAAElFTkSuQmCC\n", "text/latex": [ "$$-1.0$$" ], "text/plain": [ "-1.00000000000000" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exp(I*x).subs(x,pi).evalf()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "e = x + 2*y" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "\"Add(Symbol('x'), Mul(Integer(2), Symbol('y')))\"" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "srepr(e)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgsAAAAPBAMAAACYf5HCAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAIpm7MhCriUTv3c12\nVGZoascqAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGDklEQVRIDe1WXW9UVRRd83HnTjuf8kLQRMZR\nKIYYqgSjJoYJiZL4wg0PED6Sjo1WUWwnhTBRCZ345kdCCWJAg1RJ9IGYNkHQB4RKVGIgYWIMxhd7\nfZEQCQWhtFjace197sy5Tzo/wJt2zz5nnb33Ouuec+5BpLiyBLi7d8J4p7w1dSysPo34Z13VKoB4\ngYaPgVE9V2JjDeB0XS7hud5qtaLR2HpuWSuGcKS6oy5hTteuvDFYX30eIdMOEuK0fs/OcNEwwrxN\nts2KSkfqw3ip7+OPmGmatrA1nnNhsAZsgDsD52ssNx6ONKYRKWDCzzYajdvM0tkNZA4EA7GlFh1j\n51EgVXc+wSQHlTUaBSTqzRjCC5CZ50Bs8iP7jHE+xqK8NW0hyk454RtszoeKWkRTBpWFqFZUOsCv\nHozX0WhUzDRNW9gaLwq8BrwIHEKsgJXGw1fb80jPITcSzQNlzuPHbmxYOh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GhxPN9PUNfDBusgvMb3R25lJf353tvGhg0kNP\nWa8GkzXZQf0aY2Dus6YMJ4WgmhRHwxrT+a9Ii1OsG9mpUFHlrWxNSmHbkuGkbpF+/WAaYjw3V3g6\nTW1bw12NhC935XR+Hc8G40XljXd0o/MG4tyIfNhQGXRgnGfDMDv36/VpOYUs8F+iKS0ebcYQ5t8o\nu3AlH79hTHYf1uWtaQvRosopOwzeX6+A110tGkIkb1BZvhRa0dCRe4PxSPNYiKh2GoSrIZbHvdXB\nV5CoOIeNFykwTdbHxDgyRoZcIIMOxEvYVOfkblKtuvM+9wXza3TyBLKtGMLXkLnLSxjOe1t8Y9In\nnNOwpi1EiyonfIFNpVBRi2jKgK3IoBUNHZHBeAvAF2CJaqdB3vVwlV+zRoMnx+DSUuAt2LUEeKv4\nBO+PhzlfuKtv+9Fts/0B7BZfYOeOBtf/7h9KwCIRRaLxbNeyZozAyeKDNTnM3SK71WCwWOPYlmkH\nMeyU08YLrGyLhhBNqWyVqCmmdJYeOekHxLp6vTBRhdXEewdJ6/9HFPgHtOKAE7Wy7HoAAAAASUVO\nRK5CYII=\n", "text/latex": [ "$$262537412640768743.99999999999925007259719818568888$$" ], "text/plain": [ "262537412640768743.99999999999925007259719818568888" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exp(pi * sqrt(163)).evalf(50)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Algebra

" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAASgAAAAYBAMAAAC7JH0zAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEHarIkSJZt3NVLsy\nme8Q6PJIAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADQ0lEQVRIDZ2WP2jUYBjG36RJGu9PDS041rSC\n29kqInYy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jn3VkFSNibt3h96ZU\nuJ+oxYUcIOuQyj9dzQR3q8U2BQAAAABJRU5ErkJggg==\n", "text/latex": [ "$$x^{3} + 2 x^{2} y + x^{2} + x y^{2} + 2 x y + y^{2}$$" ], "text/plain": [ " 3 2 2 2 2\n", "x + 2⋅x ⋅y + x + x⋅y + 2⋅x⋅y + y " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "((x+y)**2 * (x+1)).expand()" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAALYAAAAqBAMAAADserwPAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVO8Qq5l2zWYiRInd\nuzLEnmxuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACk0lEQVRIDe2Vv4sTQRTHX9i7/Nr8ECsLi4MI\ngo2LHHeFIOFA0SoWVwiCpNBTsLggQlBEt5Or3FLE0/sDBNMoYhUbK8FUh1aJFrYR7sRS5715M29/\nZOWQuS5TbN77ft98dnZm8xbgUEehdQj4owFCl9f3nLO98x1iQ9E9G2Bzzs6c2HxPMlsyf0+yW8J7\nsrj2+6I2K+GMIpKMU45mVWxlxfXTd8OEup3Ivncltc4l0SRamHlH8TG6l0inA0mtsyqajrCJer20\nmsnLlzMSC+L43WSNbqJvWSykXKmt5T6aON6S1FNETfQMi/ns58lpLyY2jzn3ragDYpd2dJLPvqEK\nVq4/u90F+HHsZmXcbty5tnEBZ8WcN5jHBrF93s189hd1KoPyx1oPvBHUoNSG2i68xI0SBx7HuBgS\nu9zTaj77A4Af+HuFCKotKEK9DfUlaIZqmjhwXFPsldiFoc7T7D800Dul1g2lEYafdyNi96DZTTpT\ntFc/4XiIIbEbP1Xk9/sPTvb7bVQFipkaig2aBWcf/SL2yLKNQ2ws5CFsJaTXbYroyQGmEyVUAniy\ng3vCbLUn7MArDGOD2NWhVvLZ6sQKwSYUA7z/Qhhji/O/Z6ler9dHxvBU3aIF9Ugt2qxbHLgaWzOG\ntO7FgVbz160ed3lj5UoIUH13632js3+us/9tfEJNEwfoADUJr7qJliYY/2u/5Z+tK+UqTmUoqkTm\nf5u/bulIMktH4qR7lfZNr/Ki9Eybf7VROrBOpsdi5QF6LNgvQBotjr1JvKSev1xbZr5cVrCBcQ78\nTeOZ3Posx0mgodz6nBAthKHc+qzsJGCoaX1OmAZioc2ukRz+MpRan0MsoQjKrc8tm6Hc+tyyGcqt\nzy1bQ/8CPM/Bf6x38foAAAAASUVORK5CYII=\n", "text/latex": [ "$$\\frac{1}{x} \\left(x \\sin{\\left (x \\right )} - 1\\right) + \\frac{1}{x}$$" ], "text/plain": [ "x⋅sin(x) - 1 1\n", "──────────── + ─\n", " x x" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAADcAAAAUBAMAAADbzbjtAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMnZUZs0Qu91E7yKJ\nmaurDqYVAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABKElEQVQoFWNgQAdboALeUJpxEUIFdwGUzbcB\nwmD8g5BkhYoxsAUgBGEsXxiD4RCcBWd0w1lZEBa3IFyEuwHOZJ3AwKjsFLD9H4PoWiE9BaA40wUG\nBjal15OAZvJcYEhnYGhgiGNgaFfg/g2UZHdgYMhh8FBoZWBgCWCYlcCgwFDHwFDFwPAFKMlhwMBw\njOF8gjUDA3MDA8d3bQaQZCkDwyegJNcEBoYEhnAgi4HxAwPb0f8XQJLlCEkICyS5jYHlJ5IkyFgG\nxo8gnZwNDEYMDE+QJEEOMmP6wKAGdpBVAkM1yEyosUD3c35m/8ANVMN7gGGOk88Euf/P5P4/NP/1\nAGwW2yM1XRegsawCQAIVIIJvB6oEiIc34Nk3QDVgizJ4ZMNVIZuOlEwAI5NHdFwQnx8AAAAASUVO\nRK5CYII=\n", "text/latex": [ "$$\\sin{\\left (x \\right )}$$" ], "text/plain": [ "sin(x)" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "a = 1/x + (x*sin(x) - 1)/x\n", "display(a)\n", "display(simplify(a))" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJEAAAAUBAMAAAB/i8J7AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAdt3NMolEECKZu6vv\nVGbHkCAIAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABS0lEQVQ4Ea2QO07DQBCGB0fOJsqDKFXSWQZE\nkQZFdDS0dG5Ci28QcwIooQClhpYDUFNEOQYdOQISSK6Q8T7jmZ1tEG525/t/f14vjE/hH57hPIfL\nnef+6WU3kJ3O3ggFsDxumsQrXOVeVQOTrWnsODL1CuhvaNXMocxxZOon0PsOmEKZ48jUKsOmUOY4\nMtXHicrAmVQmpiMmjkrJqWmZMVWDllnc3jCx5tQ0Y5oWzeChe2KHxqq5Mol5Wj8H5wDdVaOhtigr\n9pm/q9+RnJxpSkWNWWYfRQOYreHYNFjBnV/VRGVnwostx6YLgIlXNUBm4if2YsuRqXO0eE7El1eW\nQGXtz0e4wZfuODK1qqpKIGXuAkBn6y1Ex+hLjiOTrgxuUdUb3j2iAGPyrwK/muHRTozp2mb8KkY8\nZ0xbvmnp0G7IWpvGh4T9adxL81/GzloKe1XQjgAAAABJRU5ErkJggg==\n", "text/latex": [ "$$\\left [ -2, \\quad - 2 i, \\quad 2 i\\right ]$$" ], "text/plain": [ "[-2, -2⋅ⅈ, 2⋅ⅈ]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "solve(Eq(x**3 + 2*x**2 + 4*x + 8, 0), x)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIMAAAA9BAMAAAB8c8dQAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMARM2JmVQidqsQ3btm\n7zKsjR9xAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADa0lEQVRIDe1WTWgTQRR+22w22c1mExChF20I\nlHoottiCHgSjBHpQbATFm40HBb2k0EqLUAgtUvzBhh7UCqURvBQsKVIQqWBFBUFaA0Wlgu16EMFL\nGsXWSus6O/NmkyW2Yd2Lh85h3jff+943k9nZ2QDQJkRZdNO3uilmtfXuLVZcWwirvRmXJr5xX8yl\nRaBTjbi0CIbFtEuLUCaYcGmhZF67dABtoNmtxXb9f7QDTUaprTpZV+sUfzM7DJ0Wjpx9tbThwMKT\n9EdQ7jeyvFDN4Sn/xJktopLUVsDHBLmfllCMUKhNWszmQAlLRRDSVFAwZizhcYpq8Ee+mOuJWalK\n4F0DOEhp1SjdemxhbSh/tg7vKistRukEUNhsT39ZLAUScZfi07p0OwsE2ltLl84J89bHy27UiHGW\nRg8Z3gFPEfydQt6WARgO434BqEQG0jIVCMYPm9C8fa4CfISgLsZ0ljqNiikITCLcAbsJesBGhzYy\nSNNQIKMPAEN6CpSdOsughVDaNq3+1GOSO8ryNUaEAdbPktCUIRa14GM7DoAWgbwlDBrGMhn0MUJe\n+m5lCDjCBrnypaFFaO/+wyAcON8zyAvqUNVhhDlF4jTFgs0WLcYaIZgQA49gLIkFBZ0B0VhAxgx7\nKFbSNGDHLdZAXPisRCClYyLFJ8+VT3mfZuOoIWFfNDoRjZrOoSyoxcxYGN7wbCqBKDXOKRLpKvDM\ncBpXQeZX16EDoJ8nrFX0JTlFIrU4CVI5hxb+PFmFud/rMhYUUCX8RoKG66TXYuDDJOXQQiN7kYd5\n8K55KA3An0iB/yDKm4/6YkvrNRTRgBYwAKMJ8pJ7InOYNQ8RafJ7FrE3jcl1aHv5uIUnfhOELEg3\n+KT8dKZtFsGwbUgH3KIi08CYh/aE2Gwfm6NblRRlZHYbeEpP1GvyWn4T/V9oNU3J2aSVe0nRFWtc\nFSi6KSl7onjDDFettATPKbKOKMjtMcp4WaB4606aNPPyPFedG8KvEpzgVLUoZkxFzbcobRPku2g7\nCtXKS/n20ifVWC3R22h7B1zugHrsSze3kNv6dY4dRLVuJpj0m0e8Ee7q5hfZcbtwGUK8Lg5fHdeb\nBYOwi9e9hV4OHcVFiGv0hzTIK/BkxFEtE5N/OvfOYN2iVpz5BwshDV28rvZSN4cOnP4A6W7eHL8K\nMbgAAAAASUVORK5CYII=\n", "text/latex": [ "$$\\sum_{n=a}^{b} \\left(2^{n} + 6 n^{2}\\right)$$" ], "text/plain": [ " b \n", " ___ \n", " ╲ \n", " ╲ ⎛ n 2⎞\n", " ╱ ⎝2 + 6⋅n ⎠\n", " ╱ \n", " ‾‾‾ \n", "n = a " ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a, b = symbols('a b')\n", "Sum(6*n**2 + 2**n, (n, a, b))" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAJQAAAA9BAMAAAC5AV3BAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMARM2JmVQidqsQ3btm\n7zKsjR9xAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADZ0lEQVRYCe2XT2gTQRTGv03S/OvmD4rQizYE\nih6KFVvQg2CUgB7E9qB4s/GgoJcUWmkpCKE9FEXs4kGtUBKPPZQUKRRRsIqCINZKqVJBuxdRvLRR\nbI20rptNZmdms7sjeJ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U5ErkJggg==\n", "text/latex": [ "$$\\sum_{n=a}^{b} 2^{n} + \\sum_{n=a}^{b} 6 n^{2}$$" ], "text/plain": [ " b b \n", " ___ ___ \n", " ╲ ╲ \n", " ╲ n ╲ 2\n", " ╱ 2 + ╱ 6⋅n \n", " ╱ ╱ \n", " ‾‾‾ ‾‾‾ \n", "n = a n = a " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sum = Sum(6*n**2 + 2**n, (n, a, b))\n", "sum.expand()" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIMAAAA9BAMAAAB8c8dQAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMARM2JmVQidqsQ3btm\n7zKsjR9xAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADZUlEQVRIDe1WTWgTQRR+m2x+drObBDxrQ6DU\nQ9FgC/UgNGpBpWLjQfRkI2jBUwotKkIhWKQHRUMPgofSFD1YsLRIQUTQQBEEqQZ6kF5sBMVjrNLW\nSNv1zd9mUlNjsh48dA55b773vW/+XmYHgDYlyqyT33YnySy32bnEqmMJZe1axqGIb9IXdygR6Dci\nDiXMsJp2KBHKmAmHEnrmjUMFCA7HnErs5P9HO7DfKre1eubVPiv+mb1WgSbev/B6aaMOCXfSH+F0\nv5UVicY0r/KPAvmD1ZPBVfAxwvQPm6hGqBucsZHtHT3sXQYlTQlFK2cTT1HPxRZpnPwyaEeqOJ4S\nwCGKG1b51mMTO8b4RlPOTFZJFZDeD6Cz0V7+FCCzXlS/2P0CLl+HEGNI8baBguiRW59fdmNWXKDU\nuuOgpaEzDCOwuyKAndEw3y8AI45971fKUKwVasUP3j7+DJh5+ABdQQ6e5XYWAjPc3QV70HvMep0b\nFfMtYn4W/Js4wsR5zucSSnnbgs1nnmGwmxFcVoQzqZkHcJVQAk9sIMcDXCKQt4mmZZFFDDFAW/pu\nR9A5Qjs6bmq5cYnQvo7DoBzsuzoiQk18Ab1WWEBon1O/KSZBwCXGW8FMqIGnMJ7k0WKBOaq1yBFi\n9lL/kYSALVECdfGzHoFUgYdTYvBpeSUPSVSNcw6aA9HoVDRKlENZMJYz42F4J6KpBPdSkwJCS2ex\npbT5QnB8Yx16AW4Ivj2LoaSAuIQnDn0SJBbiz+MsyH6vazxaTDJH2ZTpt7DzCeCKjPFZBHEv8rAA\nnpKbR8WJFMWCKI5H7X3QdjxbRQKGYSyBf3J35C2PYhGRpr1nlv+isAsvw6wM8lmAu+sOKFnw3haD\niupMy2wwxTlJqJCQIOa2MPOkMqDGKvukd+93iCIaq2F3+UQ9BA/mt+FXgY00BeeTduwV9W7a/ZqO\nXiAU6UQVNv5ozUybMEc9u0RB64lTBOvqL5t3hhC1BUG/dJd/leC0gGpZNUMYrm9R2qawFLbcw7UE\nRLyn/Em11gS4Y//BDvg6Yk5V5uCcU4mJKp/h+jS1TfxI1JdC2dI7BB8+eq4RCfIO8ZMSb8W7lbw6\n6m7SOwRnYTYiIb1DcC9C4brngAnkHUIX0gINnoj8DhlsrC7kd4j76IkG1vELFQnZ2OgI2eoAAAAA\nSUVORK5CYII=\n", "text/latex": [ "$$\\sum_{n=0}^{b} \\left(2^{n} + 6 n^{2}\\right)$$" ], "text/plain": [ " b \n", " ___ \n", " ╲ \n", " ╲ ⎛ n 2⎞\n", " ╱ ⎝2 + 6⋅n ⎠\n", " ╱ \n", " ‾‾‾ \n", "n = 0 " ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_sum = sum.subs(a, 0)\n", "new_sum" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIMAAAA9BAMAAAB8c8dQAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAA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asJfcuu06dc15AiDWHY0ZLx/pu5IEzDFLfOIgtKR4BE8V1sU/xwDKv0Cfu88fZXglgjV\n0+4SQ7i+x7l04VFYdw/XIxD5juonVV8RwW39D1agaSzvlGUKrjul6N74DW2QUlnAj0SDYxjc0kRg\n1yIX7VCwJsLDjngr3q2sZWhYLE0EVuGzQ2FpInAtwlrDNeAA1kTwibSAzR2xNhEj9s6FtYkIHD1h\nYx6/Ac2l52PgFAokAAAAAElFTkSuQmCC\n", "text/latex": [ "$$\\sum_{n=0}^{10} \\left(2^{n} + 6 n^{2}\\right)$$" ], "text/plain": [ " 10 \n", " ___ \n", " ╲ \n", " ╲ ⎛ n 2⎞\n", " ╱ ⎝2 + 6⋅n ⎠\n", " ╱ \n", " ‾‾‾ \n", "n = 0 " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_sum = new_sum.subs(b, 10)\n", "new_sum" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAADgAAAAPBAMAAABD1xE4AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMpndu3bvImbNiRBU\nq0Qb3U6NAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABOUlEQVQYGXWQsUsCcRTHP3ee3nFeKv4F1liL\nQ1MkuBfR0tDW4FbU0RQtutR8gy3RYBQRQhBFDS72D4Q2CC6CBP0DUUne1fWezr3hPX6fL+/L730B\n8nDYXIWT2/yTUZpvNoVxd32ug0XsAp0ae/EYJ47jH4Vn3PsykhWSEdkipz0fU0hXoLOFG8g8qJPZ\npR1MoAtuTqDVxQtlNurS1FY3pN60ZbtkIjHwVUwvQf9oVnlZW7tA5hMeENG+WIAVqkNxralYbWCM\nxVVFuBpKs4qyoy+qBRW93FRMbQsyR7A5Eae2LUS0faxoJsD91au15ENexPNg8NXLhiKmAsyQ9CQC\nrDKOnkKFVJnEyIREgPGuSEMwNQQ+cGp01iXDYx9PxPQ3LPOoYVzGfV7n1mD/Ru6xdwSVoLXxoov/\n1x8exlr8ZGJ8wgAAAABJRU5ErkJggg==\n", "text/latex": [ "$$4357.0$$" ], "text/plain": [ "4357.00000000000" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_sum.evalf()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Calculus

" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAB0AAAAqBAMAAAC9wk0pAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMlTvq5l2ZolE\nuyKPVsvzAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAg0lEQVQoFWNgwA3CBJDlGCvqUfgMDPMHN789\nX30BsgcGhi1kDAIqDAz/QeADLR2xe7YDsvFCBzgUkPk3GHgvIPF5/iFxgEzeBFQ+v8rOHmQReS0G\ntgAkAfmPDByJSHx+AwauP0h8ZgUGrl9IfPYEVHkWoP4EJHmGagYxZPMZuDtKGBgAryghjPEQrtEA\nAAAASUVORK5CYII=\n", "text/latex": [ "$$- \\frac{1}{6}$$" ], "text/plain": [ "-1/6" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "limit((sin(x)-x)/x**3, x, 0)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAM4AAAAwBAMAAACrqVieAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAVO8Qq5l2zWaJ3SJE\nuzID+9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xY\nzOpAjNPvAIYPsgDnWVOeFSgwyIztYoF6b9bmycziPMpQEbOSFGuKb6+tqpOf9IgGl81QRxVjoO4G\nnWGBpky5fHmRrp4oS6D35yZUALi1HXw0JVPCR+wvFMPlljEicxxQT0UzSREqldkSPrDNmDhtBJZ4\nzvEZUGl0+2KlhYScoV67IbaGD62EjlHJlPTRe5cIvAmnDqgIC9x8kk425BupCXj5CAl4Ye9ElK0t\nLd9a7eVNsnissP94LZmaUmKfWpKcYPDx7Y4xW5Epf2zVzZJ+/Fm299GUe3ntkN9s5f/d/x92Igne\nI1si4AAAAABJRU5ErkJggg==\n", "text/latex": [ "$$1 + \\frac{x^{2}}{2} + \\frac{5 x^{4}}{24} + \\mathcal{O}\\left(x^{6}\\right)$$" ], "text/plain": [ " 2 4 \n", " x 5⋅x ⎛ 6⎞\n", "1 + ── + ──── + O⎝x ⎠\n", " 2 24 " ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(1/cos(x)).series(x, 0, 6)" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAASoAAAA4BAMAAAC4fag4AAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMpm7du8iZolU\nq0RaI+fpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF8ElEQVRoBcVYXYgcRRCu2Z27vf25vSEPRgnB\ndSP6ohDjz3k+yBJEfYl38SGCQRgFRR8kk4dwkRiMoojgz4oYgg/eqkiMQVgDR4iCrqBRIXin+BuM\n7oOgECQbuURjftaq7unp7vmfvVULbrqquurr2u6enu8aIKvM329lTYmIL2/a6OvJjG12OUK5OV4D\nx4c2mHkIvuKJg2Pf6o6cb5pn4PfByvBlTcF0k7kGx75MVNUtXoByyzfAQObNMNdlibHY5kw0+Ihc\ntMpJg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wq\nmitXZdrgc8XSB3ww8uWvSiHP7jVCFvRwYpYFARj5Uqr6FrMFQyOgtO+gMmgEMVMiElVGvnD5xAri\n+eQxNEqW51cilAjw7mmEI3tL5GtD/8sN/a8P/7WI6Tg3hmBohJbybFcH9u5pVOfy9LGunn+lbqaz\nFlIevRyt8ngi6khbCzEksdH88QYSsxSCW5pk9T3JY5i7KNKTEq1qQAT1D3TAPnIpbCgYIT1uVVBI\nrgp+lGmo5RuayY2iHeLkrvEmtkTMUkiWqlZoePs1yzVyNHRQaH8YNXyH+T1NMIA87PqFd2WpqjKj\nwIXPij4XFYcn8P1xEMC9p1FgpMqvX7idpSr4QmLAiKUYnjrlaaSIqvj+uBjAvafRgoShXr9kqkoA\nRLbFtVqXXlWuq3X6De/65UC9fmO9zr66aXa7Hydo0/89CjHUq0p8/+T1y3DnarSlEUO9qlIt+DM0\nz3RDmMOtKt/RiKFeVUVfXlGBaNUrkuFWRR8lQQzL9fqaJ+r1RRqV7Q+zJwoIbdXrl+FXpRBDfa4S\nqlKvX9yqRr7/42joL8jmpBVUblX1qqrxK6iOJOZK9Q2u025XiKFeVeJul+NeItUhaPjyq8RQr8rH\nOYYwXEoIXCSVGIqq+P7INVKiDD0s4ovDxnlp6KOlBdS/zkZTzcOv8/8ko1odWhFGTTP/SyOc37AK\nYgr+1ytMYMhs/H8Al1ETwXUw3dcAAAAASUVORK5CYII=\n", "text/latex": [ "$$- \\frac{4 x \\cos{\\left (x^{2} \\right )}}{x + 1} \\sin{\\left (x^{2} \\right )} - \\frac{\\cos^{2}{\\left (x^{2} \\right )}}{\\left(x + 1\\right)^{2}}$$" ], "text/plain": [ " ⎛ 2⎞ ⎛ 2⎞ 2⎛ 2⎞\n", " 4⋅x⋅sin⎝x ⎠⋅cos⎝x ⎠ cos ⎝x ⎠\n", "- ─────────────────── - ────────\n", " x + 1 2\n", " (x + 1) " ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "diff(cos(x**2)**2 / (1+x), x)" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEwAAAAwBAMAAABJWYGiAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEM3dMiKZu6uJRO92\nVGZ6zyUAAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABSklEQVQ4EY3SP0vEMBgG8Lemlca2tji5KdVV\nbvAD2C8gFNyl083noptWXG67G7TgdoOLqy6CS0GcHFzkJoVDcFdEUZeYXOpgKenzLs2fX5+8pCVq\nrWI3ajVEPHWXAcZS+wNhI+cHYETBG8RYCbECUvMZxM7pDHD22tOOmd0LIT49IV6NjB8/bt+mRqI2\nN+nET1qVBD0X+ep2zpCw2UmIpC1F4QiIuyFvCLB9cuvM6e4lwJuLxJG/75DoWqcFpSH1kmiQTPeN\nrBNBTAZt6Ls0phHNfeueWhjLDWxhXdWqFF2leByvXMRxrsbyp/wrNdXlZ9XAfOiYnHQKjczOyAfY\n1mlxpE81pnWEeAdY1b98/E+TzTSXpVusNlmvWdVW7yDmPEOMz0DsBWJWCTFOEHuAmDWEWNDvD67K\n2k02Tj3oQiiEGD/4mjSe0rj4C4roUsUQBV2ZAAAAAElFTkSuQmCC\n", "text/latex": [ "$$-2 + \\frac{\\pi^{2}}{4}$$" ], "text/plain": [ " 2\n", " π \n", "-2 + ──\n", " 4 " ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "integrate(x**2 * cos(x), (x, 0, pi/2))" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAL4AAAAvBAMAAACvYG1IAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB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qpVE+sIMwRzwF8Xs1UZ4gJF/GiILHuFwtlJrCJvSNMa8bx\nchNTnSEspWpwvOyklJkpzitkO0JMgJvpYMtYARrvHh3JwTN46QbhKSfWDYMKlxZn4lr0xvsBT1g3\nyQ0Z2Ai8ws/KqlCplNxAPOVsUeADcCBlPaHcJ582vgd0p/gh3DfjihjL+8GOH7MyhLUJWXkAEcWX\nFfqhpy09Xhi0+v0/r1I/8qhTrx9t3JDxRPwH9iL7EkUxKxAAAAAASUVORK5CYII=\n", "text/latex": [ "$$9 f{\\left (x \\right )} + \\frac{d^{2}}{d x^{2}} f{\\left (x \\right )} = 1$$" ], "text/plain": [ " 2 \n", " d \n", "9⋅f(x) + ───(f(x)) = 1\n", " 2 \n", " dx " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUMAAAAqBAMAAADbkSQSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAEJl2IquJVETdZu8y\nu83OyatpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFG0lEQVRYCe1Xa2hcRRT+bnKzz5vNJa3FIm3X\nYAsq4jax9YdIriLFNpTEGEWq4DZKMIjtan0gIlkUChLBqKkiolmaItgfEm1/BF8NSv0lJkqLomjX\nR/GBrpu+EmtqPGfuzNzHxmBohAVzYGe+c+Z8M1/m3Dt3AizZ+e3AY/b58f9zttF5Z7VLBFqXJC7C\ng7C0i4uwiUvP4mJs4tIu/i93cYv8q/ct8K9XPEFbKNks+FZLOD7HhWsPHS8I1NjswJxwg6hzJPB1\nxrW3bDOzOmAd0JB5Zs99ORmYgxziekxGW4FNPZ+rWJcClf2tfTmkHBk3ipUJ1xQQvbyg49YZDZl3\nPaJnZWAOcojrMRn9ADONvoIMrpZ9ZWdMXwjs1fG7NFJg1bOErnSUG+iJ15rDHyqmyNGMjMzHRSKN\n2ik0D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310\nREMPeDwRU2TD8VIIWT8+8mkg4Dru3uoBfY1YLkPG22hz6DOxUvj1BIXNcZ9yB8xLT2dkjq/TvHnJ\nSfd48/FceCQQWR3wyKkbQV0aGL5EDOgrbXDNMKnC1zwxskAyX2l9FhRMAw1FRMpeAr9RbPvc7l+3\niicICyXzCaIt4WgowZoJ1IqzOjxQPX6SdpGPxCo2qnKKLyvVbN/jYXGfrmKNiZaPqvxZpM2r429f\ndVuqo7r1JQ5i3KluibXfGr9Ut0K6rTXlgb8BP/FbjnM/L50AAAAASUVORK5CYII=\n", "text/latex": [ "$$f{\\left (x \\right )} = C_{1} \\sin{\\left (3 x \\right )} + C_{2} \\cos{\\left (3 x \\right )} + \\frac{1}{9}$$" ], "text/plain": [ "f(x) = C₁⋅sin(3⋅x) + C₂⋅cos(3⋅x) + 1/9" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "eqn = Eq(Derivative(f(x),x,x) + 9*f(x), 1)\n", "display(eqn)\n", "dsolve(eqn, f(x))" ] } ], "metadata": { "kernelspec": { "display_name": "Python2", "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.12" } }, "nbformat": 4, "nbformat_minor": 0 }