joshuarauh commited on
Commit
cbe8375
·
verified ·
1 Parent(s): b3da6e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -10
app.py CHANGED
@@ -281,19 +281,38 @@ NOTE: For eigenvalue problems, use 'lam = Symbol('lam')' instead of importing fr
281
 
282
  - **Important Note**: Always test limits symbolically first. If SymPy produces unexpected results, simplify the expression or expand it (e.g., using `series`) before re-evaluating the limit.
283
 
284
- 8. If calculating integrals, write the SymPy code to compute the original integral directly with respect to the original variable of integration,
285
- not any integral that might have been rewritten with a variable substitution. In addition to seeking an analytic solution, also obtain a numerical solution using two methods
286
- (i) SymPy's integrate function; and
287
- (ii) using mpmath, example:
288
- ```python
289
- import mpmath
290
- f = lambda x: x**2 / ((x**4+1)*mpmath.sqrt(x**2+1))
291
- mpmath.quad(f, [0, mpmath.inf])
292
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
 
294
  9. If using SymPy to evalute an infinite sum, attempt using the infinite sum, and in addition report what the sum of the first 100 terms is as a sanity check.
295
 
296
  10. Do not use SciPy.
 
 
297
 
298
  ```python
299
  from sympy import Matrix, symbols, solve
@@ -354,7 +373,7 @@ if result == "infinite":
354
  else:
355
  print(f"{var} = t") # use different parameter names for multiple free variables
356
  ```
357
- Always use this template when working with systems of equations to handle potential linear dependence correctly. """
358
 
359
  def load_proof_repository():
360
  """Load the proof repository from the repository file"""
 
281
 
282
  - **Important Note**: Always test limits symbolically first. If SymPy produces unexpected results, simplify the expression or expand it (e.g., using `series`) before re-evaluating the limit.
283
 
284
+ 8. If calculating integrals, do so directly with respect to the original expression and original variable of integration,
285
+ not any integral that might have been rewritten with a variable substitution
286
+
287
+ For indefinite integrals:
288
+ ```python
289
+ # Just compute and display the symbolic result
290
+ x = Symbol('x')
291
+ expr = x**2
292
+ indefinite_integral = integrate(expr, x)
293
+ print("Indefinite integral:")
294
+ print(indefinite_integral)
295
+ ```
296
+
297
+ For numerical verification, always use definite integrals:
298
+ ```python
299
+ # Use specific bounds and verify numerically
300
+ definite_integral = integrate(expr, (x, 0, 1))
301
+ print("Definite integral value:")
302
+ print(float(definite_integral.evalf()))
303
+
304
+ # Include mpmath verification:
305
+ import mpmath
306
+ f = lambda x: x**2
307
+ mpmath_result = mpmath.quad(f, [0, 1])
308
+ print("mpmath verification:", float(mpmath_result))
309
+ ```
310
 
311
  9. If using SymPy to evalute an infinite sum, attempt using the infinite sum, and in addition report what the sum of the first 100 terms is as a sanity check.
312
 
313
  10. Do not use SciPy.
314
+
315
+ 11. Always use this template when working with systems of equations to handle potential linear dependence correctly.
316
 
317
  ```python
318
  from sympy import Matrix, symbols, solve
 
373
  else:
374
  print(f"{var} = t") # use different parameter names for multiple free variables
375
  ```
376
+ """
377
 
378
  def load_proof_repository():
379
  """Load the proof repository from the repository file"""