Files
sympy-app/README.md
T
2026-04-01 23:22:35 +03:00

2.3 KiB
Raw Blame History

SymPy Math App

Desktop calculator and REPL for SymPy built with PyQt5. Enter expressions and assignments in one window; results render with SymPys 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 SymPys supported versions)
  • pip
Package Version
PyQt5 ≥ 5.15.0
SymPy ≥ 1.12

Quick start

python -m venv venv

Activate the venv (see Installation), then:

pip install -r requirements.txt
python main.py

Installation

1. Create a virtual environment

Windows

python -m venv venv

Linux / macOS

python3 -m venv venv

2. Activate it

Windows (PowerShell)

.\venv\Scripts\Activate.ps1

If execution is blocked:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Windows (Command Prompt)

venv\Scripts\activate.bat

Linux / macOS

source venv/bin/activate

3. Install dependencies

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:

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.