Commit History

streamlit numpy sympy matplotlib scipy pandas
801844d
verified

VIATEUR-AI commited on

import streamlit as st import numpy as np import sympy as sp import matplotlib.pyplot as plt from sympy.plotting import plot from sympy import symbols, sin, cos, tan st.set_page_config(page_title="VMathLab Ultimate", layout="wide") st.title("VMathLab Ultimate 2.0: Complete Interactive Math Lab") # Sidebar: Module selection module = st.sidebar.selectbox("Hitamo Module:", [ "Algebra", "Calculus", "Trigonometry", "Linear Algebra", "Statistics", "Differential Equations", "Graphing", "Number Theory" ]) x = symbols('x') # --------------------- Algebra --------------------- if module == "Algebra": st.header("Algebra Module") eq_input = st.text_input("Shyiramo equation (urugero: x**2 - 5*x + 6):") if eq_input: try: expr = sp.sympify(eq_input) solutions = sp.solve(expr, x) st.write(f"Solutions: {solutions}") except: st.error("Error: Enter a valid algebraic expression.") # --------------------- Calculus --------------------- elif module == "Calculus": st.header("Calculus Module") func_input = st.text_input("Shyiramo function (urugero: x**3 - 2*x + 1):") if func_input: try: func = sp.sympify(func_input) st.write(f"Derivative: {sp.diff(func, x)}") st.write(f"Integral: {sp.integrate(func, x)} + C") except: st.error("Error: Enter a valid function.") # --------------------- Trigonometry --------------------- elif module == "Trigonometry": st.header("Trigonometry Module") trig_func = st.selectbox("Hitamo function:", ["sin(x)", "cos(x)", "tan(x)"]) x_vals = np.linspace(-2*np.pi, 2*np.pi, 400) if trig_func == "sin(x)": y_vals = np.sin(x_vals) elif trig_func == "cos(x)": y_vals = np.cos(x_vals) else: y_vals = np.tan(x_vals) fig, ax = plt.subplots() ax.plot(x_vals, y_vals, label=trig_func) ax.set_title(f"{trig_func} plot") ax.grid(True) st.pyplot(fig) # --------------------- Linear Algebra --------------------- elif module == "Linear Algebra": st.header("Linear Algebra Module") st.write("Matrix Calculator") matrix_input = st.text_area("Shyiramo matrix (urugero: [[1,2],[3,4]]):") if matrix_input: try: mat = np.array(eval(matrix_input)) st.write("Determinant:", np.linalg.det(mat)) st.write("Inverse (if exists):", np.linalg.inv(mat)) except: st.error("Invalid matrix input.") # --------------------- Statistics --------------------- elif module == "Statistics": st.header("Statistics Module") data_input = st.text_area("Shyiramo data (urugero: 1,2,3,4,5):") if data_input: try: data = np.array([float(i) for i in data_input.split(",")]) st.write("Mean:", np.mean(data)) st.write("Median:", np.median(data)) st.write("Variance:", np.var(data)) except: st.error("Invalid data input.") # --------------------- Differential Equations --------------------- elif module == "Differential Equations": st.header("Differential Equations Module") de_input = st.text_input("Shyiramo DE (urugero: f(x).diff(x) - f(x) = 0):") f = sp.Function('f') if de_input: try: de = eval(de_input) sol = sp.dsolve(de) st.write("Solution:", sol) except: st.error("Invalid differential equation.") # --------------------- Graphing --------------------- elif module == "Graphing": st.header("Graphing Module") func_input = st.text_input("Shyiramo function y(x):") x_min = st.number_input("X min", value=-10.0) x_max = st.number_input("X max", value=10.0) color = st.color_picker("Graph Color", "#FF0000") if func_input: try: x_vals = np.linspace(x_min, x_max, 400) f = sp.lambdify(x, sp.sympify(func_input), "numpy") y_vals = f(x_vals) fig, ax = plt.subplots() ax.plot(x_vals, y_vals, color=color, label=func_input) ax.axhline(0, color='black', linewidth=0.7) ax.axvline(0, color='black', linewidth=0.7) ax.grid(True) ax.legend() st.pyplot(fig) except: st.error("Enter a valid function.") # --------------------- Number Theory --------------------- elif module == "Number Theory": st.header("Number Theory Module") num = st.number_input("Shyiramo integer:", step=1) if num: try: def is_prime(n): if n < 2: return False for i in range(2,int(n**0.5)+1): if n % i == 0: return False return True st.write(f"Prime: {is_prime(num)}") st.write("Factors:", [i for i in range(1,num+1) if num % i == 0]) except: st.error("Invalid input.")
62a0351
verified

