中文 | English
SymAlpha is an open-source, lightweight shallow alternative to WolframAlpha. It is dedicated to converting natural language mathematical problems into precise symbolic computations and returning intuitive results. The project combines a powerful symbolic computation library with a modern UI framework, supporting local operation or network-based calls to large models for semantic parsing, enabling "speak like a human, compute mathematics".
💡 Goal: Enable non-programmers to easily and freely use symbolic computation without memorizing complex syntax.
- Natural Language Input: Enter queries such as "Find the derivative of x² + 2x + 1" or "Solve the equation x² - 5x + 6 = 0", and the system will automatically parse and compute.
- Two-Mode Parsing:
- Local Mode: A purely rule-based parser with SymPy, no network required, ensuring privacy and security.
- AI-Enhanced Mode (Optional): Call local/remote large models (e.g., Llama, Qwen, OpenAI) to convert ambiguous natural language into precise mathematical expressions.
- High-Performance Backend:
SymPy
: Provides comprehensive symbolic computation capabilities (calculus, algebra, equation solving, etc.).SymEngine
: A SymPy-compatible backend written in C++, accelerating numerical and symbolic operations.gmpy2
: Supports high-precision integer and floating-point operations.
- Interactive Web UI: Built with Streamlit, featuring fast response, support for formula rendering (LaTeX), plotting, and result export.
- Command-Line Interface (CLI): Supports scripted calls for easy integration into other toolchains.
- Modular Design: Easy to extend with new parsers, new computation backends, or new UI components.
src/
├── symalpha/
│ ├── cli/ # Command-Line Interface module
│ └── gui/ # Streamlit Graphical User Interface
.venv/ # Virtual environment created by uv (managed by uv)
pyproject.toml # Project configuration (using uv + pyproject.toml)
README.md
💡 The project uses uv as the package manager and virtual environment tool, replacing pip + venv, with faster speed and more reliable dependency resolution.
- Python 3.10+
- uv
# Clone the repository
git clone https://github.com/your-username/SymAlpha.git
cd SymAlpha
# Create a virtual environment and install dependencies using uv
uv sync
# Activate the virtual environment (Windows)
.venv\Scripts\activate
# Or (Linux/macOS)
source .venv/bin/activate
# Launch the Web UI
uv run streamlit run src/symalpha/gui/app.py
# Or use the CLI (example)
uv run python -m symalpha.cli --query "integrate x^2 dx"
🌐 After the first launch, access
http://localhost:8501
to use the graphical interface.
Input (Natural Language) | Output (Symbolic Result) |
---|---|
Find the indefinite integral of sin(x) |
-cos(x) + C |
Factorize x^3 - 1 |
(x - 1)(x² + x + 1) |
Solve the system of equations: x + y = 5, x - y = 1 |
{x: 3, y: 2} |
Plot the graph of y = x^2 over the interval [-2, 2] |
Interactive chart (rendered by Streamlit) |
We welcome contributions! Please follow these steps:
- Fork this repository
- Create a feature branch (
git checkout -b feat/your-feature
) - Commit your code (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feat/your-feature
) - Create a Pull Request
- Add dependencies:
uv add package-name
- Update dependencies:
uv lock --upgrade
- Export requirements.txt (compatible with traditional tools):
uv export > requirements.txt
This project is licensed under the GPLv3 License.
- SymPy: A powerful Python symbolic computation library
- SymEngine: A high-performance symbolic computation backend
- Streamlit: A minimalist web application framework
- uv: The next-generation Python package manager
- gmpy2: High-precision arithmetic support
SymAlpha —— Bring mathematics back to natural expression, make computation within easy reach.
🧮 Say it. Solve it.