initial commit
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
# SymPy Math App
|
||||
|
||||
Desktop calculator and REPL for [SymPy](https://www.sympy.org/) built with PyQt5. Enter expressions and assignments in one window; results render with SymPy’s pretty printer.
|
||||
|
||||
## Features
|
||||
|
||||
- Evaluate SymPy expressions and run assignments in a persistent namespace
|
||||
- Command history with **Up** / **Down** in the input field
|
||||
- **Show Variables** — user-defined names only
|
||||
- **Show History** — numbered list of prior commands
|
||||
- **Clear** — input and results pane
|
||||
|
||||
## Requirements
|
||||
|
||||
- **Python** 3.8 or newer (recommended; matches SymPy’s supported versions)
|
||||
- **pip**
|
||||
|
||||
| Package | Version |
|
||||
| ---------- | --------- |
|
||||
| PyQt5 | ≥ 5.15.0 |
|
||||
| SymPy | ≥ 1.12 |
|
||||
|
||||
## Quick start
|
||||
|
||||
```bash
|
||||
python -m venv venv
|
||||
```
|
||||
|
||||
Activate the venv (see [Installation](#installation)), then:
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
python main.py
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Create a virtual environment
|
||||
|
||||
**Windows**
|
||||
|
||||
```powershell
|
||||
python -m venv venv
|
||||
```
|
||||
|
||||
**Linux / macOS**
|
||||
|
||||
```bash
|
||||
python3 -m venv venv
|
||||
```
|
||||
|
||||
### 2. Activate it
|
||||
|
||||
**Windows (PowerShell)**
|
||||
|
||||
```powershell
|
||||
.\venv\Scripts\Activate.ps1
|
||||
```
|
||||
|
||||
If execution is blocked:
|
||||
|
||||
```powershell
|
||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
```
|
||||
|
||||
**Windows (Command Prompt)**
|
||||
|
||||
```cmd
|
||||
venv\Scripts\activate.bat
|
||||
```
|
||||
|
||||
**Linux / macOS**
|
||||
|
||||
```bash
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
### 3. Install dependencies
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
1. Run `python main.py`.
|
||||
2. Type a SymPy command and press **Enter** or click **Evaluate**.
|
||||
|
||||
**Examples**
|
||||
|
||||
- `x = Symbol("x")` then `x**2 + 2*x + 1`
|
||||
- `diff(x**2, x)` (after defining `x`)
|
||||
- `integrate(sin(x), x)`
|
||||
|
||||
Assignments use `=`; other lines are evaluated as expressions (via `sympify` / `eval` in the SymPy namespace). **Clear** resets the input and output text only; it does not remove defined variables from the session.
|
||||
|
||||
Deactivate the venv when finished:
|
||||
|
||||
```bash
|
||||
deactivate
|
||||
```
|
||||
|
||||
## Project layout
|
||||
|
||||
```
|
||||
math-app/
|
||||
├── main.py # Application entry point
|
||||
├── requirements.txt # Locked dependency ranges
|
||||
├── README.md
|
||||
└── venv/ # Local virtualenv (create locally; do not commit)
|
||||
```
|
||||
|
||||
## Security note
|
||||
|
||||
The app evaluates user input with `exec` / `eval` in a restricted builtins context but **not** in a sandbox. Only run commands you trust.
|
||||
Reference in New Issue
Block a user