VIATEUR-AI commited on

Create app.py
1686f97
verified

VIATEUR-AI commited on

Delete app.py
60fce91
verified

VIATEUR-AI commited on

Update README.md
04dc513
verified

VIATEUR-AI commited on

Update README.md
bf99b6b
verified

VIATEUR-AI commited on

# VMathLab Pro **VMathLab Pro** ni **interactive Quadratic Function Graphing Calculator** yakozwe na Viateur. Iyi app igufasha gusobanukirwa no kugaragaza **quadratic functions** nko: - Kubara **roots** (aho graph ihura na x-axis) - Kwerekana **vertex** (igicumbi cya parabola) - Kwerekana **axis of symmetry** - Gukora **interactive graph** aho ushobora guhindura parameters n’amabara --- ## Screenshot ![VMathLab Pro UI](screenshot.png) --- ## Features - Input parameters: `a`, `b`, `c` - Interactive graph update uko uhindura **x-range, color, line style** - Real and complex roots display - Vertex and axis of symmetry highlighted on the graph - Modern, interactive UI --- ## How to Run 1. Clone this repository: ```bash git clone https://huggingface.co/VIATEUR-AI/VMathLab
c775d77
verified

VIATEUR-AI commited on

import streamlit as st import numpy as np import matplotlib.pyplot as plt st.title("VMathLab Pro: Interactive Quadratic Graphing Calculator") # Inputs st.sidebar.header("Quadratic Function Parameters") a = st.sidebar.number_input("Shyiramo a:", value=1.0) b = st.sidebar.number_input("Shyiramo b:", value=0.0) c = st.sidebar.number_input("Shyiramo c:", value=0.0) st.sidebar.header("Graph Settings") x_min = st.sidebar.number_input("X min:", value=-10.0) x_max = st.sidebar.number_input("X max:", value=10.0) color = st.sidebar.color_picker("Graph Color", "#FF0000") line_style = st.sidebar.selectbox("Line Style", ['-', '--', '-.', ':']) # Kubara discriminant na roots D = b**2 - 4*a*c if D > 0: root1 = (-b + np.sqrt(D)) / (2*a) root2 = (-b - np.sqrt(D)) / (2*a) st.write(f"Roots ebyiri: x1 = {root1}, x2 = {root2}") elif D == 0: root1 = -b / (2*a) st.write(f"Root imwe: x = {root1}") else: st.write("Roots complex:") real_part = -b / (2*a) imag_part = np.sqrt(-D) / (2*a) st.write(f"x1 = {real_part} + {imag_part}i") st.write(f"x2 = {real_part} - {imag_part}i") # Vertex na axis of symmetry vertex_x = -b / (2*a) vertex_y = a*vertex_x**2 + b*vertex_x + c st.write(f"Vertex: ({vertex_x}, {vertex_y})") st.write(f"Axis of Symmetry: x = {vertex_x}") # Graph x = np.linspace(x_min, x_max, 400) y = a*x**2 + b*x + c fig, ax = plt.subplots() ax.plot(x, y, color=color, linestyle=line_style, label=f'{a}x^2 + {b}x + {c}') ax.axhline(0, color='black', linewidth=0.7) ax.axvline(0, color='black', linewidth=0.7) ax.scatter(vertex_x, vertex_y, color='blue', label='Vertex') ax.axvline(vertex_x, color='blue', linestyle='--', linewidth=0.7, label='Axis of Symmetry') ax.set_title("Graph of Quadratic Function") ax.set_xlabel("x") ax.set_ylabel("y") ax.legend() ax.grid(True) st.pyplot(fig)
079ff8a
verified

VIATEUR-AI commited on

Update README.md
3928ace
verified

VIATEUR-AI commited on

# VMathLab VMathLab ni interactive app igaragaza graphs za **quadratic functions**. - Input: a, b, c (coefficients) - Output: Roots + Graph Ikorwa muri Python na Streamlit. Ishobora gushyirwa kuri Hugging Face Spaces.
14c21be
verified

VIATEUR-AI commited on

streamlit numpy matplotlib
ff0c517
verified

VIATEUR-AI commited on

Create app. py
bd9d0de
verified

VIATEUR-AI commited on

initial commit
e5eef1a
verified

VIATEUR-AI commited on