pplonski commited on
Commit
9a6ac89
·
1 Parent(s): 8b133a5

Upload calculus.ipynb

Browse files
Files changed (1) hide show
  1. calculus.ipynb +19 -18
calculus.ipynb CHANGED
@@ -3,7 +3,7 @@
3
  {
4
  "cell_type": "code",
5
  "execution_count": 7,
6
- "id": "f78791d5",
7
  "metadata": {},
8
  "outputs": [
9
  {
@@ -24,7 +24,7 @@
24
  "import mercury as mr\n",
25
  " \n",
26
  "# set Application parameters\n",
27
- "app = mr.App(title=\"Calculus Problem Generator\",\n",
28
  " description=\"Generates expressions which students can apply differential and integral calculus to.\",\n",
29
  " show_code=False,\n",
30
  " show_prompt=False,\n",
@@ -37,15 +37,15 @@
37
  },
38
  {
39
  "cell_type": "code",
40
- "execution_count": 8,
41
- "id": "46df7f52",
42
  "metadata": {},
43
  "outputs": [
44
  {
45
  "data": {
46
- "application/mercury+json": "{\n \"widget\": \"Button\",\n \"label\": \"New equation\",\n \"style\": \"primary\",\n \"value\": false,\n \"model_id\": \"924849ab8db145cf8e9f7bc75f38bb23\",\n \"code_uid\": \"Button.0.40.11.1-randd017f351\",\n \"disabled\": false,\n \"hidden\": false\n}",
47
  "application/vnd.jupyter.widget-view+json": {
48
- "model_id": "924849ab8db145cf8e9f7bc75f38bb23",
49
  "version_major": 2,
50
  "version_minor": 0
51
  },
@@ -58,22 +58,23 @@
58
  }
59
  ],
60
  "source": [
 
61
  "generate = mr.Button(label=\"New equation\")"
62
  ]
63
  },
64
  {
65
  "cell_type": "code",
66
- "execution_count": 10,
67
- "id": "3a7db45a",
68
  "metadata": {},
69
  "outputs": [
70
  {
71
  "data": {
72
  "text/latex": [
73
- "$\\displaystyle \\frac{d}{d \\theta} \\left(- \\sqrt{\\theta} + \\sin{\\left(\\theta \\right)} + \\cos{\\left(\\theta \\right)}\\right) = ?$"
74
  ],
75
  "text/plain": [
76
- "Eq(Derivative(-sqrt(theta) + sin(theta) + cos(theta), theta), ?)"
77
  ]
78
  },
79
  "metadata": {},
@@ -82,10 +83,10 @@
82
  {
83
  "data": {
84
  "text/latex": [
85
- "$\\displaystyle \\int \\left(z - 3\\right) \\left(6 z - 10\\right)\\, dz = ?$"
86
  ],
87
  "text/plain": [
88
- "Eq(Integral((z - 3)*(6*z - 10), z), ?)"
89
  ]
90
  },
91
  "metadata": {},
@@ -106,10 +107,10 @@
106
  {
107
  "data": {
108
  "text/latex": [
109
- "$\\displaystyle \\frac{d}{d \\theta} \\left(- \\sqrt{\\theta} + \\sin{\\left(\\theta \\right)} + \\cos{\\left(\\theta \\right)}\\right) = - \\sin{\\left(\\theta \\right)} + \\cos{\\left(\\theta \\right)} - \\frac{1}{2 \\sqrt{\\theta}}$"
110
  ],
111
  "text/plain": [
112
- "Eq(Derivative(-sqrt(theta) + sin(theta) + cos(theta), theta), -sin(theta) + cos(theta) - 1/(2*sqrt(theta)))"
113
  ]
114
  },
115
  "metadata": {},
@@ -118,10 +119,10 @@
118
  {
119
  "data": {
120
  "text/latex": [
121
- "$\\displaystyle \\int \\left(z - 3\\right) \\left(6 z - 10\\right)\\, dz = 2 z^{3} - 14 z^{2} + 30 z$"
122
  ],
123
  "text/plain": [
124
- "Eq(Integral((z - 3)*(6*z - 10), z), 2*z**3 - 14*z**2 + 30*z)"
125
  ]
126
  },
127
  "metadata": {},
@@ -242,7 +243,7 @@
242
  "def rhs():\n",
243
  " return display(Eq(nsimplify(output1.lhs),nsimplify(output1.rhs)),Eq(nsimplify(output2.lhs),nsimplify(output2.rhs)))\n",
244
  "\n",
245
- "if generate.clicked:\n",
246
  " lhs()\n",
247
  " print(\"\\n\")\n",
248
  " print(\"\\n\")\n",
@@ -253,7 +254,7 @@
253
  {
254
  "cell_type": "code",
255
  "execution_count": null,
256
- "id": "08e768e2",
257
  "metadata": {},
258
  "outputs": [],
259
  "source": []
 
3
  {
4
  "cell_type": "code",
5
  "execution_count": 7,
6
+ "id": "72145cbe",
7
  "metadata": {},
8
  "outputs": [
9
  {
 
24
  "import mercury as mr\n",
25
  " \n",
26
  "# set Application parameters\n",
27
+ "app = mr.App(title=\"Calculus with button\",\n",
28
  " description=\"Generates expressions which students can apply differential and integral calculus to.\",\n",
29
  " show_code=False,\n",
30
  " show_prompt=False,\n",
 
37
  },
38
  {
39
  "cell_type": "code",
40
+ "execution_count": 11,
41
+ "id": "0308f4b7",
42
  "metadata": {},
43
  "outputs": [
44
  {
45
  "data": {
46
+ "application/mercury+json": "{\n \"widget\": \"Button\",\n \"label\": \"New equation\",\n \"style\": \"primary\",\n \"value\": false,\n \"model_id\": \"d823df88c8e04ab6918655ea513e41e2\",\n \"code_uid\": \"Button.0.40.11.2-rand7b3a5be9\",\n \"disabled\": false,\n \"hidden\": false\n}",
47
  "application/vnd.jupyter.widget-view+json": {
48
+ "model_id": "d823df88c8e04ab6918655ea513e41e2",
49
  "version_major": 2,
50
  "version_minor": 0
51
  },
 
58
  }
59
  ],
60
  "source": [
61
+ "init_equations = True\n",
62
  "generate = mr.Button(label=\"New equation\")"
63
  ]
64
  },
65
  {
66
  "cell_type": "code",
67
+ "execution_count": 12,
68
+ "id": "d0b8998c",
69
  "metadata": {},
70
  "outputs": [
71
  {
72
  "data": {
73
  "text/latex": [
74
+ "$\\displaystyle \\frac{d}{d \\theta} \\left(\\left(\\theta + 9\\right) \\cos{\\left(\\theta \\right)} - \\cos{\\left(\\theta \\right)}\\right) = ?$"
75
  ],
76
  "text/plain": [
77
+ "Eq(Derivative((theta + 9)*cos(theta) - cos(theta), theta), ?)"
78
  ]
79
  },
80
  "metadata": {},
 
83
  {
84
  "data": {
85
  "text/latex": [
86
+ "$\\displaystyle \\int \\left(2 v + 11\\right)\\, dv = ?$"
87
  ],
88
  "text/plain": [
89
+ "Eq(Integral(2*v + 11, v), ?)"
90
  ]
91
  },
92
  "metadata": {},
 
107
  {
108
  "data": {
109
  "text/latex": [
110
+ "$\\displaystyle \\frac{d}{d \\theta} \\left(\\left(\\theta + 9\\right) \\cos{\\left(\\theta \\right)} - \\cos{\\left(\\theta \\right)}\\right) = - \\left(\\theta + 9\\right) \\sin{\\left(\\theta \\right)} + \\sin{\\left(\\theta \\right)} + \\cos{\\left(\\theta \\right)}$"
111
  ],
112
  "text/plain": [
113
+ "Eq(Derivative((theta + 9)*cos(theta) - cos(theta), theta), -(theta + 9)*sin(theta) + sin(theta) + cos(theta))"
114
  ]
115
  },
116
  "metadata": {},
 
119
  {
120
  "data": {
121
  "text/latex": [
122
+ "$\\displaystyle \\int \\left(2 v + 11\\right)\\, dv = v^{2} + 11 v$"
123
  ],
124
  "text/plain": [
125
+ "Eq(Integral(2*v + 11, v), v**2 + 11*v)"
126
  ]
127
  },
128
  "metadata": {},
 
243
  "def rhs():\n",
244
  " return display(Eq(nsimplify(output1.lhs),nsimplify(output1.rhs)),Eq(nsimplify(output2.lhs),nsimplify(output2.rhs)))\n",
245
  "\n",
246
+ "if generate.clicked or init_equations:\n",
247
  " lhs()\n",
248
  " print(\"\\n\")\n",
249
  " print(\"\\n\")\n",
 
254
  {
255
  "cell_type": "code",
256
  "execution_count": null,
257
+ "id": "d0962de8",
258
  "metadata": {},
259
  "outputs": [],
260
  "source": []