NSC9 commited on
Commit
dc65149
·
1 Parent(s): 8bd8f11

Upload Artificial_Calc_Teacher_v9.ipynb

Browse files
Files changed (1) hide show
  1. Artificial_Calc_Teacher_v9.ipynb +517 -0
Artificial_Calc_Teacher_v9.ipynb ADDED
@@ -0,0 +1,517 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "0625835f",
6
+ "metadata": {},
7
+ "source": [
8
+ "*Credits to https://people.math.harvard.edu/~knill/teaching/math1a_2011/handouts/46-ai.pdf for inspiration*\n",
9
+ "\n",
10
+ "*Thanks to @smichr for .replace suggestion https://stackoverflow.com/a/73000728/17291132*\n",
11
+ "\n",
12
+ "**Notebook by github.com/nsc9 - MIT License**\n",
13
+ "\n",
14
+ "**Changelog:**\n",
15
+ "\n",
16
+ " Integrals are now filtered if answers are complicated or impossible. \n",
17
+ " \n",
18
+ "**Requested Features:**\n",
19
+ "\n",
20
+ " Program stops if it exceeds 2 second run-time.\n",
21
+ " \n",
22
+ "**Known Bugs**\n",
23
+ "\n",
24
+ " Still Rarely Crashes. Minimized by lowering \n",
25
+ " allowed_values = list(range(-5, 5)) -> -2,2"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 1,
31
+ "id": "108761f9",
32
+ "metadata": {
33
+ "scrolled": false
34
+ },
35
+ "outputs": [
36
+ {
37
+ "data": {
38
+ "text/latex": [
39
+ "$\\displaystyle \\frac{d}{d x} \\left(\\frac{\\log{\\left(x \\right)}}{3} + 1\\right) = \\frac{1}{3 x}$"
40
+ ],
41
+ "text/plain": [
42
+ "Eq(Derivative(log(x)/3 + 1, x), 1/(3*x))"
43
+ ]
44
+ },
45
+ "metadata": {},
46
+ "output_type": "display_data"
47
+ },
48
+ {
49
+ "data": {
50
+ "text/latex": [
51
+ "$\\displaystyle \\int \\cos{\\left(x \\right)}\\, dx = \\sin{\\left(x \\right)}$"
52
+ ],
53
+ "text/plain": [
54
+ "Eq(Integral(cos(x), x), sin(x))"
55
+ ]
56
+ },
57
+ "metadata": {},
58
+ "output_type": "display_data"
59
+ },
60
+ {
61
+ "data": {
62
+ "text/latex": [
63
+ "$\\displaystyle \\frac{d}{d x} \\cos^{\\frac{3}{2}}{\\left(x \\right)} = - \\frac{3 \\sin{\\left(x \\right)} \\sqrt{\\cos{\\left(x \\right)}}}{2}$"
64
+ ],
65
+ "text/plain": [
66
+ "Eq(Derivative(cos(x)**(3/2), x), -3*sin(x)*sqrt(cos(x))/2)"
67
+ ]
68
+ },
69
+ "metadata": {},
70
+ "output_type": "display_data"
71
+ },
72
+ {
73
+ "data": {
74
+ "text/latex": [
75
+ "$\\displaystyle \\int \\sin{\\left(x \\right)} \\tan{\\left(x \\right)}\\, dx = - \\frac{\\log{\\left(\\sin{\\left(x \\right)} - 1 \\right)}}{2} + \\frac{\\log{\\left(\\sin{\\left(x \\right)} + 1 \\right)}}{2} - \\sin{\\left(x \\right)}$"
76
+ ],
77
+ "text/plain": [
78
+ "Eq(Integral(sin(x)*tan(x), x), -log(sin(x) - 1)/2 + log(sin(x) + 1)/2 - sin(x))"
79
+ ]
80
+ },
81
+ "metadata": {},
82
+ "output_type": "display_data"
83
+ },
84
+ {
85
+ "data": {
86
+ "text/latex": [
87
+ "$\\displaystyle \\frac{d}{d x} \\frac{\\log{\\left(x \\right)}}{x} = \\frac{1 - \\log{\\left(x \\right)}}{x^{2}}$"
88
+ ],
89
+ "text/plain": [
90
+ "Eq(Derivative(log(x)/x, x), (1 - log(x))/x**2)"
91
+ ]
92
+ },
93
+ "metadata": {},
94
+ "output_type": "display_data"
95
+ },
96
+ {
97
+ "data": {
98
+ "text/latex": [
99
+ "$\\displaystyle \\int \\left(e^{x} - 1\\right)\\, dx = - x + e^{x}$"
100
+ ],
101
+ "text/plain": [
102
+ "Eq(Integral(exp(x) - 1, x), -x + exp(x))"
103
+ ]
104
+ },
105
+ "metadata": {},
106
+ "output_type": "display_data"
107
+ },
108
+ {
109
+ "data": {
110
+ "text/latex": [
111
+ "$\\displaystyle \\frac{d}{d x} \\cos{\\left(2 x \\right)} = - 2 \\sin{\\left(2 x \\right)}$"
112
+ ],
113
+ "text/plain": [
114
+ "Eq(Derivative(cos(2*x), x), -2*sin(2*x))"
115
+ ]
116
+ },
117
+ "metadata": {},
118
+ "output_type": "display_data"
119
+ },
120
+ {
121
+ "data": {
122
+ "text/latex": [
123
+ "$\\displaystyle \\int \\left(e^{\\sqrt[3]{x}} + \\frac{1}{x^{2}}\\right)\\, dx = \\frac{3 x \\left(x^{\\frac{2}{3}} - 2 \\sqrt[3]{x} + 2\\right) e^{\\sqrt[3]{x}} - 1}{x}$"
124
+ ],
125
+ "text/plain": [
126
+ "Eq(Integral(exp(x**(1/3)) + x**(-2), x), (3*x*(x**(2/3) - 2*x**(1/3) + 2)*exp(x**(1/3)) - 1)/x)"
127
+ ]
128
+ },
129
+ "metadata": {},
130
+ "output_type": "display_data"
131
+ },
132
+ {
133
+ "data": {
134
+ "text/latex": [
135
+ "$\\displaystyle \\frac{d}{d x} \\left(\\sqrt[3]{x} + e^{x}\\right) = e^{x} + \\frac{1}{3 x^{\\frac{2}{3}}}$"
136
+ ],
137
+ "text/plain": [
138
+ "Eq(Derivative(x**(1/3) + exp(x), x), exp(x) + 1/(3*x**(2/3)))"
139
+ ]
140
+ },
141
+ "metadata": {},
142
+ "output_type": "display_data"
143
+ },
144
+ {
145
+ "data": {
146
+ "text/latex": [
147
+ "$\\displaystyle \\int \\frac{1 - \\frac{x}{2}}{\\tan{\\left(x \\right)}}\\, dx = \\log{\\left(\\sin{\\left(x \\right)} \\right)} - \\frac{\\int \\frac{x}{\\tan{\\left(x \\right)}}\\, dx}{2}$"
148
+ ],
149
+ "text/plain": [
150
+ "Eq(Integral((1 - x/2)/tan(x), x), log(sin(x)) - Integral(x/tan(x), x)/2)"
151
+ ]
152
+ },
153
+ "metadata": {},
154
+ "output_type": "display_data"
155
+ },
156
+ {
157
+ "data": {
158
+ "text/latex": [
159
+ "$\\displaystyle \\frac{d}{d x} \\left(1 - \\cos{\\left(x \\right)}\\right) = \\sin{\\left(x \\right)}$"
160
+ ],
161
+ "text/plain": [
162
+ "Eq(Derivative(1 - cos(x), x), sin(x))"
163
+ ]
164
+ },
165
+ "metadata": {},
166
+ "output_type": "display_data"
167
+ },
168
+ {
169
+ "data": {
170
+ "text/latex": [
171
+ "$\\displaystyle \\int \\left(\\frac{\\log{\\left(x \\right)}}{2} - \\tan{\\left(x \\right)}\\right)\\, dx = \\frac{x \\log{\\left(x \\right)}}{2} - \\frac{x}{2} + \\log{\\left(\\cos{\\left(x \\right)} \\right)}$"
172
+ ],
173
+ "text/plain": [
174
+ "Eq(Integral(log(x)/2 - tan(x), x), x*log(x)/2 - x/2 + log(cos(x)))"
175
+ ]
176
+ },
177
+ "metadata": {},
178
+ "output_type": "display_data"
179
+ },
180
+ {
181
+ "data": {
182
+ "text/latex": [
183
+ "$\\displaystyle \\frac{d}{d x} \\left(\\sqrt{x - 1} + \\sin{\\left(x \\right)}\\right) = \\cos{\\left(x \\right)} + \\frac{1}{2 \\sqrt{x - 1}}$"
184
+ ],
185
+ "text/plain": [
186
+ "Eq(Derivative(sqrt(x - 1) + sin(x), x), cos(x) + 1/(2*sqrt(x - 1)))"
187
+ ]
188
+ },
189
+ "metadata": {},
190
+ "output_type": "display_data"
191
+ },
192
+ {
193
+ "data": {
194
+ "text/latex": [
195
+ "$\\displaystyle \\int \\left(- e^{x} + 1 + \\frac{1}{x}\\right)\\, dx = x - e^{x} + \\log{\\left(x \\right)}$"
196
+ ],
197
+ "text/plain": [
198
+ "Eq(Integral(-exp(x) + 1 + 1/x, x), x - exp(x) + log(x))"
199
+ ]
200
+ },
201
+ "metadata": {},
202
+ "output_type": "display_data"
203
+ },
204
+ {
205
+ "data": {
206
+ "text/latex": [
207
+ "$\\displaystyle \\frac{d}{d x} \\left(- x + \\sqrt[3]{\\cos{\\left(x \\right)}} - 1\\right) = - \\frac{\\sin{\\left(x \\right)}}{3 \\cos^{\\frac{2}{3}}{\\left(x \\right)}} - 1$"
208
+ ],
209
+ "text/plain": [
210
+ "Eq(Derivative(-x + cos(x)**(1/3) - 1, x), -sin(x)/(3*cos(x)**(2/3)) - 1)"
211
+ ]
212
+ },
213
+ "metadata": {},
214
+ "output_type": "display_data"
215
+ },
216
+ {
217
+ "data": {
218
+ "text/latex": [
219
+ "$\\displaystyle \\int \\left(\\sqrt[4]{x} - e^{x}\\right)\\, dx = \\frac{4 x^{\\frac{5}{4}}}{5} - e^{x}$"
220
+ ],
221
+ "text/plain": [
222
+ "Eq(Integral(x**(1/4) - exp(x), x), 4*x**(5/4)/5 - exp(x))"
223
+ ]
224
+ },
225
+ "metadata": {},
226
+ "output_type": "display_data"
227
+ },
228
+ {
229
+ "data": {
230
+ "text/latex": [
231
+ "$\\displaystyle \\frac{d}{d x} e^{- x} \\tan{\\left(x \\right)} = \\left(- \\tan{\\left(x \\right)} + \\frac{1}{\\cos^{2}{\\left(x \\right)}}\\right) e^{- x}$"
232
+ ],
233
+ "text/plain": [
234
+ "Eq(Derivative(exp(-x)*tan(x), x), (-tan(x) + cos(x)**(-2))*exp(-x))"
235
+ ]
236
+ },
237
+ "metadata": {},
238
+ "output_type": "display_data"
239
+ },
240
+ {
241
+ "data": {
242
+ "text/latex": [
243
+ "$\\displaystyle \\int \\left(x + e^{x}\\right)\\, dx = \\frac{x^{2}}{2} + e^{x}$"
244
+ ],
245
+ "text/plain": [
246
+ "Eq(Integral(x + exp(x), x), x**2/2 + exp(x))"
247
+ ]
248
+ },
249
+ "metadata": {},
250
+ "output_type": "display_data"
251
+ },
252
+ {
253
+ "data": {
254
+ "text/latex": [
255
+ "$\\displaystyle \\frac{d}{d x} \\left(- x - 1 + e^{- x}\\right) = -1 - e^{- x}$"
256
+ ],
257
+ "text/plain": [
258
+ "Eq(Derivative(-x - 1 + exp(-x), x), -1 - exp(-x))"
259
+ ]
260
+ },
261
+ "metadata": {},
262
+ "output_type": "display_data"
263
+ },
264
+ {
265
+ "data": {
266
+ "text/latex": [
267
+ "$\\displaystyle \\int 1\\, dx = x$"
268
+ ],
269
+ "text/plain": [
270
+ "Eq(Integral(1, x), x)"
271
+ ]
272
+ },
273
+ "metadata": {},
274
+ "output_type": "display_data"
275
+ },
276
+ {
277
+ "data": {
278
+ "text/latex": [
279
+ "$\\displaystyle \\frac{d}{d x} \\left(- \\frac{2 \\sin{\\left(x \\right)}}{\\sqrt[3]{x}}\\right) = \\frac{2 \\left(- 3 x \\cos{\\left(x \\right)} + \\sin{\\left(x \\right)}\\right)}{3 x^{\\frac{4}{3}}}$"
280
+ ],
281
+ "text/plain": [
282
+ "Eq(Derivative(-2*sin(x)/x**(1/3), x), 2*(-3*x*cos(x) + sin(x))/(3*x**(4/3)))"
283
+ ]
284
+ },
285
+ "metadata": {},
286
+ "output_type": "display_data"
287
+ },
288
+ {
289
+ "data": {
290
+ "text/latex": [
291
+ "$\\displaystyle \\int \\left(e^{x} + \\log{\\left(x \\right)}\\right)\\, dx = x \\log{\\left(x \\right)} - x + e^{x}$"
292
+ ],
293
+ "text/plain": [
294
+ "Eq(Integral(exp(x) + log(x), x), x*log(x) - x + exp(x))"
295
+ ]
296
+ },
297
+ "metadata": {},
298
+ "output_type": "display_data"
299
+ },
300
+ {
301
+ "data": {
302
+ "text/latex": [
303
+ "$\\displaystyle \\frac{d}{d x} \\sin{\\left(x \\right)} = \\cos{\\left(x \\right)}$"
304
+ ],
305
+ "text/plain": [
306
+ "Eq(Derivative(sin(x), x), cos(x))"
307
+ ]
308
+ },
309
+ "metadata": {},
310
+ "output_type": "display_data"
311
+ },
312
+ {
313
+ "data": {
314
+ "text/latex": [
315
+ "$\\displaystyle \\int \\left(- 2 x^{\\frac{5}{6}}\\right)\\, dx = - \\frac{12 x^{\\frac{11}{6}}}{11}$"
316
+ ],
317
+ "text/plain": [
318
+ "Eq(Integral(-2*x**(5/6), x), -12*x**(11/6)/11)"
319
+ ]
320
+ },
321
+ "metadata": {},
322
+ "output_type": "display_data"
323
+ },
324
+ {
325
+ "data": {
326
+ "text/latex": [
327
+ "$\\displaystyle \\frac{d}{d x} \\frac{\\log{\\left(x - 1 \\right)}}{\\sqrt{x}} = \\frac{x - \\frac{\\left(x - 1\\right) \\log{\\left(x - 1 \\right)}}{2}}{x^{\\frac{3}{2}} \\left(x - 1\\right)}$"
328
+ ],
329
+ "text/plain": [
330
+ "Eq(Derivative(log(x - 1)/sqrt(x), x), (x - (x - 1)*log(x - 1)/2)/(x**(3/2)*(x - 1)))"
331
+ ]
332
+ },
333
+ "metadata": {},
334
+ "output_type": "display_data"
335
+ },
336
+ {
337
+ "data": {
338
+ "text/latex": [
339
+ "$\\displaystyle \\int 1\\, dx = x$"
340
+ ],
341
+ "text/plain": [
342
+ "Eq(Integral(1, x), x)"
343
+ ]
344
+ },
345
+ "metadata": {},
346
+ "output_type": "display_data"
347
+ },
348
+ {
349
+ "data": {
350
+ "text/latex": [
351
+ "$\\displaystyle \\frac{d}{d x} \\frac{\\sin{\\left(x \\right)}}{\\sqrt[3]{x}} = \\frac{x \\cos{\\left(x \\right)} - \\frac{\\sin{\\left(x \\right)}}{3}}{x^{\\frac{4}{3}}}$"
352
+ ],
353
+ "text/plain": [
354
+ "Eq(Derivative(sin(x)/x**(1/3), x), (x*cos(x) - sin(x)/3)/x**(4/3))"
355
+ ]
356
+ },
357
+ "metadata": {},
358
+ "output_type": "display_data"
359
+ },
360
+ {
361
+ "data": {
362
+ "text/latex": [
363
+ "$\\displaystyle \\int \\left(\\log{\\left(\\sin{\\left(x \\right)} \\right)} - 1\\right)\\, dx = - x + \\int \\log{\\left(\\sin{\\left(x \\right)} \\right)}\\, dx$"
364
+ ],
365
+ "text/plain": [
366
+ "Eq(Integral(log(sin(x)) - 1, x), -x + Integral(log(sin(x)), x))"
367
+ ]
368
+ },
369
+ "metadata": {},
370
+ "output_type": "display_data"
371
+ },
372
+ {
373
+ "data": {
374
+ "text/latex": [
375
+ "$\\displaystyle \\frac{d}{d x} \\left(- \\frac{2}{x^{\\frac{3}{2}}}\\right) = \\frac{3}{x^{\\frac{5}{2}}}$"
376
+ ],
377
+ "text/plain": [
378
+ "Eq(Derivative(-2/x**(3/2), x), 3/x**(5/2))"
379
+ ]
380
+ },
381
+ "metadata": {},
382
+ "output_type": "display_data"
383
+ },
384
+ {
385
+ "data": {
386
+ "text/latex": [
387
+ "$\\displaystyle \\int \\log{\\left(x \\right)}\\, dx = x \\left(\\log{\\left(x \\right)} - 1\\right)$"
388
+ ],
389
+ "text/plain": [
390
+ "Eq(Integral(log(x), x), x*(log(x) - 1))"
391
+ ]
392
+ },
393
+ "metadata": {},
394
+ "output_type": "display_data"
395
+ },
396
+ {
397
+ "data": {
398
+ "text/latex": [
399
+ "$\\displaystyle \\frac{d}{d x} \\sin{\\left(\\log{\\left(\\cos{\\left(x \\right)} \\right)} \\right)} = - \\cos{\\left(\\log{\\left(\\cos{\\left(x \\right)} \\right)} \\right)} \\tan{\\left(x \\right)}$"
400
+ ],
401
+ "text/plain": [
402
+ "Eq(Derivative(sin(log(cos(x))), x), -cos(log(cos(x)))*tan(x))"
403
+ ]
404
+ },
405
+ "metadata": {},
406
+ "output_type": "display_data"
407
+ },
408
+ {
409
+ "data": {
410
+ "text/latex": [
411
+ "$\\displaystyle \\int \\left(- 2 \\sin{\\left(x \\right)}\\right)\\, dx = 2 \\cos{\\left(x \\right)}$"
412
+ ],
413
+ "text/plain": [
414
+ "Eq(Integral(-2*sin(x), x), 2*cos(x))"
415
+ ]
416
+ },
417
+ "metadata": {},
418
+ "output_type": "display_data"
419
+ },
420
+ {
421
+ "data": {
422
+ "text/latex": [
423
+ "$\\displaystyle \\frac{d}{d x} e^{2 x} = 2 e^{2 x}$"
424
+ ],
425
+ "text/plain": [
426
+ "Eq(Derivative(exp(2*x), x), 2*exp(2*x))"
427
+ ]
428
+ },
429
+ "metadata": {},
430
+ "output_type": "display_data"
431
+ },
432
+ {
433
+ "data": {
434
+ "text/latex": [
435
+ "$\\displaystyle \\int \\left(x - 2\\right) \\sqrt[3]{e^{x}}\\, dx = 3 \\left(x - 5\\right) \\sqrt[3]{e^{x}}$"
436
+ ],
437
+ "text/plain": [
438
+ "Eq(Integral((x - 2)*exp(x)**(1/3), x), 3*(x - 5)*exp(x)**(1/3))"
439
+ ]
440
+ },
441
+ "metadata": {},
442
+ "output_type": "display_data"
443
+ }
444
+ ],
445
+ "source": [
446
+ "from sympy import sin,cos,log,exp,tan,Function,Derivative,Eq,Integral,Rational\n",
447
+ "from sympy import factor_terms,simplify, sqrt, cbrt\n",
448
+ "from sympy.abc import x\n",
449
+ "import random\n",
450
+ "f = Function('f')\n",
451
+ "g = Function('g')\n",
452
+ "h = Function('h')\n",
453
+ "def random_math(x):\n",
454
+ " allowed_values = list(range(-2, 2))\n",
455
+ " allowed_values.remove(0)\n",
456
+ " random_value = random.choice(allowed_values)\n",
457
+ " random_value2 = random.choice(allowed_values)\n",
458
+ " def power_function(x): \n",
459
+ " return x**(Rational(random_value,random_value2))\n",
460
+ " def scalar_function(x):\n",
461
+ " return x*random_value\n",
462
+ " def addSUBTR_function(x): \n",
463
+ " return x+random_value\n",
464
+ " funs = [sin,power_function,log,exp,cos,tan,sqrt,cbrt,\n",
465
+ " scalar_function,addSUBTR_function] \n",
466
+ " operations = [f(g(x)),f(x)+g(x),f(x)-g(x),f(x)/g(x),f(x)*g(x),\n",
467
+ " f(g(h(x))),f(h(x))+g(x),f(h(x))-g(x),f(h(x))/g(x),f(x)/g(h(x)),f(h(x))*g(x)]\n",
468
+ " operation = operations[random.randrange(0,len(operations))]\n",
469
+ " return [[[operation.replace(f, i) for i in funs][random.randrange(0,len(funs))].replace(g, i) for i in funs]\\\n",
470
+ "[random.randrange(0,len(funs))].replace(h, i) for i in funs][random.randrange(0,len(funs))]\n",
471
+ "\n",
472
+ "\n",
473
+ "for i in range(1,31): \n",
474
+ " practice1 = Derivative(simplify(random_math(x)),x)\n",
475
+ " practice2 = Integral(simplify(random_math(x)),x)\n",
476
+ " p1eq = Eq(practice1,practice1.doit().simplify(),evaluate=False)\n",
477
+ " p2eq = Eq(practice2,practice2.doit().simplify(),evaluate=False)\n",
478
+ " if str(factor_terms(p2eq.lhs)) != str(p2eq.rhs): \n",
479
+ " if str(p2eq).find(\"Ei\") == -1 and str(p2eq).find(\"gamma\") == -1 and str(p2eq).find(\"Piecewise\") == -1\\\n",
480
+ " and str(p2eq).find(\"li\") == -1 and str(p2eq).find(\"erf\") == -1 and str(p2eq).find(\"atan\") == -1\\\n",
481
+ " and str(p2eq).find(\"Si\") == -1 and str(p2eq).find(\"Ci\") == -1 and str(p2eq).find(\"hyper\") == -1\\\n",
482
+ " and str(p2eq).find(\"fresnel\") == -1 and str(p2eq).find(\"Li\") == -1: \n",
483
+ " if practice1.doit != 0: \n",
484
+ " display(p1eq)\n",
485
+ " display(p2eq)\n",
486
+ " else:\n",
487
+ " pass\n",
488
+ " #print(\"Error: Complex Integral\")\n",
489
+ " \n",
490
+ " else:\n",
491
+ " pass\n",
492
+ " # print(\"Error: Impossible Integral\") "
493
+ ]
494
+ }
495
+ ],
496
+ "metadata": {
497
+ "kernelspec": {
498
+ "display_name": "Python 3 (ipykernel)",
499
+ "language": "python",
500
+ "name": "python3"
501
+ },
502
+ "language_info": {
503
+ "codemirror_mode": {
504
+ "name": "ipython",
505
+ "version": 3
506
+ },
507
+ "file_extension": ".py",
508
+ "mimetype": "text/x-python",
509
+ "name": "python",
510
+ "nbconvert_exporter": "python",
511
+ "pygments_lexer": "ipython3",
512
+ "version": "3.8.10"
513
+ }
514
+ },
515
+ "nbformat": 4,
516
+ "nbformat_minor": 5
517
+ }