Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -147,6 +147,35 @@ NOTE: For eigenvalue problems, use 'lam = Symbol('lam')' instead of importing fr
|
|
147 |
```
|
148 |
- For systems of equations that might be linearly dependent, use row reduction instead of matrix inversion. Here's the template for handling such systems:
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
```python
|
151 |
from sympy import Matrix, symbols, solve
|
152 |
|
|
|
147 |
```
|
148 |
- For systems of equations that might be linearly dependent, use row reduction instead of matrix inversion. Here's the template for handling such systems:
|
149 |
|
150 |
+
7. Limit Calculations:
|
151 |
+
- ALWAYS compute one-sided limits (from the left and the right) when evaluating any limit:
|
152 |
+
```python
|
153 |
+
# Example:
|
154 |
+
x = Symbol('x')
|
155 |
+
expr = (sin(x)*cos(x) - x + x**3) / (x**3 * sqrt(1 + x) - x**3)
|
156 |
+
|
157 |
+
# Calculate the limit from the left (x -> 0-):
|
158 |
+
left_limit = limit(expr, x, 0, dir='-')
|
159 |
+
print("Limit from the left (x -> 0-):")
|
160 |
+
print(left_limit)
|
161 |
+
|
162 |
+
# Calculate the limit from the right (x -> 0+):
|
163 |
+
right_limit = limit(expr, x, 0, dir='+')
|
164 |
+
print("Limit from the right (x -> 0+):")
|
165 |
+
print(right_limit)
|
166 |
+
```
|
167 |
+
- After computing both one-sided limits, verify if they match:
|
168 |
+
```python
|
169 |
+
if left_limit == right_limit:
|
170 |
+
print("The two-sided limit exists and is:", left_limit)
|
171 |
+
else:
|
172 |
+
print("The two-sided limit does not exist.")
|
173 |
+
```
|
174 |
+
- If the limit diverges (\(\infty\) or \(-\infty\)), explicitly state that in the print output.
|
175 |
+
- For piecewise or discontinuous functions, compute limits at all points of interest, including boundaries.
|
176 |
+
|
177 |
+
- **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.
|
178 |
+
|
179 |
```python
|
180 |
from sympy import Matrix, symbols, solve
|
181 |
|