mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
* Create ids list * rm Genimprt, rm inst in algebra + basic_math * computer science and calculus no inst * Remove instances from geometry * remove instances from misc * remove instances from permutations * fix under indentations * improve binary_complement_1s * Remove generator.py * initial docs setup * move modules out of funcs, regen docs * Move subjects to single files * pdoc docs * add make docs * Remove mid-file imports, delete templates * lint fixes * Use math in docs * remove format string from complex_quad * regen docs * Lint fix * Hide non-generator modules from docs * Hide utility methods from docs * Created _gen_list.py * Remove docs from readme * replace tabs with 4 spaces * lint fixes * little docs changes * docstrings for half of subjects * Added example docs for remaining generators * update docs * Update intersection of two lines #408 * Snake case variables; for #406 * update docs * Remove escaped backslashes; for #407 * autopep8 * lint fix * lint fix * remove gcd duplicates; for #401 * Add missing delimiter for fraction_multiplication * rebuild docs
68 lines
2.6 KiB
Markdown
68 lines
2.6 KiB
Markdown
# mathgenerator
|
|
|
|
A math problem generator, created for the purpose of giving teachers and students the means to easily get access to random math exercises to suit their needs.
|
|
|
|
To try out generators, go to <https://lukew3.github.io/mathgenerator>
|
|
|
|
See [CONTRIBUTING.md](https://github.com/lukew3/mathgenerator/blob/main/CONTRIBUTING.md) for information about how to contribute.
|
|
|
|
## Table of Contents
|
|
* [Installation](#installation)
|
|
* [Usage](#usage)
|
|
* [Documentation](#documentation)
|
|
|
|
## Installation
|
|
|
|
The project can be install via pip
|
|
|
|
```bash
|
|
pip install mathgenerator
|
|
```
|
|
|
|
## Usage
|
|
Here is an example of how you would generate an addition problem:
|
|
|
|
```python
|
|
import mathgenerator
|
|
|
|
#generate an addition problem
|
|
problem, solution = mathgenerator.addition()
|
|
|
|
#another way to generate an addition problem using genById()
|
|
problem, solution = mathgenerator.genById(0)
|
|
```
|
|
You may prefer to use `import mathgenerator as mg` and run functions like `mg.addition()` so that you don't have to type as much.
|
|
<!--
|
|
### Creating a worksheet
|
|
If you wish to create a worksheet, you can use the [worksheetgen](https://github.com/lukew3/worksheetgen) package. Install this with `pip install worksheetgen`. Here is an example of how a worksheet would be generated.
|
|
```
|
|
from mathgenerator import mathgen
|
|
from worksheetgen.wg import Worksheet
|
|
|
|
ws = Worksheet("Worksheet title")
|
|
with ws.section('Section 1', description='These are instructions')
|
|
# Writes 10 problems generated with id 1, [0] at the end specifies to take problem, and not solution.
|
|
for _ in range(10):
|
|
ws.add_problem(mathgen.genById(1)[0])
|
|
ws.write_pdf()
|
|
```
|
|
This creates the pdf `ws.pdf` in your current directory
|
|
-->
|
|
Problem/solution pairs are generated with either:
|
|
* `mathgenerator.<generator_name>()` - generates a problem, solution set from the given generator name.
|
|
* `mathgenerator.genById(id)` - generates a problem, solution set with generator id provided by the `id` parameter
|
|
|
|
<!--
|
|
#### `format` kwarg
|
|
* Pass `format=latex` to return problem and solution set as latex. If latex is not available for that generator, the problem will return the string "Latex unavailable"
|
|
* Pass `format=raw` to return just the raw data for each generator. An array of each variable necessary to the generator is returned.
|
|
* If you don't pass a value to the format kwarg, the generator will return a problem and answer in asciimath format.
|
|
-->
|
|
You can also use `getGenList()` to return a list of all generators included in the library in the format:
|
|
```
|
|
[id, title, gen_func, funcname, subjectname, kwargs]
|
|
```
|
|
|
|
## Documentation
|
|
Documentation can be found at https://lukew3.github.io/mathgenerator
|