import streamlit as st import math # Set the title for the app st.title("Scientific Calculator") # Input box for the user to enter the expression expression = st.text_input("Enter the mathematical expression:") # Available scientific functions def calculate(expression): try: # Evaluate the expression for basic arithmetic operations result = eval(expression, {"__builtins__": None}, { 'sin': math.sin, 'cos': math.cos, 'tan': math.tan, 'sqrt': math.sqrt, 'exp': math.exp, 'log': math.log, 'pi': math.pi, 'e': math.e, 'log10': math.log10 }) return result except Exception as e: return "Error: " + str(e) if expression: result = calculate(expression) st.write(f"Result: {result}")