mathstore 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mathstore-0.1.0/PKG-INFO +549 -0
- mathstore-0.1.0/README.md +521 -0
- mathstore-0.1.0/pyproject.toml +67 -0
- mathstore-0.1.0/pyproject.toml.orig +65 -0
- mathstore-0.1.0/src/mathstore/__init__.py +38 -0
- mathstore-0.1.0/src/mathstore/algebra/__init__.py +3 -0
- mathstore-0.1.0/src/mathstore/algebra/solver.py +73 -0
- mathstore-0.1.0/src/mathstore/api/__init__.py +3 -0
- mathstore-0.1.0/src/mathstore/api/main.py +140 -0
- mathstore-0.1.0/src/mathstore/api/routes/__init__.py +13 -0
- mathstore-0.1.0/src/mathstore/api/routes/algebra.py +74 -0
- mathstore-0.1.0/src/mathstore/api/routes/calculus.py +137 -0
- mathstore-0.1.0/src/mathstore/api/routes/matrix.py +49 -0
- mathstore-0.1.0/src/mathstore/api/routes/statistics.py +197 -0
- mathstore-0.1.0/src/mathstore/api/routes/study.py +166 -0
- mathstore-0.1.0/src/mathstore/api/schemas.py +251 -0
- mathstore-0.1.0/src/mathstore/calculus/__init__.py +3 -0
- mathstore-0.1.0/src/mathstore/calculus/analyzer.py +161 -0
- mathstore-0.1.0/src/mathstore/cli.py +369 -0
- mathstore-0.1.0/src/mathstore/core/__init__.py +4 -0
- mathstore-0.1.0/src/mathstore/core/matrix.py +275 -0
- mathstore-0.1.0/src/mathstore/core/safe.py +87 -0
- mathstore-0.1.0/src/mathstore/reference/__init__.py +13 -0
- mathstore-0.1.0/src/mathstore/reference/sheets.py +291 -0
- mathstore-0.1.0/src/mathstore/statistics/__init__.py +3 -0
- mathstore-0.1.0/src/mathstore/statistics/analyzer.py +435 -0
- mathstore-0.1.0/src/mathstore/study/__init__.py +27 -0
- mathstore-0.1.0/src/mathstore/study/practice.py +899 -0
- mathstore-0.1.0/src/mathstore/study/steps.py +359 -0
mathstore-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: mathstore
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A clean, modular mathematical toolkit.
|
|
5
|
+
Keywords: math,calculus,linear-algebra,statistics,fastapi,education,active-recall,edtech,sympy,cli
|
|
6
|
+
Author: mark
|
|
7
|
+
Author-email: mark <munenevictor577@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Education
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
15
|
+
Classifier: Topic :: Education
|
|
16
|
+
Requires-Dist: fastapi>=0.141.1
|
|
17
|
+
Requires-Dist: numpy>=2.5.3
|
|
18
|
+
Requires-Dist: pydantic>=2.13.5
|
|
19
|
+
Requires-Dist: sympy>=1.14.0
|
|
20
|
+
Requires-Dist: uvicorn[standard]>=0.53.0
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Project-URL: Homepage, https://github.com/munenevictor577-blip/mathstore
|
|
23
|
+
Project-URL: Documentation, https://github.com/munenevictor577-blip/mathstore#readme
|
|
24
|
+
Project-URL: Repository, https://github.com/munenevictor577-blip/mathstore
|
|
25
|
+
Project-URL: Issues, https://github.com/munenevictor577-blip/mathstore/issues
|
|
26
|
+
Project-URL: Changelog, https://github.com/munenevictor577-blip/mathstore/blob/main/RELEASE_NOTES.md
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# MathStore 🎓
|
|
30
|
+
|
|
31
|
+
[](https://github.com/munenevictor577-blip/mathstore)
|
|
32
|
+
[](https://github.com/munenevictor577-blip/mathstore)
|
|
33
|
+
[](https://python.org)
|
|
34
|
+
[](https://github.com/astral-sh/ruff)
|
|
35
|
+
|
|
36
|
+
**MathStore** is a clean, modular mathematical toolkit and interactive CLI designed for university students, educators, and STEM practitioners. It covers **symbolic calculus**, **step-by-step derivations**, **linear algebra**, **probability & statistics**, **formula cheat sheets**, and an **active-recall practice quizzer**.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Table of Contents
|
|
41
|
+
|
|
42
|
+
- [Installation & Setup](#installation--setup)
|
|
43
|
+
- [Command-Line Interface (CLI)](#command-line-interface-cli)
|
|
44
|
+
- [Step-by-Step Derivations (`--steps`)](#1-step-by-step-derivations---steps)
|
|
45
|
+
- [Active-Recall Practice Quizzer (`mathstore practice`)](#2-active-recall-practice-quizzer-mathstore-practice)
|
|
46
|
+
- [Calculus & Limits (`diff`, `integrate`, `limit`)](#3-calculus--limits-diff-integrate-limit)
|
|
47
|
+
- [Linear Algebra (`matrix`)](#4-linear-algebra-matrix)
|
|
48
|
+
- [Statistics & Hypothesis Testing (`stats`)](#5-statistics--hypothesis-testing-stats)
|
|
49
|
+
- [Formula Reference Cheat Sheets (`ref`)](#6-formula-reference-cheat-sheets-ref)
|
|
50
|
+
- [FastAPI Remote Server (`/math`)](#fastapi-remote-server-math)
|
|
51
|
+
- [Starting the Server](#starting-the-server)
|
|
52
|
+
- [API Endpoints Overview](#api-endpoints-overview)
|
|
53
|
+
- [cURL Examples](#curl-examples)
|
|
54
|
+
- [Python Library Usage](#python-library-usage)
|
|
55
|
+
- [Calculus & Derivations](#calculus--derivations)
|
|
56
|
+
- [Equation Solving](#equation-solving)
|
|
57
|
+
- [Matrix Analysis](#matrix-analysis)
|
|
58
|
+
- [Statistics & Inference](#statistics--inference)
|
|
59
|
+
- [Practice & Revision API](#practice--revision-api)
|
|
60
|
+
- [Project Architecture](#project-architecture)
|
|
61
|
+
- [Development & Testing](#development--testing)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Installation & Setup
|
|
66
|
+
|
|
67
|
+
### Prerequisites
|
|
68
|
+
|
|
69
|
+
- Python 3.12 or newer
|
|
70
|
+
- [`uv`](https://github.com/astral-sh/uv) (recommended) or `pip`
|
|
71
|
+
|
|
72
|
+
### Install with `uv`
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Clone the repository
|
|
76
|
+
git clone https://github.com/munenevictor577-blip/mathstore.git
|
|
77
|
+
cd mathstore
|
|
78
|
+
|
|
79
|
+
# Sync virtual environment and dependencies
|
|
80
|
+
uv sync
|
|
81
|
+
|
|
82
|
+
# Run the CLI directly
|
|
83
|
+
uv run mathstore --help
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Install with `pip`
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install -e .
|
|
90
|
+
mathstore --help
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Command-Line Interface (CLI)
|
|
96
|
+
|
|
97
|
+
### 1. Step-by-Step Derivations (`--steps`)
|
|
98
|
+
|
|
99
|
+
Add the `--steps` flag to `diff`, `integrate`, or `solve` to view full human-readable derivation trees explaining each mathematical rule applied.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Step-by-step differentiation (Sum, Product, Quotient, Chain & Power rules)
|
|
103
|
+
mathstore diff "x**2 * sin(x)" --steps
|
|
104
|
+
|
|
105
|
+
# Multi-order differentiation breakdown
|
|
106
|
+
mathstore diff "x**3" --order 2 --steps
|
|
107
|
+
|
|
108
|
+
# Step-by-step integration (Substitution, Parts, Power, Trig forms)
|
|
109
|
+
mathstore integrate "x * exp(x)" --steps
|
|
110
|
+
|
|
111
|
+
# Definite integration with Fundamental Theorem of Calculus (FTC) evaluation
|
|
112
|
+
mathstore integrate "x**2" --limits 0 2 --steps
|
|
113
|
+
|
|
114
|
+
# Step-by-step linear and quadratic equation solving
|
|
115
|
+
mathstore solve "2*x + 4 = 10" --steps
|
|
116
|
+
mathstore solve "x**2 - 5*x + 6 = 0" --steps
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Example output for `mathstore diff "x**2 \* sin(x)" --steps`:\*\*
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
Step-by-step differentiation of x**2 * sin(x):
|
|
123
|
+
1. Apply Product Rule to (x**2*sin(x)): (u*v)' = u'*v + u*v' with u = x**2, v = sin(x)
|
|
124
|
+
2. Differentiate u = x**2: Apply Power Rule: d/dx[x^2] = 2*x^1 = 2*x
|
|
125
|
+
3. Differentiate v = sin(x): Standard derivative of sin(x): cos(x)
|
|
126
|
+
4. Substitute into product formula: (2*x)*(sin(x)) + (x**2)*(cos(x)) = x*(x*cos(x) + 2*sin(x))
|
|
127
|
+
Derivative (order 1): x**2*cos(x) + 2*x*sin(x)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### 2. Active-Recall Practice Quizzer (`mathstore practice`)
|
|
133
|
+
|
|
134
|
+
Interactive quizzer designed for exam preparation and active revision with randomized problems, hints, symbolic equivalence verification, and step-by-step solution reveals.
|
|
135
|
+
|
|
136
|
+
- **Topics**: `derivatives` (alias: `calc`, `diff`), `integrals` (alias: `int`), `algebra` (alias: `solve`), `matrix` (alias: `linalg`), `stats`, or `all`
|
|
137
|
+
- **Difficulties**: `easy`, `medium`, `hard`
|
|
138
|
+
- **Smart Equivalence**: Accepts standard math inputs (`^` or `**`, `+ C`, arbitrary constants, permuted products, multi-root sets e.g. `2, 3` or `[2, 3]`).
|
|
139
|
+
|
|
140
|
+
#### Interactive Mode
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Launch interactive 5-question session across all topics
|
|
144
|
+
mathstore practice
|
|
145
|
+
|
|
146
|
+
# Target specific subject and difficulty
|
|
147
|
+
mathstore practice derivatives --difficulty medium
|
|
148
|
+
mathstore practice matrix --difficulty hard -n 3
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
During an interactive quiz:
|
|
152
|
+
|
|
153
|
+
- Type your mathematical answer (e.g. `6*x**2`, `x^2/2 + C`, `2, 3`)
|
|
154
|
+
- Type `hint` for a formula clue
|
|
155
|
+
- Type `skip` to reveal the answer and step-by-step derivation
|
|
156
|
+
- Type `quit` to exit early with score summary
|
|
157
|
+
|
|
158
|
+
#### Non-Interactive Generation (`--generate` / `-g`)
|
|
159
|
+
|
|
160
|
+
Generate practice question cards with hints, answers, and solutions for problem sets or worksheets:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Generate 3 practice problems with full solutions
|
|
164
|
+
mathstore practice --generate --topic algebra -n 3 --seed 42
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### 3. Calculus & Limits (`diff`, `integrate`, `limit`)
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Differentiate expressions
|
|
173
|
+
mathstore diff "sin(x) * exp(x)"
|
|
174
|
+
mathstore diff "x**4" --order 3 --var x
|
|
175
|
+
|
|
176
|
+
# Indefinite integration
|
|
177
|
+
mathstore integrate "cos(x)"
|
|
178
|
+
|
|
179
|
+
# Definite integration with bounds [a, b]
|
|
180
|
+
mathstore integrate "x**2" --limits 0 3
|
|
181
|
+
|
|
182
|
+
# Compute limits
|
|
183
|
+
mathstore limit "sin(x)/x" 0
|
|
184
|
+
mathstore limit "1/x" oo
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
### 4. Linear Algebra (`mathstore matrix`)
|
|
190
|
+
|
|
191
|
+
Perform matrix operations by passing row-separated strings (`"1, 2; 3, 4"` or `"[[1, 2], [3, 4]]"`):
|
|
192
|
+
|
|
193
|
+
| Operation | Command Example | Description |
|
|
194
|
+
| ------------ | ------------------------------------------- | ----------------------------------------------- |
|
|
195
|
+
| `det` | `mathstore matrix det "1, 2; 3, 4"` | Determinant |
|
|
196
|
+
| `inv` | `mathstore matrix inv "1, 2; 3, 4"` | Matrix Inverse |
|
|
197
|
+
| `rref` | `mathstore matrix rref "1, 2, -1; 2, 4, 3"` | Reduced Row Echelon Form |
|
|
198
|
+
| `eigen` | `mathstore matrix eigen "2, 0; 0, 3"` | Eigenvalues & algebraic multiplicities |
|
|
199
|
+
| `eigenvects` | `mathstore matrix eigenvects "2, 0; 0, 3"` | Eigenvectors & eigenspaces |
|
|
200
|
+
| `rank` | `mathstore matrix rank "1, 2; 2, 4"` | Matrix Rank |
|
|
201
|
+
| `nullity` | `mathstore matrix nullity "1, 2; 2, 4"` | Dimension of null space |
|
|
202
|
+
| `trace` | `mathstore matrix trace "5, 1; 2, 3"` | Sum of diagonal entries |
|
|
203
|
+
| `transpose` | `mathstore matrix transpose "1, 2; 3, 4"` | Matrix Transpose |
|
|
204
|
+
| `charpoly` | `mathstore matrix charpoly "1, 2; 3, 4"` | Characteristic polynomial $\det(\lambda I - A)$ |
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### 5. Statistics & Hypothesis Testing (`mathstore stats`)
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Five-number summary & distribution statistics (Mean, Median, Std, IQR, Skewness, Kurtosis)
|
|
212
|
+
mathstore stats summary "10, 12, 14, 15, 18, 20, 22"
|
|
213
|
+
|
|
214
|
+
# Normal distribution PDF, CDF, and z-score
|
|
215
|
+
mathstore stats normal 1.96 --mu 0 --sigma 1
|
|
216
|
+
|
|
217
|
+
# Binomial distribution PMF: P(X = k) and CDF: P(X <= k)
|
|
218
|
+
mathstore stats binomial 3 --n 10 --p 0.5
|
|
219
|
+
|
|
220
|
+
# Poisson distribution PMF & CDF
|
|
221
|
+
mathstore stats poisson 2 --lam 3.0
|
|
222
|
+
|
|
223
|
+
# Confidence Interval for sample mean
|
|
224
|
+
mathstore stats ci "22, 25, 27, 24, 26, 28" --confidence 0.95
|
|
225
|
+
|
|
226
|
+
# One-sample Student's t-test (two-sided, greater, or less)
|
|
227
|
+
mathstore stats ttest "10.2, 9.8, 10.5, 10.1, 9.9" --pop-mean 10.0 --alt two-sided
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
### 6. Formula Reference Cheat Sheets (`ref`)
|
|
233
|
+
|
|
234
|
+
Lookup high-yield formula cheat sheets directly in the terminal:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# List all available reference cheat sheets
|
|
238
|
+
mathstore ref --list
|
|
239
|
+
|
|
240
|
+
# View specific cheat sheet
|
|
241
|
+
mathstore ref derivatives
|
|
242
|
+
mathstore ref integrals
|
|
243
|
+
mathstore ref trig
|
|
244
|
+
mathstore ref limits
|
|
245
|
+
mathstore ref series
|
|
246
|
+
|
|
247
|
+
# Export reference cheat sheet in LaTeX format
|
|
248
|
+
mathstore ref derivatives --latex
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
### 7. Formatting: LaTeX & Unicode (`--latex`, `--pretty`)
|
|
254
|
+
|
|
255
|
+
All analytical commands (`diff`, `integrate`, `limit`, `solve`, `matrix`, `stats`) support `--latex` and `--pretty` output flags for homework, lab reports, and LaTeX documents:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# LaTeX output for report insertion
|
|
259
|
+
mathstore diff "sin(x)/x" --latex
|
|
260
|
+
mathstore matrix inv "1, 2; 3, 4" --latex
|
|
261
|
+
mathstore stats summary "10, 12, 14, 15, 18" --latex
|
|
262
|
+
|
|
263
|
+
# Pretty Unicode formatting for clean terminal viewing
|
|
264
|
+
mathstore diff "x**3 + 2*x" --pretty
|
|
265
|
+
mathstore matrix rref "1, 2; 3, 4" --pretty
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## FastAPI Remote Server (`/math`)
|
|
271
|
+
|
|
272
|
+
MathStore includes a production-ready FastAPI server with CORS support and OpenAPI documentation, enabling remote calling over HTTP from web applications, mobile clients, and microservices.
|
|
273
|
+
|
|
274
|
+
### Starting the Server
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# Using uvicorn directly
|
|
278
|
+
uv run uvicorn mathstore.api.main:app --host 0.0.0.0 --port 8000
|
|
279
|
+
|
|
280
|
+
# Using the registered script command
|
|
281
|
+
uv run mathstore-server
|
|
282
|
+
|
|
283
|
+
# Or using the top-level api alias
|
|
284
|
+
uv run uvicorn api.main:app --host 0.0.0.0 --port 8000
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
- **Interactive Swagger UI**: [http://localhost:8000/math/docs](http://localhost:8000/math/docs)
|
|
288
|
+
- **ReDoc Documentation**: [http://localhost:8000/math/redoc](http://localhost:8000/math/redoc)
|
|
289
|
+
- **OpenAPI Schema**: [http://localhost:8000/math/openapi.json](http://localhost:8000/math/openapi.json)
|
|
290
|
+
- **Health Check**: [http://localhost:8000/math/health](http://localhost:8000/math/health)
|
|
291
|
+
- **API Index**: [http://localhost:8000/math](http://localhost:8000/math)
|
|
292
|
+
|
|
293
|
+
### API Endpoints Overview
|
|
294
|
+
|
|
295
|
+
All mathematical endpoints are mounted under the `/math` prefix (with `/api/v1/math` preserved for backward compatibility):
|
|
296
|
+
|
|
297
|
+
| Category | Method & Path | Description |
|
|
298
|
+
|---|---|---|
|
|
299
|
+
| **Calculus** | `POST, GET /math/diff` | Differentiate with optional steps & formatting |
|
|
300
|
+
| | `POST, GET /math/integrate` | Indefinite / definite integral with steps |
|
|
301
|
+
| | `POST, GET /math/limit` | Evaluate limits |
|
|
302
|
+
| **Algebra** | `POST, GET /math/solve` | Solve equations with optional steps |
|
|
303
|
+
| | `POST, GET /math/simplify` | Simplify expressions |
|
|
304
|
+
| **Matrix** | `POST /math/matrix/{operation}` | Matrix ops: `det`, `inv`, `rref`, `eigen`, `rank`, `trace`, etc. |
|
|
305
|
+
| **Statistics**| `POST /math/stats/summary` | Descriptive summary statistics |
|
|
306
|
+
| | `POST, GET /math/stats/normal` | Normal distribution PDF, CDF, z-score |
|
|
307
|
+
| | `POST, GET /math/stats/binomial`| Binomial PMF and CDF |
|
|
308
|
+
| | `POST, GET /math/stats/poisson` | Poisson PMF and CDF |
|
|
309
|
+
| | `POST /math/stats/ci` | Confidence intervals |
|
|
310
|
+
| | `POST /math/stats/ttest` | One-sample Student's t-test |
|
|
311
|
+
| **Steps** | `POST, GET /math/steps/diff` | Step-by-step differentiation |
|
|
312
|
+
| | `POST, GET /math/steps/integrate` | Step-by-step integration |
|
|
313
|
+
| | `POST, GET /math/steps/solve` | Step-by-step equation solving |
|
|
314
|
+
| **Practice** | `GET /math/practice/question` | Generate randomized revision question |
|
|
315
|
+
| | `POST /math/practice/check` | Validate answer with symbolic equivalence |
|
|
316
|
+
| **Reference**| `GET /math/ref` | List formula cheat sheet topics |
|
|
317
|
+
| | `GET /math/ref/{topic}` | Get cheat sheet (text or LaTeX) |
|
|
318
|
+
| **Health** | `GET /math/health` | Service health status |
|
|
319
|
+
|
|
320
|
+
### cURL Examples
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# Differentiate with step-by-step breakdown
|
|
324
|
+
curl -X POST http://localhost:8000/math/diff \
|
|
325
|
+
-H "Content-Type: application/json" \
|
|
326
|
+
-d '{"expression": "x**2 * sin(x)", "steps": true}'
|
|
327
|
+
|
|
328
|
+
# Definite integration
|
|
329
|
+
curl -X POST http://localhost:8000/math/integrate \
|
|
330
|
+
-H "Content-Type: application/json" \
|
|
331
|
+
-d '{"expression": "x**2", "limits": [0, 2], "steps": true}'
|
|
332
|
+
|
|
333
|
+
# Solve an equation
|
|
334
|
+
curl -X POST http://localhost:8000/math/solve \
|
|
335
|
+
-H "Content-Type: application/json" \
|
|
336
|
+
-d '{"equation": "2*x + 4 = 10", "steps": true}'
|
|
337
|
+
|
|
338
|
+
# Calculate 2x2 matrix determinant
|
|
339
|
+
curl -X POST http://localhost:8000/math/matrix/det \
|
|
340
|
+
-H "Content-Type: application/json" \
|
|
341
|
+
-d '{"matrix": "1, 2; 3, 4"}'
|
|
342
|
+
|
|
343
|
+
# Normal distribution calculation
|
|
344
|
+
curl -X POST http://localhost:8000/math/stats/normal \
|
|
345
|
+
-H "Content-Type: application/json" \
|
|
346
|
+
-d '{"x": 1.96, "mu": 0, "sigma": 1}'
|
|
347
|
+
|
|
348
|
+
# Generate practice question
|
|
349
|
+
curl http://localhost:8000/math/practice/question?topic=derivatives
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Python Library Usage
|
|
355
|
+
|
|
356
|
+
MathStore is built as a modular Python library. You can import any analyzer, step generator, or quiz component directly into your scripts or Jupyter notebooks.
|
|
357
|
+
|
|
358
|
+
### Calculus & Derivations
|
|
359
|
+
|
|
360
|
+
```python
|
|
361
|
+
from mathstore.calculus import CalculusAnalyzer
|
|
362
|
+
from mathstore.study import get_derivative_steps, get_integral_steps
|
|
363
|
+
|
|
364
|
+
calc = CalculusAnalyzer()
|
|
365
|
+
|
|
366
|
+
# Basic differentiation and integration
|
|
367
|
+
deriv = calc.differentiate("x**2 * sin(x)", variable="x", order=1)
|
|
368
|
+
integral = calc.integrate("x * exp(x)", variable="x")
|
|
369
|
+
lim = calc.get_limit("sin(x)/x", limits=0, variable="x")
|
|
370
|
+
|
|
371
|
+
# Step-by-step differentiation breakdown
|
|
372
|
+
diff_steps = calc.differentiate_steps("x**2 * sin(x)", variable="x")
|
|
373
|
+
for step in diff_steps:
|
|
374
|
+
print(step)
|
|
375
|
+
|
|
376
|
+
# Step-by-step definite integration with FTC evaluation
|
|
377
|
+
int_steps = calc.integrate_steps("x**2", variable="x", limits=(0, 2))
|
|
378
|
+
for step in int_steps:
|
|
379
|
+
print(step)
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Equation Solving
|
|
383
|
+
|
|
384
|
+
```python
|
|
385
|
+
from mathstore.algebra import EquationSolver
|
|
386
|
+
|
|
387
|
+
solver = EquationSolver()
|
|
388
|
+
|
|
389
|
+
# Solve linear or quadratic equations
|
|
390
|
+
solutions = solver.solve_linear("x**2 - 5*x + 6 = 0", variable="x")
|
|
391
|
+
print("Roots:", solutions) # [2, 3]
|
|
392
|
+
|
|
393
|
+
# Step-by-step derivation
|
|
394
|
+
steps = solver.solve_steps("2*x + 4 = 10", variable="x")
|
|
395
|
+
for step in steps:
|
|
396
|
+
print(step)
|
|
397
|
+
|
|
398
|
+
# Format solution as LaTeX
|
|
399
|
+
latex_str = solver.format_solution(solutions, variable="x", format="latex")
|
|
400
|
+
print(latex_str) # x \in \left\{ 2, 3 \right\}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Matrix Analysis
|
|
404
|
+
|
|
405
|
+
```python
|
|
406
|
+
from mathstore.core import MatrixAnalyzer
|
|
407
|
+
|
|
408
|
+
matrix_analyzer = MatrixAnalyzer()
|
|
409
|
+
mat_str = "1, 2; 3, 4"
|
|
410
|
+
|
|
411
|
+
det = matrix_analyzer.determinant(mat_str)
|
|
412
|
+
inv = matrix_analyzer.inverse(mat_str)
|
|
413
|
+
rref_mat, pivots = matrix_analyzer.rref("1, 2, -1; 2, 4, 3")
|
|
414
|
+
eigenvalues = matrix_analyzer.eigenvalues("2, 0; 0, 3")
|
|
415
|
+
rank_val = matrix_analyzer.rank(mat_str)
|
|
416
|
+
trace_val = matrix_analyzer.trace(mat_str)
|
|
417
|
+
|
|
418
|
+
print("Det:", det)
|
|
419
|
+
print("Trace:", trace_val)
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Statistics & Inference
|
|
423
|
+
|
|
424
|
+
```python
|
|
425
|
+
from mathstore.statistics import StatsAnalyzer
|
|
426
|
+
|
|
427
|
+
stats = StatsAnalyzer()
|
|
428
|
+
data = [10.2, 11.5, 12.1, 9.8, 10.9, 11.2]
|
|
429
|
+
|
|
430
|
+
# Summary statistics dictionary
|
|
431
|
+
summary = stats.summary(data)
|
|
432
|
+
print("Mean:", summary["mean"], "Std Dev:", summary["std_dev"])
|
|
433
|
+
|
|
434
|
+
# Confidence interval
|
|
435
|
+
ci_lower, ci_upper, margin = stats.confidence_interval(data, confidence=0.95)
|
|
436
|
+
print(f"95% CI: [{ci_lower:.2f}, {ci_upper:.2f}] ± {margin:.2f}")
|
|
437
|
+
|
|
438
|
+
# Hypothesis testing (One-sample Student's t-test)
|
|
439
|
+
test_results = stats.one_sample_t_test(data, pop_mean=10.0, alternative="two-sided")
|
|
440
|
+
print(f"t-stat: {test_results['t_statistic']:.4f}, p-value: {test_results['p_value']:.4f}")
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Practice & Revision API
|
|
444
|
+
|
|
445
|
+
```python
|
|
446
|
+
from mathstore.study import (
|
|
447
|
+
generate_question,
|
|
448
|
+
check_answer,
|
|
449
|
+
format_question_card,
|
|
450
|
+
PracticeSession,
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
# Generate a randomized question with hint and steps
|
|
454
|
+
question = generate_question(topic="derivatives", difficulty="medium", seed=42)
|
|
455
|
+
print("Prompt:", question.prompt)
|
|
456
|
+
print("Hint:", question.hint)
|
|
457
|
+
print("Expected:", question.expected_answer)
|
|
458
|
+
|
|
459
|
+
# Verify a student's answer using symbolic equivalence
|
|
460
|
+
is_correct, feedback = check_answer("2*cos(2*x)", question)
|
|
461
|
+
print("Correct?", is_correct, "-", feedback)
|
|
462
|
+
|
|
463
|
+
# Format as printable problem card
|
|
464
|
+
print(format_question_card(question))
|
|
465
|
+
|
|
466
|
+
# Run an interactive practice session programmatically
|
|
467
|
+
session = PracticeSession(topic="all", count=5, difficulty="medium")
|
|
468
|
+
results = session.run()
|
|
469
|
+
print("Score:", results["percentage"], "%")
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## Project Architecture
|
|
475
|
+
|
|
476
|
+
```text
|
|
477
|
+
mathstore/
|
|
478
|
+
├── pyproject.toml # Build & dependency configuration
|
|
479
|
+
├── README.md # Documentation & usage guide
|
|
480
|
+
├── api/ # Top-level API alias package
|
|
481
|
+
│ ├── __init__.py
|
|
482
|
+
│ └── main.py # uvicorn api.main:app entrypoint
|
|
483
|
+
├── src/mathstore/
|
|
484
|
+
│ ├── __init__.py # Public top-level exports
|
|
485
|
+
│ ├── cli.py # Argparse CLI interface
|
|
486
|
+
│ ├── algebra/
|
|
487
|
+
│ │ └── solver.py # Linear & polynomial equation solver
|
|
488
|
+
│ ├── api/
|
|
489
|
+
│ │ ├── __init__.py
|
|
490
|
+
│ │ ├── main.py # FastAPI application & server runner
|
|
491
|
+
│ │ ├── schemas.py # Pydantic request & response models
|
|
492
|
+
│ │ └── routes/ # Route modules (/math)
|
|
493
|
+
│ ├── calculus/
|
|
494
|
+
│ │ └── analyzer.py # Differentiation, integration, and limits
|
|
495
|
+
│ ├── core/
|
|
496
|
+
│ │ └── matrix.py # Matrix operations, RREF, eigenvalues
|
|
497
|
+
│ ├── reference/
|
|
498
|
+
│ │ └── sheets.py # Formula cheat sheets (derivatives, trig, etc.)
|
|
499
|
+
│ ├── statistics/
|
|
500
|
+
│ │ └── analyzer.py # Descriptive stats, distributions, CI, t-tests
|
|
501
|
+
│ └── study/
|
|
502
|
+
│ ├── steps.py # Step-by-step derivation generators
|
|
503
|
+
│ └── practice.py # Active-recall quizzer & answer verification
|
|
504
|
+
└── tests/ # Pytest test suites (257 tests, 91% coverage)
|
|
505
|
+
├── test_algebra.py
|
|
506
|
+
├── test_api.py
|
|
507
|
+
├── test_calculus.py
|
|
508
|
+
├── test_cli.py
|
|
509
|
+
├── test_matrix.py
|
|
510
|
+
├── test_practice.py
|
|
511
|
+
├── test_reference.py
|
|
512
|
+
├── test_statistics.py
|
|
513
|
+
└── test_steps.py
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
## Development & Testing
|
|
519
|
+
|
|
520
|
+
Run all unit tests, coverage reports, and linter checks with `uv`:
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
# Run all unit tests
|
|
524
|
+
uv run pytest
|
|
525
|
+
|
|
526
|
+
# Run tests with terminal coverage report
|
|
527
|
+
uv run pytest --cov=mathstore --cov-report=term-missing
|
|
528
|
+
|
|
529
|
+
# Run code style & linting checks
|
|
530
|
+
uvx ruff check .
|
|
531
|
+
|
|
532
|
+
# Auto-format code
|
|
533
|
+
uvx ruff format .
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
## Roadmap & Cloud Service
|
|
539
|
+
|
|
540
|
+
MathStore is under active development. Upcoming milestones include:
|
|
541
|
+
- **Managed Cloud API**: Hosted high-availability API with API keys and rate limiting for EdTech platforms and LMS integrations.
|
|
542
|
+
- **Web & Mobile Interface**: Interactive active-recall study companion with visual step-by-step derivations.
|
|
543
|
+
- **Extended Solvers**: Support for ordinary differential equations (ODEs), vector calculus, and LaTeX export templates.
|
|
544
|
+
|
|
545
|
+
If you are interested in early access to the managed cloud API or want to request features for your institution, feel free to open an [Issue](https://github.com/munenevictor577-blip/mathstore/issues) or reach out to the maintainers.
|
|
546
|
+
|
|
547
|
+
## License
|
|
548
|
+
|
|
549
|
+
This project is licensed under the MIT License.
|