mathgenerator
A math problem generator, created for the purpose of giving self-studying students and teaching organizations the means to easily get access to random math problems to suit their needs.
To try out generators, go to https://todarith.ml/generate/
If you have an idea for a generator, please add it as an issue and tag it with the "New Generator" label.
Usage
The project can be install via pip
pip install mathgenerator
Here is an example of how you would generate an addition problem:
from mathgenerator import mathgen
#generate an addition problem
problem, solution = mathgen.addition()
#another way to generate an addition problem using genById()
problem, solution = mathgen.genById(0)
List of Generators
| Id | Skill | Example problem | Example Solution | Function Name |
|---|
| 0 | Addition | 39+50= | 89 | addition | | 1 | Subtraction | 91-37= | 54 | subtraction | | 2 | Multiplication | 391= | 39 | multiplication | | 3 | Division | 67/85= | 0.788235294117647 | division | | 4 | Binary Complement 1s | 1101100101= | 0010011010 | binary_complement_1s | | 5 | Modulo Division | 72%26= | 20 | modulo_division | | 6 | Square Root | sqrt(16)= | 4 | square_root | | 7 | Power Rule Differentiation | 4x^1 | 4x^0 | power_rule_differentiation | | 8 | Square | 20^2= | 400 | square | | 9 | LCM (Least Common Multiple) | LCM of 5 and 2 = | 10 | lcm | | 10 | GCD (Greatest Common Denominator) | GCD of 17 and 20 = | 1 | gcd | | 11 | Basic Algebra | 10x + 8 = 8 | 0 | basic_algebra | | 12 | Logarithm | log2(64) | 6 | log | | 13 | Easy Division | 147/7 = | 21 | int_division | | 14 | Decimal to Binary | Binary of 4= | 100 | decimal_to_binary | | 15 | Binary to Decimal | 010111110 | 190 | binary_to_decimal | | 16 | Fraction Division | (2/10)/(8/4) | 1/10 | divide_fractions | | 17 | Integer Multiplication with 2x2 Matrix | 9 * 6, 1], [1, 3 = | 54,9],[9,27 | multiply_int_to_22_matrix | | 18 | Area of Triangle | Area of triangle with side lengths: 19 17 10 = | 84.71127433818948 | area_of_triangle | | 19 | Triangle exists check | Does triangle with sides 29, 13 and 3 exist? | No | valid_triangle | | 20 | Midpoint of the two point | (10,-14),(-4,-1)= | (3.0,-7.5) | midpoint_of_two_points | | 21 | Factoring Quadratic | x^2-18x+81 | (x-9)(x-9) | factoring | | 22 | Third Angle of Triangle | Third angle of triangle with angles 68 and 78 = | 34 | third_angle_of_triangle | | 23 | Solve a System of Equations in R^2 | -4x - 10y = 24, -4x - 3y = -4 | x = 4, y = -4 | system_of_equations | | 24 | Distance between 2 points | Find the distance between (8, 5) and (13, 9) | sqrt(41) | distance_two_points | | 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 12 and 2 = | 12.17 | pythagorean_theorem | | 26 | Linear Equations | 19x + -13y = -450, 10x + 10y = 100 | x = -10, y = 20 | linear_equations | | 27 | Prime Factorisation | Find prime factors of 59 | [59] | prime_factors | | 28 | Fraction Multiplication | (6/1)(3/10) | 9/5 | fraction_multiplication | | 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 16 sides | 157.5 | angle_regular_polygon | | 30 | Combinations of Objects | Number of combinations from 18 objects picked 6 at a time | 18564 | combinations | | 31 | Factorial | 3! = | 6 | factorial | | 32 | Surface Area of Cube | Surface area of cube with side = 19m is | 2166 m^2 | surface_area_cube | | 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 5m, 1m, 6m is | 82 m^2 | surface_area_cuboid | | 34 | Surface Area of Cylinder | Surface area of cylinder with height = 15m and radius = 17m is | 3418 m^2 | surface_area_cylinder | | 35 | Volum of Cube | Volume of cube with side = 10m is | 1000 m^3 | volume_cube | | 36 | Volume of Cuboid | Volume of cuboid with sides = 10m, 16m, 1m is | 160 m^3 | volume_cuboid | | 37 | Volume of cylinder | Volume of cylinder with height = 34m and radius = 16m is | 27344 m^3 | volume_cylinder | | 38 | Surface Area of cone | Surface area of cone with height = 15m and radius = 2m is | 107 m^2 | surface_area_cone | | 39 | Volume of cone | Volume of cone with height = 19m and radius = 9m is | 1611 m^3 | volume_cone | | 40 | Common Factors | Common Factors of 56 and 69 = | [1] | common_factors | | 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -2x - 10 and y = -8/5x - 5 | (-25/2, 15) | intersection_of_two_lines | | 42 | Permutations | Number of Permutations from 17 objects picked 4 at a time = | 57120 | permutation | | 43 | Cross Product of 2 Vectors | [-16, 6, -14] X [-17, -6, -5] = | [-114, 158, 198] | vector_cross | | 44 | Compare Fractions | Which symbol represents the comparison between 1/10 and 8/7? | < | compare_fractions | | 45 | Simple Interest | Simple interest for a principle amount of 8073 dollars, 8% rate of interest and for a time period of 3 years is = | 1937.52 | simple_interest | | 46 | Multiplication of two matrices | Multiply
| -1 | -7 |
| -7 | 2 |
| -8 | 2 |
| -8 | 2 |
| 9 | -4 | 3 |
| -9 | -8 | -1 |
| 54 | 60 | 4 |
| -81 | 12 | -23 |
| -90 | 16 | -26 |
| -90 | 16 | -26 |