mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
185 lines
16 KiB
Markdown
185 lines
16 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
pip install mathgenerator
|
|
```
|
|
|
|
Here is an example of how you would generate an addition problem:
|
|
|
|
```python
|
|
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)
|
|
```
|
|
## Documentation
|
|
`getGenList()` returns a list of all generators in the repository in the format `[id, title, self, funcname]`
|
|
|
|
`genById(id)` generates a problem, solution set with generator id `id` in the form of a list in the format `[problem, solution]`
|
|
|
|
`make_pdf(id, count)` creates a printable pdf worksheet with `count` problems generated by the generator with id `id`.
|
|
|
|
### More complicated worksheets
|
|
|
|
```
|
|
import sys
|
|
from mathgenerator import mathgen
|
|
|
|
worksheet = mathgen.make_worksheet("2020-11-29")
|
|
mathgen.add_section_with_task_to_worksheet(worksheet, 105, 5)
|
|
mathgen.add_section_with_task_to_worksheet(worksheet, 2, 5)
|
|
mathgen.write_pdf(worksheet)
|
|
```
|
|
|
|
## List of Generators
|
|
|
|
| Id | Skill | Example problem | Example Solution | Function Name |
|
|
|------|-------|-----------------|------------------|---------------|
|
|
## algebra
|
|
| Id | Skill | Example problem | Example Solution | Function Name |
|
|
|------|-------|-----------------|------------------|---------------|
|
|
| 11 | Basic Algebra | 8x + 7 = 7 | 0 | basic_algebra |
|
|
| 12 | Logarithm | log2(32) | 5 | log |
|
|
| 17 | Integer Multiplication with 2x2 Matrix | 10 * [[10, 4], [7, 0]] = | [[100,40],[70,0]] | multiply_int_to_22_matrix |
|
|
| 20 | Midpoint of the two point | (-11,1),(20,-20)= | (4.5,-9.5) | midpoint_of_two_points |
|
|
| 21 | Factoring Quadratic | x^2+14x+49 | (x+7)(x+7) | factoring |
|
|
| 23 | Solve a System of Equations in R^2 | 5x - y = 36, 8x + 7y = 135 | x = 9, y = 9 | system_of_equations |
|
|
| 24 | Distance between 2 points | Find the distance between (4, -7) and (-17, 21) | sqrt(1225) | distance_two_points |
|
|
| 26 | Linear Equations | -16x + 18y = -282, -4x + -14y = 22 | x = 12, y = -5 | linear_equations |
|
|
| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 1/3x - 10 and y = -10/4x - 2 | (48/17, -154/17) | intersection_of_two_lines |
|
|
| 43 | Cross Product of 2 Vectors | [14, 0, 10] X [18, -17, 17] = | [170, -58, -238] | vector_cross |
|
|
| 45 | Simple Interest | Simple interest for a principle amount of 5365 dollars, 4% rate of interest and for a time period of 1 years is = | 214.6 | simple_interest |
|
|
| 46 | Multiplication of two matrices | Multiply<table><tr><td>5</td><td>-9</td></tr><tr><td>0</td><td>-2</td></tr><tr><td>-7</td><td>8</td></tr></table>and<table><tr><td>9</td><td>9</td><td>-9</td><td>-3</td></tr><tr><td>6</td><td>-8</td><td>-9</td><td>8</td></tr></table> | <table><tr><td>-9</td><td>117</td><td>36</td><td>-87</td></tr><tr><td>-12</td><td>16</td><td>18</td><td>-16</td></tr><tr><td>-15</td><td>-127</td><td>-9</td><td>85</td></tr></table> | matrix_multiplication |
|
|
| 50 | Quadratic Equation | Zeros of the Quadratic Equation 1x^2+15x+17=0 | [-1.24, -13.76] | quadratic_equation |
|
|
| 65 | Multiplication of 2 complex numbers | (17+15j) * (-20-10j) = | (-190-470j) | multiply_complex_numbers |
|
|
| 72 | Dot Product of 2 Vectors | [3, -14, -17] . [6, 16, -11] = | -19 | vector_dot |
|
|
| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[38, 76, 13], [27, 97, 60], [32, 17, 71]]) is: | Matrix([[5867/188789, -5175/188789, 3299/188789], [3/188789, 2282/188789, -1929/188789], [-2645/188789, 1786/188789, 1634/188789]]) | invert_matrix |
|
|
| 77 | Determinant to 2x2 Matrix | Det([[49, 17], [48, 27]]) = | 507 | int_matrix_22_determinant |
|
|
| 78 | Compound Interest | Compound interest for a principle amount of 5556 dollars, 6% rate of interest and for a time period of 9 year is = | 9386.75 | compound_interest |
|
|
| 100 | complex Quadratic Equation | Find the roots of given Quadratic Equation x^2 + 8x + 9 = 0 | simplified solution : ((-1.354, -6.646)), generalized solution : ((-8 + sqrt(28))/2*1, (-8 - sqrt(28))/2*1) | complex_quadratic |
|
|
| 105 | Combine Like terms | 9x^8 + 10x^4 + 10x^6 + 10x^2 + 7x^2 + 6x^6 + 5x^5 + 8x^4 + 10x^8 + 7x^1 | 7x^1 + 17x^2 + 18x^4 + 5x^5 + 16x^6 + 19x^8 | combine_like_terms |
|
|
| 111 | Expanding Factored Binomial | (-3x-5)(+10x+6) | -30*x^2-68*x-30 | expanding |
|
|
## basic_math
|
|
| Id | Skill | Example problem | Example Solution | Function Name |
|
|
|------|-------|-----------------|------------------|---------------|
|
|
| 0 | Addition | 27+49= | 76 | addition |
|
|
| 1 | Subtraction | 32-6= | 26 | subtraction |
|
|
| 2 | Multiplication | 36*1= | 36 | multiplication |
|
|
| 3 | Division | 450/18= | 25 | division |
|
|
| 6 | Square Root | sqrt(1)= | 1 | square_root |
|
|
| 8 | Square | 6^2= | 36 | square |
|
|
| 13 | Complex Division | 30/91= | 0.33 | complex_division |
|
|
| 16 | Fraction Division | (6/8)/(7/2) | 3/14 | divide_fractions |
|
|
| 28 | Fraction Multiplication | (8/3)*(2/8) | 2/3 | fraction_multiplication |
|
|
| 31 | Factorial | 5! = | 120 | factorial |
|
|
| 44 | Compare Fractions | Which symbol represents the comparison between 1/7 and 1/8? | > | compare_fractions |
|
|
| 47 | Cube Root | cuberoot of 875 upto 2 decimal places is: | 9.56 | cube_root |
|
|
| 53 | Exponentiation | 14^1 = | 14 | exponentiation |
|
|
| 71 | Absolute difference between two numbers | Absolute difference between numbers -98 and -100 = | 2 | absolute_difference |
|
|
| 80 | Percentage of a number | What is 34% of 29? | Required percentage = 9.86% | percentage |
|
|
| 90 | isprime | 28 | False | is_prime |
|
|
| 97 | Power of Powers | The 6^3^1 = 6^(3*1) = 6^3 | 216 | power_of_powers |
|
|
## calculus
|
|
| Id | Skill | Example problem | Example Solution | Function Name |
|
|
|------|-------|-----------------|------------------|---------------|
|
|
| 7 | Power Rule Differentiation | 2x^2 + 5x^3 + 2x^3 + 3x^10 | 4x^1 + 15x^2 + 6x^2 + 30x^9 | power_rule_differentiation |
|
|
| 48 | Power Rule Integration | 5x^2 + 5x^1 | (5/2)x^3 + (5/1)x^2 + c | power_rule_integration |
|
|
| 88 | Differentiation | differentiate w.r.t x : d(exp(x)+7*x^4)/dx | 28*x^3 + exp(x) | differentiation |
|
|
| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 36x^2 + 57x + 67 is = | 107.5 | definite_integral |
|
|
| 110 | Stationary Points | f(x)=10*x^2 + 3*x + 10 | (-3/20,391/40) | stationary_points |
|
|
## computer_science
|
|
| Id | Skill | Example problem | Example Solution | Function Name |
|
|
|------|-------|-----------------|------------------|---------------|
|
|
| 4 | Binary Complement 1s | 01100= | 10011 | binary_complement_1s |
|
|
| 5 | Modulo Division | 27%45= | 27 | modulo_division |
|
|
| 14 | Decimal to Binary | Binary of 30= | 11110 | decimal_to_binary |
|
|
| 15 | Binary to Decimal | 0110 | 6 | binary_to_decimal |
|
|
| 56 | Fibonacci Series | The Fibonacci Series of the first 18 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597] | fibonacci_series |
|
|
| 62 | nth Fibonacci number | What is the 49th Fibonacci number? | 7778742049 | nth_fibonacci_number |
|
|
| 64 | Binary to Hexidecimal | 1010 | 0xa | binary_to_hex |
|
|
| 73 | Binary 2's Complement | 2's complement of 11 = | 1 | binary_2s_complement |
|
|
| 79 | Decimal to Hexadecimal | Binary of 541= | 0x21d | decimal_to_hexadeci |
|
|
| 84 | Converts decimal to octal | The decimal number 1868 in Octal is: | 0o3514 | decimal_to_octal |
|
|
| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 9 is = | 37220 | bcd_to_decimal |
|
|
| 103 | Decimal to Binary Coded Decimal | BCD of Decimal Number 9722 is = | 251510 | decimal_to_bcd |
|
|
## geometry
|
|
| Id | Skill | Example problem | Example Solution | Function Name |
|
|
|------|-------|-----------------|------------------|---------------|
|
|
| 18 | Area of Triangle | Area of triangle with side lengths: 19 3 15 = | (1.3716761698165164e-15+22.401171844347786j) | area_of_triangle |
|
|
| 19 | Triangle exists check | Does triangle with sides 13, 6 and 16 exist? | Yes | valid_triangle |
|
|
| 22 | Third Angle of Triangle | Third angle of triangle with angles 44 and 43 = | 93 | third_angle_of_triangle |
|
|
| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 3 and 18 = | 18.25 | pythagorean_theorem |
|
|
| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 10 sides | 144.0 | angle_regular_polygon |
|
|
| 32 | Surface Area of Cube | Surface area of cube with side = 6m is | 216 m^2 | surface_area_cube |
|
|
| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 13m, 9m, 14m is | 850 m^2 | surface_area_cuboid |
|
|
| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 6m and radius = 18m is | 2714 m^2 | surface_area_cylinder |
|
|
| 35 | Volum of Cube | Volume of cube with side = 6m is | 216 m^3 | volume_cube |
|
|
| 36 | Volume of Cuboid | Volume of cuboid with sides = 17m, 18m, 14m is | 4284 m^3 | volume_cuboid |
|
|
| 37 | Volume of cylinder | Volume of cylinder with height = 27m and radius = 12m is | 12214 m^3 | volume_cylinder |
|
|
| 38 | Surface Area of cone | Surface area of cone with height = 14m and radius = 3m is | 163 m^2 | surface_area_cone |
|
|
| 39 | Volume of cone | Volume of cone with height = 29m and radius = 14m is | 5952 m^3 | volume_cone |
|
|
| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 46 , 142, 29 = | 143 | fourth_angle_of_quadrilateral |
|
|
| 57 | Trigonometric Values | What is cos(90)? | 0 | basic_trigonometry |
|
|
| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 10 sides = | 1440 | sum_of_polygon_angles |
|
|
| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 11m is | 1520.5308443374597 m^2 | surface_area_sphere |
|
|
| 61 | Volume of Sphere | Volume of sphere with radius 84 m = | 2482712.7095377133 m^3 | volume_sphere |
|
|
| 70 | Angle between 2 vectors | angle between the vectors [649.96, 568.55, 241.36, 319.37, 871.85, 576.19, 912.6, 366.59] and [173.42, 829.66, 374.84, 841.87, 307.24, 844.98, 754.21, 645.43] is: | 0.59 radians | angle_btw_vectors |
|
|
| 75 | Area of a Sector | Given radius, 40 and angle, 17. Find the area of the sector. | Area of sector = 237.36478 | sector_area |
|
|
| 86 | Degrees to Radians | Angle 253 in radians is = | 4.42 | degree_to_rad |
|
|
| 87 | Radians to Degrees | Angle 3 in degrees is = | 171.89 | radian_to_deg |
|
|
| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 14 and height, 33? | CSA of cylinder = 2902.83 | curved_surface_area_cylinder |
|
|
| 96 | Perimeter of Polygons | The perimeter of a 12 sided polygon with lengths of [37, 5, 34, 97, 120, 104, 97, 23, 22, 72, 66, 59]cm is: | 736 | perimeter_of_polygons |
|
|
| 104 | Circumference | Circumference of circle with radius 32 | 201.06192982974676 | circumference |
|
|
| 108 | Arc length of Angle | Given radius, 31 and angle, 148. Find the arc length of the angle. | Arc length of the angle = 80.07571 | arc_length |
|
|
| 112 | Area of Circle | Area of circle with radius 97 | 29571.142857142855 | area_of_circle |
|
|
## misc
|
|
| Id | Skill | Example problem | Example Solution | Function Name |
|
|
|------|-------|-----------------|------------------|---------------|
|
|
| 9 | LCM (Least Common Multiple) | LCM of 4 and 7 = | 28 | lcm |
|
|
| 10 | GCD (Greatest Common Denominator) | GCD of 15 and 3 = | 3 | gcd |
|
|
| 27 | Prime Factorisation | Find prime factors of 161 | [7, 23] | prime_factors |
|
|
| 40 | Common Factors | Common Factors of 33 and 28 = | [1] | common_factors |
|
|
| 51 | HCF (Highest Common Factor) | HCF of 3 and 14 = | 1 | hcf |
|
|
| 55 | Comparing surds | Fill in the blanks 43^(1/8) _ 97^(1/6) | < | surds_comparison |
|
|
| 63 | Profit or Loss Percent | Profit percent when CP = 303 and SP = 585 is: | 93.06930693069307 | profit_loss_percent |
|
|
| 66 | Geometric Progression | For the given GP [6, 48, 384, 3072, 24576, 196608] ,Find the value of a,common ratio,7th term value, sum upto 9th term | The value of a is 6, common ratio is 8 , 7th term is 1572864 , sum upto 9th term is 115043766.0 | geometric_progression |
|
|
| 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 18 , 98 , 77 , 8 = | (18*98*77*8)^(1/4) = 32.28641488711981 | geometric_mean |
|
|
| 68 | Harmonic Mean of N Numbers | Harmonic mean of 4 numbers 8 , 70 , 24 , 85 = | 4/((1/8) + (1/70) + (1/24) + (1/85)) = 20.755813953488374 | harmonic_mean |
|
|
| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[288.6870061903637, 830.0059124436957, 80.85289556157238, 32.95804703487859, 290.00911298156007, 267.3996092514439, 723.9393433047015, 973.3386599711184, 151.93863634100845, 18.71003497862489, 445.18946751284307, 678.1683029551084, 191.406649648846, 909.0851387496899, 599.3623170191328, 702.8900903174056, 568.8716699724164, 570.9365552731333] is: | 2335.475196652018 | euclidian_norm |
|
|
| 81 | Celsius To Fahrenheit | Convert 45 degrees Celsius to degrees Fahrenheit = | 113.0 | celsius_to_fahrenheit |
|
|
| 82 | AP Term Calculation | Find the term number 44 of the AP series: 15, -12, -39 ... | -1146 | arithmetic_progression_term |
|
|
| 83 | AP Sum Calculation | Find the sum of first 27 terms of the AP series: -100, -51, -2 ... | 14499.0 | arithmetic_progression_sum |
|
|
| 85 | Converts decimal to Roman Numerals | The number 2662 in Roman Numerals is: | MMDCLXII | decimal_to_roman_numerals |
|
|
| 92 | Complex To Polar Form | rexp(itheta) = | 6.0exp(i3.14) | complex_to_polar |
|
|
| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 3, 5, 6, 8, 9} ,b={2, 4, 6}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 2, 3, 4, 5, 6, 8, 9},Intersection is {6}, a-b is {1, 3, 5, 8, 9},b-a is {2, 4}, Symmetric difference is {1, 2, 3, 4, 5, 8, 9} | set_operation |
|
|
| 94 | Base Conversion | Convert CFBE from base 16 to base 6. | 1050114 | base_conversion |
|
|
| 98 | Quotient of Powers with Same Base | The Quotient of 2^2 and 2^2 = 2^(2-2) = 2^0 | 1 | quotient_of_power_same_base |
|
|
| 99 | Quotient of Powers with Same Power | The Quotient of 31^4 and 13^4 = (31/13)^4 = 2.3846153846153846^4 | 32.335037288610344 | quotient_of_power_same_power |
|
|
| 101 | Leap Year or Not | Year 2022 | is not a leap year | is_leap_year |
|
|
| 102 | Minute to Hour conversion | Convert 685 minutes to Hours & Minutes | 11 hours and 25 minutes | minutes_to_hours |
|
|
| 106 | signum function | signum of 879 is = | 1 | signum_function |
|
|
| 109 | Binomial distribution | A manufacturer of metal pistons finds that, on average, 40.94% of the pistons they manufacture are rejected because they are incorrectly sized. What is the probability that a batch of 17 pistons will contain no more than 3 rejected pistons? | 3.94 | binomial_distribution |
|
|
## statistics
|
|
| Id | Skill | Example problem | Example Solution | Function Name |
|
|
|------|-------|-----------------|------------------|---------------|
|
|
| 30 | Combinations of Objects | Number of combinations from 12 objects picked 0 at a time | 1 | combinations |
|
|
| 42 | Permutations | Number of Permutations from 17 objects picked 6 at a time = | 8910720 | permutation |
|
|
| 52 | Probability of a certain sum appearing on faces of dice | If 3 dice are rolled at the same time, the probability of getting a sum of 18 = | 1/216 | dice_sum_probability |
|
|
| 54 | Confidence interval For sample S | The confidence interval for sample [218, 274, 289, 295, 251, 246, 267, 276, 282, 213, 275, 210, 291, 209, 230, 220, 227, 204, 221, 214, 292, 252, 273, 243, 200, 272, 283, 288, 297, 211, 299, 244, 270, 242, 264, 279, 256] with 90% confidence is | (261.7881003640357, 245.07676450082917) | confidence_interval |
|
|
| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[37, 32, 45, 26, 36, 28, 17, 36, 47, 36, 34, 49, 47, 31, 5] | The Mean is 33.733333333333334 , Standard Deviation is 129.79555555555555, Variance is 11.392785241351456 | data_summary |
|
|
| 76 | Mean and Median | Given the series of numbers [73, 80, 8, 39, 9, 85, 51, 54, 14, 57]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 47.0 and Arithmetic median of this series is 52.5 | mean_median |
|
|
| 107 | Conditional Probability | Someone tested positive for a nasty disease which only 1.87% of population have. Test sensitivity (true positive) is equal to SN= 94.23% whereas test specificity (true negative) SP= 96.61%. What is the probability that this guy really has that disease? | 34.63% | conditional_probability |
|