Homework4-solutions-checkpoint.ipynb (1823B)
1 { 2 "cells": [ 3 { 4 "cell_type": "code", 5 "execution_count": 40, 6 "metadata": {}, 7 "outputs": [ 8 { 9 "name": "stdout", 10 "output_type": "stream", 11 "text": [ 12 "f(x) \t Derivative \t Integral \t Series expansion\n", 13 "e^x \t e^x \t e^x \t 1 + 1*x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + Order(x^5)\n", 14 "sin(x) \t cos(x) \t -cos(x) \t 1*x + (-1/6)*x^3 + Order(x^5)\n", 15 "cos(x) \t -sin(x) \t sin(x) \t 1 + (-1/2)*x^2 + 1/24*x^4 + Order(x^5)\n", 16 "tan(x) \t tan(x)^2 + 1 \t log(sec(x)) \t 1*x + 1/3*x^3 + Order(x^5)\n", 17 "log(x + 1) \t 1/(x + 1) \t (x + 1)*log(x + 1) - x - 1 \t 1*x + (-1/2)*x^2 + 1/3*x^3 + (-1/4)*x^4 + Order(x^5)\n", 18 "(x + 1)^a \t a*(x + 1)^(a - 1) \t (x + 1)^(a + 1)/(a + 1) \t 1 + (a)*x + (1/2*a^2 - 1/2*a)*x^2 + (1/6*a^3 - 1/2*a^2 + 1/3*a)*x^3 + (1/24*a^4 - 1/4*a^3 + 11/24*a^2 - 1/4*a)*x^4 + Order(x^5)\n" 19 ] 20 } 21 ], 22 "source": [ 23 "print(\"f(x)\", \"\\t\", \"Derivative\", \"\\t\", \"Integral\", \"\\t\", \"Series expansion\")\n", 24 "var('a')\n", 25 "f(x) = (1+x)^a\n", 26 "assume(a>0)\n", 27 "functions = [e^x, sin, cos, tan, log(1+x), f]\n", 28 "for g in functions:\n", 29 " print(g(x), \"\\t\", derivative(g(x), x), \"\\t\", integral(g(x),x), \"\\t\", g(x).series(x==0,5))" 30 ] 31 }, 32 { 33 "cell_type": "code", 34 "execution_count": null, 35 "metadata": {}, 36 "outputs": [], 37 "source": [] 38 } 39 ], 40 "metadata": { 41 "kernelspec": { 42 "display_name": "SageMath 9.2", 43 "language": "sage", 44 "name": "sagemath" 45 }, 46 "language_info": { 47 "codemirror_mode": { 48 "name": "ipython", 49 "version": 3 50 }, 51 "file_extension": ".py", 52 "mimetype": "text/x-python", 53 "name": "python", 54 "nbconvert_exporter": "python", 55 "pygments_lexer": "ipython3", 56 "version": "3.8.5" 57 } 58 }, 59 "nbformat": 4, 60 "nbformat_minor": 4 61 }