{ "metadata": { "name": "", "signature": "sha256:6fe4293941bd8b2ea9b5fda970d90c07e2cc5f1b77555dedf3b3f5bf29961714" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": [], "source": [ "> This is one of the 100 recipes of the [IPython Cookbook](http://ipython-books.github.io/), the definitive guide to high-performance scientific computing and data science in Python.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 15.3. Analyzing real-valued functions" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from sympy import *\n", "init_printing()" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "var('x z')" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We define a new function depending on x." ] }, { "cell_type": "code", "collapsed": false, "input": [ "f = 1/(1+x**2)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's evaluate this function in 1." ] }, { "cell_type": "code", "collapsed": false, "input": [ "f.subs(x, 1)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can compute the derivative of this function..." ] }, { "cell_type": "code", "collapsed": false, "input": [ "diff(f, x)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "limits..." ] }, { "cell_type": "code", "collapsed": false, "input": [ "limit(f, x, oo)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Taylor series..." ] }, { "cell_type": "code", "collapsed": false, "input": [ "series(f, x0=0, n=9)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Definite integrals..." ] }, { "cell_type": "code", "collapsed": false, "input": [ "integrate(f, (x, -oo, oo))" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "indefinite integrals..." ] }, { "cell_type": "code", "collapsed": false, "input": [ "integrate(f, x)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and even Fourier transforms!" ] }, { "cell_type": "code", "collapsed": false, "input": [ "fourier_transform(f, x, z)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "> You'll find all the explanations, figures, references, and much more in the book (to be released later this summer).\n", "\n", "> [IPython Cookbook](http://ipython-books.github.io/), by [Cyrille Rossant](http://cyrille.rossant.net), Packt Publishing, 2014 (500 pages)." ] } ], "metadata": {} } ] }