{ "cells": [ { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "f(x) \t Derivative \t Integral \t Series expansion\n", "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", "sin(x) \t cos(x) \t -cos(x) \t 1*x + (-1/6)*x^3 + Order(x^5)\n", "cos(x) \t -sin(x) \t sin(x) \t 1 + (-1/2)*x^2 + 1/24*x^4 + Order(x^5)\n", "tan(x) \t tan(x)^2 + 1 \t log(sec(x)) \t 1*x + 1/3*x^3 + Order(x^5)\n", "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", "(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" ] } ], "source": [ "print(\"f(x)\", \"\\t\", \"Derivative\", \"\\t\", \"Integral\", \"\\t\", \"Series expansion\")\n", "var('a')\n", "f(x) = (1+x)^a\n", "assume(a>0)\n", "functions = [e^x, sin, cos, tan, log(1+x), f]\n", "for g in functions:\n", " print(g(x), \"\\t\", derivative(g(x), x), \"\\t\", integral(g(x),x), \"\\t\", g(x).series(x==0,5))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SageMath 9.2", "language": "sage", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }