1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
{
"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
}
|