Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,9 @@
|
|
| 1 |
-
pip install streamlit
|
| 2 |
-
|
| 3 |
import streamlit as st
|
| 4 |
import sympy as sp
|
| 5 |
|
| 6 |
# Function to solve algebraic equations
|
| 7 |
def solve_equation(equation):
|
| 8 |
try:
|
| 9 |
-
# Check if the equation contains "="
|
| 10 |
if "=" not in equation:
|
| 11 |
return "Invalid input. Please enter an equation with '=' (e.g., 2*x + 3 = 5)."
|
| 12 |
|
|
@@ -24,9 +21,7 @@ def solve_equation(equation):
|
|
| 24 |
# Function to simplify expressions
|
| 25 |
def simplify_expression(expression):
|
| 26 |
try:
|
| 27 |
-
# Replace '^' with '**' for exponentiation
|
| 28 |
expression = expression.replace("^", "**")
|
| 29 |
-
|
| 30 |
expr = sp.sympify(expression)
|
| 31 |
simplified_expr = sp.simplify(expr)
|
| 32 |
return f"Simplified Expression: {simplified_expr}"
|
|
@@ -36,9 +31,7 @@ def simplify_expression(expression):
|
|
| 36 |
# Function to factor expressions
|
| 37 |
def factor_expression(expression):
|
| 38 |
try:
|
| 39 |
-
# Replace '^' with '**' for exponentiation
|
| 40 |
expression = expression.replace("^", "**")
|
| 41 |
-
|
| 42 |
expr = sp.sympify(expression)
|
| 43 |
factored_expr = sp.factor(expr)
|
| 44 |
return f"Factored Expression: {factored_expr}"
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import sympy as sp
|
| 3 |
|
| 4 |
# Function to solve algebraic equations
|
| 5 |
def solve_equation(equation):
|
| 6 |
try:
|
|
|
|
| 7 |
if "=" not in equation:
|
| 8 |
return "Invalid input. Please enter an equation with '=' (e.g., 2*x + 3 = 5)."
|
| 9 |
|
|
|
|
| 21 |
# Function to simplify expressions
|
| 22 |
def simplify_expression(expression):
|
| 23 |
try:
|
|
|
|
| 24 |
expression = expression.replace("^", "**")
|
|
|
|
| 25 |
expr = sp.sympify(expression)
|
| 26 |
simplified_expr = sp.simplify(expr)
|
| 27 |
return f"Simplified Expression: {simplified_expr}"
|
|
|
|
| 31 |
# Function to factor expressions
|
| 32 |
def factor_expression(expression):
|
| 33 |
try:
|
|
|
|
| 34 |
expression = expression.replace("^", "**")
|
|
|
|
| 35 |
expr = sp.sympify(expression)
|
| 36 |
factored_expr = sp.factor(expr)
|
| 37 |
return f"Factored Expression: {factored_expr}"
|