MuhammadHananKhan123 commited on
Commit
9fb0ce3
·
verified ·
1 Parent(s): d594e21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py CHANGED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import streamlit as st
3
+ from sympy import symbols, diff, integrate, sympify
4
+
5
+ # Page Configuration
6
+ st.set_page_config(page_title="Derivation & Integration Solver", page_icon="🔢")
7
+ st.title("Derivation & Integration Solver")
8
+
9
+ # Input Section
10
+ st.header("Input Equation")
11
+ equation = st.text_input("Enter the equation (e.g., x**2 + 3*x + 5):", "")
12
+ variable = st.text_input("Enter the variable (e.g., x):", "x")
13
+
14
+ if equation and variable:
15
+ try:
16
+ # Convert input to sympy objects
17
+ var = symbols(variable)
18
+ expr = sympify(equation)
19
+
20
+ # Derivative Section
21
+ st.header("Derivative")
22
+ derivative = diff(expr, var)
23
+ st.latex(f"\\frac{{d}}{{d{variable}}}({equation}) = {derivative}")
24
+
25
+ # Integration Section
26
+ st.header("Integral")
27
+ integral = integrate(expr, var)
28
+ st.latex(f"\\int ({equation})\,d{variable} = {integral} + C")
29
+
30
+ except Exception as e:
31
+ st.error(f"An error occurred: {e}")