Use latex as default output (#402)

* Improve combine_like_terms

* Lint fix

* add some latex to readme

* give compound_interest latex formatting

* fix compound interest readme

* update combine_like_terms readme

* combine_like_terms add delimiters

* Convert some alebra output to latex

* Add missing right] to latex

* Fix makeReadme script

* Correct det 2x2 latex

* use bmatrix for det 2x2

* update readme and bump version

* Make latex matrix one line

* made latex for most of algebra

* more latex migrations

* convert basic_math to latex

* re-generate readme

* fix double exponent

* latex for most of calculus

* Improved stationary points gen

* made cs latex

* Transform geometry to latex

* texify misc outputs

* texify statistics

* regenerate readme

* Add tex markers to linear_equations

* add list_to_tex for mult_int_22

* upgrade readme

* update list_to_tex

* add end to list_to_tex

* tweak list_to_tex, update readme

* Update README.md

* Update README.md

* lint fixes

* lint fix

* Remove tests

* texify system_of_equations

* update system_of_equations tex

* regen readme

* texify complex_quadratic

* update complex_quadratic

* regen readme

* sqrt to complex_quadratic

* complex_quadratic texify

* Update README.md

* Update README.md

* make latexbuilder

* regen readme

* fix bmatrix

* bmatrix conversions

* update readme

* use times symbol

* improve tex of prod_sci_notations

* Add missing delim to prod of sci notations

* Add missing curly brack to prod-sci-not

* lint fixes

* texify differentiation

* texify stationary points

* changed differentation to trig_differentiation

* texify stationary points

* update readme

* Remove left right from stat_points

* texify angle_btw_vectors

* update readme

* add spaces to mod operator

* Swap \\% with \\percent

* update readme

* Replace //percent with non-math %

* fix leftover \\percent

* latexify vector_cross

* change tex multiply to times

* update readme

* lint fixes

* lint fix
This commit is contained in:
Luke Weiler
2022-12-23 00:38:59 -05:00
committed by GitHub
parent c348e176cc
commit 4f21bbd3ab
133 changed files with 727 additions and 1592 deletions

View File

@@ -27,6 +27,3 @@ jobs:
- name: Linter - name: Linter
run: make lint run: make lint
- name: Test
run: make test

View File

@@ -10,6 +10,3 @@ format:
lint: lint:
$(PYTHON) -m flake8 --ignore=$(IGNORE_ERRORS) $(PKG) $(PYTHON) -m flake8 --ignore=$(IGNORE_ERRORS) $(PKG)
test:
$(PYTHON) -m pytest --verbose -s tests

252
README.md
View File

@@ -75,147 +75,147 @@ You can also use `getGenList()` to return a list of all generators included in t
## algebra ## algebra
| Id | Skill | Example problem | Example Solution | Function Name | Kwargs | | Id | Skill | Example problem | Example Solution | Function Name | Kwargs |
|------|-------|-----------------|------------------|---------------|--------| |------|-------|-----------------|------------------|---------------|--------|
| 11 | [Basic Algebra](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/basic_algebra.py) | 9x + 5 = 9 | 4/9 | basic_algebra | `maxVariable=10` | | 11 | [Basic Algebra](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/basic_algebra.py) | $9x + 9 = 9$ | $0$ | basic_algebra | `maxVariable=10` |
| 12 | [Logarithm](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/log.py) | log2(32) | 5 | log | `maxBase=3` `maxVal=8` | | 12 | [Logarithm](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/log.py) | $log_{2}(256)=$ | $8$ | log | `maxBase=3` `maxVal=8` |
| 17 | [Integer Multiplication with 2x2 Matrix](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/multiply_int_to_22_matrix.py) | 0 * [[8, 10], [1, 10]] = | [[0,0],[0,0]] | multiply_int_to_22_matrix | `maxMatrixVal=10` `maxRes=100` | | 17 | [Integer Multiplication with 2x2 Matrix](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/multiply_int_to_22_matrix.py) | $2 * \begin{bmatrix} 8 & 0 \\ 10 & 10 \end{bmatrix} =$ | $\begin{bmatrix} 16 & 0 \\ 20 & 20 \end{bmatrix}$ | multiply_int_to_22_matrix | `maxMatrixVal=10` `maxRes=100` |
| 20 | [Midpoint of the two point](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/midpoint_of_two_points.py) | (8,-9),(20,-14)= | (14.0,-11.5) | midpoint_of_two_points | `maxValue=20` | | 20 | [Midpoint of the two point](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/midpoint_of_two_points.py) | The midpoint of $(7,5)$ and $(-17,14) = $ | $(-5.0,9.5)$ | midpoint_of_two_points | `maxValue=20` |
| 21 | [Factoring Quadratic](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/factoring.py) | x^2+x-30 | (x-5)(x+6) | factoring | `range_x1=10` `range_x2=10` | | 21 | [Factoring Quadratic](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/factoring.py) | $x^2-2x$ | $(x)(x-2)$ | factoring | `range_x1=10` `range_x2=10` |
| 23 | [Solve a System of Equations in R^2](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/system_of_equations.py) | 10x - 10y = -10, 6x + 7y = 98 | x = 7, y = 8 | system_of_equations | `range_x=10` `range_y=10` `coeff_mult_range=10` | | 23 | [Solve a System of Equations in R^2](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/system_of_equations.py) | Given $4x - 6y = 36$ and $9x - 2y = 12$, solve for $x$ and $y$. | $x = 0$, $y = -6$ | system_of_equations | `range_x=10` `range_y=10` `coeff_mult_range=10` |
| 24 | [Distance between 2 points](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/distance_two_points.py) | Find the distance between (-10, 11) and (-2, 19) | sqrt(128) | distance_two_points | `maxValXY=20` `minValXY=-20` | | 24 | [Distance between 2 points](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/distance_two_points.py) | Find the distance between $(7, -15)$ and $(0, -1)$ | $\sqrt{245}$ | distance_two_points | `maxValXY=20` `minValXY=-20` |
| 26 | [Linear Equations](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/linear_equations.py) | 5x + -11y = -44, 14x + 12y = -166 | x = -11, y = -1 | linear_equations | `n=2` `varRange=20` `coeffRange=20` | | 26 | [Linear Equations](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/linear_equations.py) | Given the equations $-3x + 10y = -140$ and $-3x + -4y = -28$, solve for $x$ and $y$ | $x = 20$, $y = -8$ | linear_equations | `n=2` `varRange=20` `coeffRange=20` |
| 41 | [Intersection of Two Lines](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/intersection_of_two_lines.py) | Find the point of intersection of the two lines: y = -9x - 9 and y = -6/3x + 2 | (-11/7, 36/7) | intersection_of_two_lines | `minM=-10` `maxM=10` `minB=-10` `maxB=10` `minDenominator=1` `maxDenominator=6` | | 41 | [Intersection of Two Lines](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/intersection_of_two_lines.py) | Find the point of intersection of the two lines: $y = 9/3x - 6$ and $y = 1/3x + 6$ | $(9/2, 15/2)$ | intersection_of_two_lines | `minM=-10` `maxM=10` `minB=-10` `maxB=10` `minDenominator=1` `maxDenominator=6` |
| 43 | [Cross Product of 2 Vectors](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/vector_cross.py) | [6, -20, 10] X [-13, 12, -19] = | [260, -16, -188] | vector_cross | `minVal=-20` `maxVal=20` | | 43 | [Cross Product of 2 Vectors](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/vector_cross.py) | $[-18, 0, 20] \times [-16, -5, 0] = $ | $[100, -320, 90]$ | vector_cross | `minVal=-20` `maxVal=20` |
| 45 | [Simple Interest](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/simple_interest.py) | Simple interest for a principle amount of 3854 dollars, 2% rate of interest and for a time period of 3 years is = | 231.24 | simple_interest | `maxPrinciple=10000` `maxRate=10` `maxTime=10` | | 45 | [Simple Interest](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/simple_interest.py) | Simple interest for a principle amount of $9080$ dollars, $3$% rate of interest and for a time period of $6$ years is $=$ | $1634.4$ | simple_interest | `maxPrinciple=10000` `maxRate=10` `maxTime=10` |
| 46 | [Multiplication of two matrices](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/matrix_multiplication.py) | Multiply<table><tr><td>8</td><td>-9</td><td>-8</td></tr><tr><td>2</td><td>8</td><td>5</td></tr><tr><td>-6</td><td>-6</td><td>7</td></tr></table>and<table><tr><td>-8</td><td>3</td><td>5</td></tr><tr><td>-10</td><td>-4</td><td>-1</td></tr><tr><td>-10</td><td>10</td><td>-6</td></tr></table> | <table><tr><td>106</td><td>-20</td><td>97</td></tr><tr><td>-146</td><td>24</td><td>-28</td></tr><tr><td>38</td><td>76</td><td>-66</td></tr></table> | matrix_multiplication | `maxVal=100` `max_dim=10` | | 46 | [Multiplication of two matrices](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/matrix_multiplication.py) | Multiply$\begin{bmatrix}0&-1&-9&1\\-10&4&3&-10\end{bmatrix}$and$\begin{bmatrix}-4&-2&-4\\8&-1&2\\-2&6&-5\\-10&7&5\end{bmatrix}$ | $\begin{bmatrix}0&-46&48\\166&-36&-17\end{bmatrix}$ | matrix_multiplication | `maxVal=100` `max_dim=10` |
| 50 | [Quadratic Equation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/quadratic_equation.py) | Zeros of the Quadratic Equation 78x^2+156x+38=0 | [-0.28, -1.72] | quadratic_equation | `maxVal=100` | | 50 | [Quadratic Equation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/quadratic_equation.py) | What are the zeros of the quadratic equation $24x^2+103x+26=0$ | ${-0.27, -4.02}$ | quadratic_equation | `maxVal=100` |
| 65 | [Multiplication of 2 complex numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/multiply_complex_numbers.py) | (-2-13j) * (-15-11j) = | (-113+217j) | multiply_complex_numbers | `minRealImaginaryNum=-20` `maxRealImaginaryNum=20` | | 65 | [Multiplication of 2 complex numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/multiply_complex_numbers.py) | $(17+1j) * (17-1j) = $ | $(290+0j)$ | multiply_complex_numbers | `minRealImaginaryNum=-20` `maxRealImaginaryNum=20` |
| 72 | [Dot Product of 2 Vectors](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/vector_dot.py) | [-4, 7, -3] . [-10, 9, -16] = | 151 | vector_dot | `minVal=-20` `maxVal=20` | | 72 | [Dot Product of 2 Vectors](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/vector_dot.py) | $[9, 14, -19]\cdot[-8, -9, 10]=$ | $-388$ | vector_dot | `minVal=-20` `maxVal=20` |
| 74 | [Inverse of a Matrix](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/invert_matrix.py) | Inverse of Matrix Matrix([[5, 89, 34], [43, 21, 47], [3, 86, 7]]) is: | Matrix([[-779/17975, 2301/89875, 3469/89875], [-32/17975, -67/89875, 1227/89875], [727/17975, -163/89875, -3722/89875]]) | invert_matrix | `SquareMatrixDimension=3` `MaxMatrixElement=99` `OnlyIntegerElementsInInvertedMatrix=False` | | 74 | [Inverse of a Matrix](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/invert_matrix.py) | Inverse of Matrix $\begin{bmatrix} 0 & 0 & 1 \\ 1 & 3 & 3 \\ 1 & 2 & 2 \end{bmatrix}$ is: | \begin{bmatrix} 0 & -2 & 3 \\ -1 & 1 & -1 \\ 1 & 0 & 0 \end{bmatrix} | invert_matrix | `SquareMatrixDimension=3` `MaxMatrixElement=99` `OnlyIntegerElementsInInvertedMatrix=True` |
| 77 | [Determinant to 2x2 Matrix](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/int_matrix_22_determinant.py) | Det([[77, 20], [68, 89]]) = | 5493 | int_matrix_22_determinant | `maxMatrixVal=100` | | 77 | [Determinant to 2x2 Matrix](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/int_matrix_22_determinant.py) | $\det \begin{bmatrix} 24 & 94 \\ 21 & 29 \end{bmatrix}= $ | $-1278$ | int_matrix_22_determinant | `maxMatrixVal=100` |
| 78 | [Compound Interest](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/compound_interest.py) | Compound interest for a principle amount of 8503 dollars, 10% rate of interest and for a time period of 10 year is = | 22054.59 | compound_interest | `maxPrinciple=10000` `maxRate=10` `maxTime=10` | | 78 | [Compound Interest](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/compound_interest.py) | Compound interest for a principle amount of $2004$ dollars, $1$% rate of interest and for a time period of $5$ years is $=$ | $2106.22$ | compound_interest | `maxPrinciple=10000` `maxRate=10` `maxTime=10` |
| 100 | [complex Quadratic Equation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/complex_quadratic.py) | Find the roots of given Quadratic Equation 5x^2 + 8x + 2 = 0 | simplified solution : ((-0.31, -1.29)), generalized solution : ((-8 + sqrt(24))/2*5, (-8 - sqrt(24))/2*5) | complex_quadratic | `prob_type=0` `max_range=10` | | 100 | [complex Quadratic Equation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/complex_quadratic.py) | Find the roots of given Quadratic Equation $7x^2 + 7x + 1 = 0$ | $((-0.173, -0.827)) = (\frac{-7 + \sqrt{21}}{2*7}, (\frac{-7 - \sqrt{21}}{2*7})$ | complex_quadratic | `prob_type=0` `max_range=10` |
| 105 | [Combine Like terms](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/combine_like_terms.py) | 1x^5 + 10x^1 + 2x^1 + 3x^2 + 5x^1 + 4x^2 + 2x^3 | 17x^1 + 7x^2 + 2x^3 + 1x^5 | combine_like_terms | `maxCoef=10` `maxExp=20` `maxTerms=10` | | 105 | [Combine Like terms](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/combine_like_terms.py) | $4x^{13} + 1x^{16}$ | $4x^{13} + 1x^{16}$ | combine_like_terms | `maxCoef=10` `maxExp=20` `maxTerms=10` |
| 111 | [Expanding Factored Binomial](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/expanding.py) | (7x-2)(+6x-3) | 42*x^2-33*x+6 | expanding | `range_x1=10` `range_x2=10` `range_a=10` `range_b=10` | | 111 | [Expanding Factored Binomial](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/algebra/expanding.py) | $(-10x-2)(-1x+6)$ | $10x^2-58x-12$ | expanding | `range_x1=10` `range_x2=10` `range_a=10` `range_b=10` |
## basic_math ## basic_math
| Id | Skill | Example problem | Example Solution | Function Name | Kwargs | | Id | Skill | Example problem | Example Solution | Function Name | Kwargs |
|------|-------|-----------------|------------------|---------------|--------| |------|-------|-----------------|------------------|---------------|--------|
| 0 | [Addition](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/addition.py) | 14+15= | 29 | addition | `maxSum=99` `maxAddend=50` | | 0 | [Addition](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/addition.py) | $40+14=$ | $54$ | addition | `maxSum=99` `maxAddend=50` |
| 1 | [Subtraction](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/subtraction.py) | 55-55= | 0 | subtraction | `maxMinuend=99` `maxDiff=99` | | 1 | [Subtraction](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/subtraction.py) | $12-2=$ | $10$ | subtraction | `maxMinuend=99` `maxDiff=99` |
| 2 | [Multiplication](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/multiplication.py) | 2*11= | 22 | multiplication | `maxMulti=12` | | 2 | [Multiplication](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/multiplication.py) | $7\cdot8$ | $56$ | multiplication | `maxMulti=12` |
| 3 | [Division](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/division.py) | 156/12= | 13 | division | `maxA=25` `maxB=25` | | 3 | [Division](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/division.py) | $92\div23=$ | $4$ | division | `maxA=25` `maxB=25` |
| 6 | [Square Root](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/square_root.py) | sqrt(9)= | 3 | square_root | `minNo=1` `maxNo=12` | | 6 | [Square Root](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/square_root.py) | $\sqrt{1}=$ | $1$ | square_root | `minNo=1` `maxNo=12` |
| 8 | [Square](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/square.py) | 8^2= | 64 | square | `maxSquareNum=20` | | 8 | [Square](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/square.py) | $9^2=$ | $81$ | square | `maxSquareNum=20` |
| 13 | [Fraction to Decimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/fraction_to_decimal.py) | 32/35= | 0.91 | fraction_to_decimal | `maxRes=99` `maxDivid=99` | | 13 | [Fraction to Decimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/fraction_to_decimal.py) | $84\div6=$ | $14.0$ | fraction_to_decimal | `maxRes=99` `maxDivid=99` |
| 16 | [Fraction Division](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/divide_fractions.py) | (9/10)/(10/4) | 9/25 | divide_fractions | `maxVal=10` | | 16 | [Fraction Division](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/divide_fractions.py) | $\frac{6}{7}\div\frac{9}{5}=$ | $\frac{10}{21}$ | divide_fractions | `maxVal=10` |
| 28 | [Fraction Multiplication](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/fraction_multiplication.py) | (10/4)*(1/2) | 5/4 | fraction_multiplication | `maxVal=10` | | 28 | [Fraction Multiplication](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/fraction_multiplication.py) | $\frac{3}{9}\cdot\frac{7}{6}=$ | $\frac{7}{18}$ | fraction_multiplication | `maxVal=10` |
| 31 | [Factorial](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/factorial.py) | 5! = | 120 | factorial | `maxInput=6` | | 31 | [Factorial](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/factorial.py) | $5! =$ | $120$ | factorial | `maxInput=6` |
| 44 | [Compare Fractions](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/compare_fractions.py) | Which symbol represents the comparison between 7/6 and 1/5? | > | compare_fractions | `maxVal=10` | | 44 | [Compare Fractions](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/compare_fractions.py) | Which symbol represents the comparison between $\frac{3}{5}$ and $\frac{3}{9}$? | > | compare_fractions | `maxVal=10` |
| 47 | [Cube Root](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/cube_root.py) | What is the cube root of 648 up to 2 decimal places? | 8.65 | cube_root | `minNo=1` `maxNo=1000` | | 47 | [Cube Root](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/cube_root.py) | What is the cube root of: $\sqrt[3]{30}=$ to 2 decimal places? | $3.11$ | cube_root | `minNo=1` `maxNo=1000` |
| 53 | [Exponentiation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/exponentiation.py) | 7^9 = | 40353607 | exponentiation | `maxBase=20` `maxExpo=10` | | 53 | [Exponentiation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/exponentiation.py) | $4^1 =$ | $4$ | exponentiation | `maxBase=20` `maxExpo=10` |
| 71 | [Absolute difference between two numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/absolute_difference.py) | |-96--27|= | 69 | absolute_difference | `maxA=100` `maxB=100` | | 71 | [Absolute difference between two numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/absolute_difference.py) | $|22--59|=$ | $81$ | absolute_difference | `maxA=100` `maxB=100` |
| 80 | [Percentage of a number](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/percentage.py) | What is 61% of 38? | 23.18 | percentage | `maxValue=99` `maxpercentage=99` | | 80 | [Percentage of a number](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/percentage.py) | What is $5$% of $18$? | $0.90$ | percentage | `maxValue=99` `maxpercentage=99` |
| 90 | [isprime](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/is_prime.py) | Is 40 prime? | No | is_prime | `max_num=100` | | 90 | [isprime](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/is_prime.py) | Is $73$ prime? | Yes | is_prime | `max_num=100` |
| 97 | [Power of Powers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/power_of_powers.py) | Simplify 2^9^4= | 2^36 | power_of_powers | `maxBase=50` `maxPower=10` | | 97 | [Power of Powers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/power_of_powers.py) | Simplify $31^{8^{2}}$ | $31^{16}$ | power_of_powers | `maxBase=50` `maxPower=10` |
| 118 | [Percentage difference](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/percentage_difference.py) | What is the percentage difference between 160 and 190? | 17.14% | percentage_difference | `maxValue=200` `minValue=0` | | 118 | [Percentage difference](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/percentage_difference.py) | What is the percentage difference between $66$ and $7$? | $161.64$% | percentage_difference | `maxValue=200` `minValue=0` |
| 119 | [Percentage error](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/percentage_error.py) | Find the percentage error when observed value equals 27 and exact value equals 82. | 67.07% | percentage_error | `maxValue=100` `minValue=-100` | | 119 | [Percentage error](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/percentage_error.py) | Find the percentage error when observed value equals $-44$ and exact value equals $-26$. | $69.23\%$ | percentage_error | `maxValue=100` `minValue=-100` |
| 120 | [Greatest Common Divisor of N Numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/greatest_common_divisor.py) | GCD(850468745,474001818)= | 1 | greatest_common_divisor | `numbersCount=2` `maximalNumberLimit=10**9` | | 120 | [Greatest Common Divisor of N Numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/greatest_common_divisor.py) | $GCD(860597057,541815762)=$ | $1$ | greatest_common_divisor | `numbersCount=2` `maximalNumberLimit=10**9` |
| 124 | [Is Composite](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/is_composite.py) | Is 231 composite? | Yes | is_composite | `maxNum=250` | | 124 | [Is Composite](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/basic_math/is_composite.py) | Is $144$ composite? | Yes | is_composite | `maxNum=250` |
## calculus ## calculus
| Id | Skill | Example problem | Example Solution | Function Name | Kwargs | | Id | Skill | Example problem | Example Solution | Function Name | Kwargs |
|------|-------|-----------------|------------------|---------------|--------| |------|-------|-----------------|------------------|---------------|--------|
| 7 | [Power Rule Differentiation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/power_rule_differentiation.py) | 8x^4 + 7x^8 | 32x^3 + 56x^7 | power_rule_differentiation | `maxCoef=10` `maxExp=10` `maxTerms=5` | | 7 | [Power Rule Differentiation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/power_rule_differentiation.py) | $2x^{6} + 5x^{4} + 6x^{4} + 9x^{4}$ | $12x^{5} + 20x^{3} + 24x^{3} + 36x^{3}$ | power_rule_differentiation | `maxCoef=10` `maxExp=10` `maxTerms=5` |
| 48 | [Power Rule Integration](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/power_rule_integration.py) | 5x^5 + 3x^7 + 7x^8 + 8x^6 | (5/5)x^6 + (3/7)x^8 + (7/8)x^9 + (8/6)x^7 + c | power_rule_integration | `maxCoef=10` `maxExp=10` `maxTerms=5` | | 48 | [Power Rule Integration](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/power_rule_integration.py) | $8x^{1} + 1x^{9} + 5x^{1}$ | $\frac{8}{1}x^{2} + \frac{1}{9}x^{10} + \frac{5}{1}x^{2} + C$ | power_rule_integration | `maxCoef=10` `maxExp=10` `maxTerms=5` |
| 88 | [Differentiation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/differentiation.py) | differentiate w.r.t x : d(sec(x)+7*x^2)/dx | 14*x + tan(x)*sec(x) | differentiation | `diff_lvl=2` | | 88 | [Trigonometric Differentiation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/trig_differentiation.py) | $\frac{d}{dx}(\sin)=$ | $\cos$ | trig_differentiation | |
| 89 | [Definite Integral of Quadratic Equation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/definite_integral.py) | The definite integral within limits 0 to 1 of the equation 10x^2 + 70x + 10 is = | 48.3333 | definite_integral | `max_coeff=100` | | 89 | [Definite Integral of Quadratic Equation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/definite_integral.py) | The definite integral within limits $0$ to $1$ of the equation $24x^2 + 93x + 13 = $ | $67.5$ | definite_integral | `max_coeff=100` |
| 110 | [Stationary Points](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/stationary_points.py) | f(x)=7*x^3 + 2*x | | stationary_points | `maxExp=3` `maxCoef=10` | | 110 | [Stationary Points](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/calculus/stationary_points.py) | $f(x)=10*x^3 + 8*x^2 + 2*x + 5$ | ${- \frac{1}{3}, - \frac{1}{5}}$ | stationary_points | `maxExp=3` `maxCoef=10` |
## computer_science ## computer_science
| Id | Skill | Example problem | Example Solution | Function Name | Kwargs | | Id | Skill | Example problem | Example Solution | Function Name | Kwargs |
|------|-------|-----------------|------------------|---------------|--------| |------|-------|-----------------|------------------|---------------|--------|
| 4 | [Binary Complement 1s](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/binary_complement_1s.py) | 1000= | 0111 | binary_complement_1s | `maxDigits=10` | | 4 | [Binary Complement 1s](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/binary_complement_1s.py) | $010 = $ | $101$ | binary_complement_1s | `maxDigits=10` |
| 5 | [Modulo Division](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/modulo_division.py) | 25%15= | 10 | modulo_division | `maxRes=99` `maxModulo=99` | | 5 | [Modulo Division](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/modulo_division.py) | $84$ % $20 = $ | $4$ | modulo_division | `maxRes=99` `maxModulo=99` |
| 14 | [Decimal to Binary](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/decimal_to_binary.py) | Binary of 72= | 1001000 | decimal_to_binary | `max_dec=99` | | 14 | [Decimal to Binary](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/decimal_to_binary.py) | Binary of $49 = $ | $110001$ | decimal_to_binary | `max_dec=99` |
| 15 | [Binary to Decimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/binary_to_decimal.py) | 1 | 1 | binary_to_decimal | `max_dig=10` | | 15 | [Binary to Decimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/binary_to_decimal.py) | $00$ | $0$ | binary_to_decimal | `max_dig=10` |
| 56 | [Fibonacci Series](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/fibonacci_series.py) | The Fibonacci Series of the first 11 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55] | fibonacci_series | `minNo=1` | | 56 | [Fibonacci Series](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/fibonacci_series.py) | The Fibonacci Series of the first ${n}$ numbers is ? | $0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89$ | fibonacci_series | `minNo=1` |
| 62 | [nth Fibonacci number](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/nth_fibonacci_number.py) | What is the 85th Fibonacci number? | 259695496911123328 | nth_fibonacci_number | `maxN=100` | | 62 | [nth Fibonacci number](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/nth_fibonacci_number.py) | What is the 74th Fibonacci number? | $1304969544928660$ | nth_fibonacci_number | `maxN=100` |
| 64 | [Binary to Hexidecimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/binary_to_hex.py) | 001 | 0x1 | binary_to_hex | `max_dig=10` | | 64 | [Binary to Hexidecimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/binary_to_hex.py) | $11010100$ | $0xd4$ | binary_to_hex | `max_dig=10` |
| 73 | [Binary 2's Complement](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/binary_2s_complement.py) | 2's complement of 1011011001 = | 100100111 | binary_2s_complement | `maxDigits=10` | | 73 | [Binary 2's Complement](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/binary_2s_complement.py) | 2's complement of $1 = $ | $1$ | binary_2s_complement | `maxDigits=10` |
| 79 | [Decimal to Hexadecimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/decimal_to_hexadeci.py) | Binary of 545= | 0x221 | decimal_to_hexadeci | `max_dec=1000` | | 79 | [Decimal to Hexadecimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/decimal_to_hexadeci.py) | Binary of $639 = $ | $0x27f$ | decimal_to_hexadeci | `max_dec=1000` |
| 84 | [Converts decimal to octal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/decimal_to_octal.py) | The decimal number 470 in Octal is: | 0o726 | decimal_to_octal | `maxDecimal=4096` | | 84 | [Converts decimal to octal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/decimal_to_octal.py) | The decimal number ${x}$ in Octal is: | $0o5206$ | decimal_to_octal | `maxDecimal=4096` |
| 91 | [Binary Coded Decimal to Integer](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/bcd_to_decimal.py) | Integer of Binary Coded Decimal 6 is = | 25205 | bcd_to_decimal | `maxNumber=10000` | | 91 | [Binary Coded Decimal to Integer](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/bcd_to_decimal.py) | Integer of Binary Coded Decimal $3$ is $=$ | $12440$ | bcd_to_decimal | `maxNumber=10000` |
| 103 | [Decimal to Binary Coded Decimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/decimal_to_bcd.py) | BCD of Decimal Number 4491 is = | 11811 | decimal_to_bcd | `maxNumber=10000` | | 103 | [Decimal to Binary Coded Decimal](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/computer_science/decimal_to_bcd.py) | BCD of Decimal Number $6981 = $ | $11145$ | decimal_to_bcd | `maxNumber=10000` |
## geometry ## geometry
| Id | Skill | Example problem | Example Solution | Function Name | Kwargs | | Id | Skill | Example problem | Example Solution | Function Name | Kwargs |
|------|-------|-----------------|------------------|---------------|--------| |------|-------|-----------------|------------------|---------------|--------|
| 18 | [Area of Triangle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/area_of_triangle.py) | Area of triangle with side lengths: 6 20 22 = | 58.79 | area_of_triangle | `maxA=20` `maxB=20` | | 18 | [Area of Triangle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/area_of_triangle.py) | Area of triangle with side lengths: $5, 15 11 = $ | $19.14$ | area_of_triangle | `maxA=20` `maxB=20` |
| 19 | [Triangle exists check](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/valid_triangle.py) | Does triangle with sides 38, 28 and 27 exist? | Yes | valid_triangle | `maxSideLength=50` | | 19 | [Triangle exists check](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/valid_triangle.py) | Does triangle with sides $20, 17$ and $29$ exist? | $Yes$ | valid_triangle | `maxSideLength=50` |
| 22 | [Third Angle of Triangle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/third_angle_of_triangle.py) | Third angle of triangle with angles 14 and 63 = | 103 | third_angle_of_triangle | `maxAngle=89` | | 22 | [Third Angle of Triangle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/third_angle_of_triangle.py) | Third angle of triangle with angles $1$ and $86 = $ | $93$ | third_angle_of_triangle | `maxAngle=89` |
| 25 | [Pythagorean Theorem](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/pythagorean_theorem.py) | The hypotenuse of a right triangle given the other two lengths 9 and 4 = | 9.85 | pythagorean_theorem | `maxLength=20` | | 25 | [Pythagorean Theorem](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/pythagorean_theorem.py) | What is the hypotenuse of a right triangle given the other two sides have lengths $18$ and $9$? | $20.12$ | pythagorean_theorem | `maxLength=20` |
| 29 | [Angle of a Regular Polygon](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/angle_regular_polygon.py) | Find the angle of a regular polygon with 11 sides | 147.27 | angle_regular_polygon | `minVal=3` `maxVal=20` | | 29 | [Angle of a Regular Polygon](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/angle_regular_polygon.py) | Find the angle of a regular polygon with $7$ sides | $128.57$ | angle_regular_polygon | `minVal=3` `maxVal=20` |
| 32 | [Surface Area of Cube](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_cube.py) | Surface area of cube with side = 8m is | 384 m^2 | surface_area_cube | `maxSide=20` `unit='m'` | | 32 | [Surface Area of Cube](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_cube.py) | Surface area of cube with side $= 17m$ is | $1734 m^2$ | surface_area_cube | `maxSide=20` `unit='m'` |
| 33 | [Surface Area of Cuboid](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_cuboid.py) | Surface area of cuboid with sides = 1m, 15m, 11m is | 382 m^2 | surface_area_cuboid | `maxSide=20` `unit='m'` | | 33 | [Surface Area of Cuboid](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_cuboid.py) | Surface area of cuboid with sides of lengths: $9m, 11m, 20m$ is | $998 m^2$ | surface_area_cuboid | `maxSide=20` `unit='m'` |
| 34 | [Surface Area of Cylinder](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_cylinder.py) | Surface area of cylinder with height = 3m and radius = 17m is | 2136 m^2 | surface_area_cylinder | `maxRadius=20` `maxHeight=50` `unit='m'` | | 34 | [Surface Area of Cylinder](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_cylinder.py) | Surface area of cylinder with height $= 25m$ and radius $= 18m$ is | $4863 m^2$ | surface_area_cylinder | `maxRadius=20` `maxHeight=50` `unit='m'` |
| 35 | [Volume of Cube](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_cube.py) | Volume of cube with side = 9m is | 729 m^3 | volume_cube | `maxSide=20` `unit='m'` | | 35 | [Volume of Cube](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_cube.py) | Volume of cube with a side length of $13m$ is | $2197 m^3$ | volume_cube | `maxSide=20` `unit='m'` |
| 36 | [Volume of Cuboid](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_cuboid.py) | Volume of cuboid with sides = 10m, 12m, 9m is | 1080 m^3 | volume_cuboid | `maxSide=20` `unit='m'` | | 36 | [Volume of Cuboid](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_cuboid.py) | Volume of cuboid with sides = $2m, 6m, 18m$ is | $216 m^3$ | volume_cuboid | `maxSide=20` `unit='m'` |
| 37 | [Volume of cylinder](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_cylinder.py) | Volume of cylinder with height = 4m and radius = 15m is | 2827 m^3 | volume_cylinder | `maxRadius=20` `maxHeight=50` `unit='m'` | | 37 | [Volume of cylinder](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_cylinder.py) | Volume of cylinder with height $= 28m$ and radius $= 5m$ is | $2199 m^3$ | volume_cylinder | `maxRadius=20` `maxHeight=50` `unit='m'` |
| 38 | [Surface Area of cone](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_cone.py) | Surface area of cone with height = 26m and radius = 15m is | 2121 m^2 | surface_area_cone | `maxRadius=20` `maxHeight=50` `unit='m'` | | 38 | [Surface Area of cone](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_cone.py) | Surface area of cone with height $= 37m$ and radius $= 15m$ is | $2588 m^2$ | surface_area_cone | `maxRadius=20` `maxHeight=50` `unit='m'` |
| 39 | [Volume of cone](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_cone.py) | Volume of cone with height = 31m and radius = 7m is | 1590 m^3 | volume_cone | `maxRadius=20` `maxHeight=50` `unit='m'` | | 39 | [Volume of cone](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_cone.py) | Volume of cone with height $= 17m$ and radius $= 1m$ is | $17 m^3$ | volume_cone | `maxRadius=20` `maxHeight=50` `unit='m'` |
| 49 | [Fourth Angle of Quadrilateral](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/fourth_angle_of_quadrilateral.py) | Fourth angle of quadrilateral with angles 39 , 151, 137 = | 33 | fourth_angle_of_quadrilateral | `maxAngle=180` | | 49 | [Fourth Angle of Quadrilateral](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/fourth_angle_of_quadrilateral.py) | Fourth angle of quadrilateral with angles $108 , 35, 117 =$ | $100$ | fourth_angle_of_quadrilateral | `maxAngle=180` |
| 57 | [Trigonometric Values](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/basic_trigonometry.py) | What is tan(45)? | 1 | basic_trigonometry | `angles=[0, 30, 45, 60, 90]` `functions=['sin', 'cos', 'tan']` | | 57 | [Trigonometric Values](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/basic_trigonometry.py) | $\tan(0) = $ | $0$ | basic_trigonometry | `angles=[0, 30, 45, 60, 90]` `functions=['sin', 'cos', 'tan']` |
| 58 | [Sum of Angles of Polygon](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/sum_of_polygon_angles.py) | Sum of angles of polygon with 5 sides = | 540 | sum_of_polygon_angles | `maxSides=12` | | 58 | [Sum of Angles of Polygon](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/sum_of_polygon_angles.py) | What is the sum of interior angles of a polygon with $5$ sides? | $540$ | sum_of_polygon_angles | `maxSides=12` |
| 60 | [Surface Area of Sphere](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_sphere.py) | Surface area of Sphere with radius = 19m is | 4536.459791783661 m^2 | surface_area_sphere | `maxSide=20` `unit='m'` | | 60 | [Surface Area of Sphere](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_sphere.py) | Surface area of Sphere with radius $= 14m$ is | $2463.0086404143976 m^2$ | surface_area_sphere | `maxSide=20` `unit='m'` |
| 61 | [Volume of Sphere](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_sphere.py) | Volume of sphere with radius 92 m = | 3261760.666984705 m^3 | volume_sphere | `maxRadius=100` | | 61 | [Volume of Sphere](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_sphere.py) | Volume of sphere with radius $12 m = $ | $7238.229473870882 m^3$ | volume_sphere | `maxRadius=100` |
| 70 | [Angle between 2 vectors](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/angle_btw_vectors.py) | angle between the vectors [497.44, 781.23, 668.33, 665.31, 359.43, 287.08, 844.18, 596.49, 367.01, 674.44, 524.18, 217.7, 698.12] and [909.53, 70.04, 869.99, 53.15, 508.12, 404.16, 470.25, 955.48, 868.15, 987.99, 480.44, 354.16, 742.91] is: | 0.58 radians | angle_btw_vectors | `maxEltAmt=20` | | 70 | [Angle between 2 vectors](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/angle_btw_vectors.py) | angle between the vectors $[90.18, 778.39, 6.95, 189.4, 402.86]$ and $[937.62, 966.01, 986.87, 311.51, 725.29]$ is: | $0.77$ radians | angle_btw_vectors | `maxEltAmt=20` |
| 75 | [Area of a Sector](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/sector_area.py) | Given radius, 28 and angle, 255. Find the area of the sector. | Area of sector = 1744.63112 | sector_area | `maxRadius=49` `maxAngle=359` | | 75 | [Area of a Sector](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/sector_area.py) | What is the area of a sector with radius $27$ and angle $340$ degrees? | $2162.99$ | sector_area | `maxRadius=49` `maxAngle=359` |
| 86 | [Degrees to Radians](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/degree_to_rad.py) | Angle 47 in radians is = | 0.82 | degree_to_rad | `max_deg=360` | | 86 | [Degrees to Radians](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/degree_to_rad.py) | Angle $50$ degrees in radians is: | $0.87$ | degree_to_rad | `max_deg=360` |
| 87 | [Radians to Degrees](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/radian_to_deg.py) | Angle 0 in degrees is = | 0.0 | radian_to_deg | `max_rad=3` | | 87 | [Radians to Degrees](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/radian_to_deg.py) | Angle $1.14$ radians in degrees is: | $65.32$ | radian_to_deg | `max_rad=6.28` |
| 95 | [Curved surface area of a cylinder](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/curved_surface_area_cylinder.py) | What is the curved surface area of a cylinder of radius, 23 and height, 27? | CSA of cylinder = 3901.86 | curved_surface_area_cylinder | `maxRadius=49` `maxHeight=99` | | 95 | [Curved surface area of a cylinder](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/curved_surface_area_cylinder.py) | What is the curved surface area of a cylinder of radius, $42$ and height, $28$? | $7389.03$ | curved_surface_area_cylinder | `maxRadius=49` `maxHeight=99` |
| 96 | [Perimeter of Polygons](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/perimeter_of_polygons.py) | The perimeter of a 10 sided polygon with lengths of [58, 17, 71, 60, 116, 104, 35, 71, 105, 116]cm is: | 753 | perimeter_of_polygons | `maxSides=12` `maxLength=120` | | 96 | [Perimeter of Polygons](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/perimeter_of_polygons.py) | The perimeter of a $11$ sided polygon with lengths of $16, 109, 106, 37, 3, 59, 49, 1, 88, 43, 42$cm is: | $553$ | perimeter_of_polygons | `maxSides=12` `maxLength=120` |
| 104 | [Circumference](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/circumference.py) | Circumference of circle with radius 15 | 94.24777960769379 | circumference | `maxRadius=100` | | 104 | [Circumference](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/circumference.py) | Circumference of circle with radius $37 = $ | $232.48$ | circumference | `maxRadius=100` |
| 108 | [Arc length of Angle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/arc_length.py) | Given radius, 37 and angle, 201. Find the arc length of the angle. | Arc length of the angle = 129.80014 | arc_length | `maxRadius=49` `maxAngle=359` | | 108 | [Arc length of Angle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/arc_length.py) | Given radius, $49$ and angle, $13$. Find the arc length of the angle. | Arc length of the angle $= 11.11775$ | arc_length | `maxRadius=49` `maxAngle=359` |
| 112 | [Area of Circle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/area_of_circle.py) | Area of circle with radius 91 | 26026.0 | area_of_circle | `maxRadius=100` | | 112 | [Area of Circle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/area_of_circle.py) | Area of circle with radius $92=$ | $26590.44$ | area_of_circle | `maxRadius=100` |
| 113 | [Volume of frustum](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_frustum.py) | Volume of frustum with height = 40m and r1 = 6m is and r2 = 6m is | 21404.0 m^3 | volume_frustum | `maxR1=20` `maxR2=20` `maxHeight=50` `unit='m'` | | 113 | [Volume of frustum](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_frustum.py) | Volume of frustum with height $= 33m$ and $r1 = 7m$ is and $r2 = 7m$ is | $6669.0 m^3$ | volume_frustum | `maxR1=20` `maxR2=20` `maxHeight=50` `unit='m'` |
| 114 | [Equation of line from two points](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/equation_of_line_from_two_points.py) | What is the equation of the line between points (10,4) and (14,15) in slope-intercept form? | 4y = 11x -94 | equation_of_line_from_two_points | `maxCoordinate=20` `minCoordinate=-20` | | 114 | [Equation of line from two points](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/equation_of_line_from_two_points.py) | What is the equation of the line between points $(20,7)$ and $(-12,12)$ in slope-intercept form? | $32y = -5x + 324$ | equation_of_line_from_two_points | `maxCoordinate=20` `minCoordinate=-20` |
| 115 | [Area of Circle given center and a point on circle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py) | Area of circle with center (10,7) and passing through (14.86, 14.57) is | 254.47 | area_of_circle_given_center_and_point | `maxCoordinate = 10` `maxRadius=10` | | 115 | [Area of Circle given center and a point on circle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py) | Area of circle with center $(-8,9)$ and passing through $(-4.0, 9.0)$ is | $50.27$ | area_of_circle_given_center_and_point | `maxCoordinate = 10` `maxRadius=10` |
| 117 | [Volume of Hemisphere](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_hemisphere.py) | Volume of hemisphere with radius 39 m = | 124237.423 m^3 | volume_hemisphere | `maxRadius=100` | | 117 | [Volume of Hemisphere](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_hemisphere.py) | Volume of hemisphere with radius $25 m =$ | $32724.923 m^3$ | volume_hemisphere | `maxRadius=100` |
| 122 | [Volume of pyramid](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_pyramid.py) | Volume of pyramid with base length = 15 m, base width = 13 m and height = 37 m is | 2405.0 m^3 | volume_pyramid | `maxLength=20` `maxWidth=20` `maxHeight=50` `unit='m'` | | 122 | [Volume of pyramid](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_pyramid.py) | Volume of pyramid with base length $= 3 m$, base width $= 1 m$ and height $= 2 m$ is | $2.0 m^3$ | volume_pyramid | `maxLength=20` `maxWidth=20` `maxHeight=50` `unit='m'` |
| 123 | [Surface area of pyramid](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_pyramid.py) | Surface area of pyramid with base length = 40m, base width = 40m, and height = 16m | 2560 m^2 | surface_area_pyramid | `unit='m'` | | 123 | [Surface area of pyramid](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/surface_area_pyramid.py) | Surface area of pyramid with base length $= 6m$, base width $= 6m$, and height $= 4m$ is | $96 m^2$ | surface_area_pyramid | `unit='m'` |
| 125 | [Complementary and Supplementary Angle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/complementary_and_supplementary_angle.py) | The supplementary angle of 60 = | 120 | complementary_and_supplementary_angle | `maxSupp=180` `maxComp=90` | | 125 | [Complementary and Supplementary Angle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/complementary_and_supplementary_angle.py) | The supplementary angle of 48 = | 132 | complementary_and_supplementary_angle | `maxSupp=180` `maxComp=90` |
## misc ## misc
| Id | Skill | Example problem | Example Solution | Function Name | Kwargs | | Id | Skill | Example problem | Example Solution | Function Name | Kwargs |
|------|-------|-----------------|------------------|---------------|--------| |------|-------|-----------------|------------------|---------------|--------|
| 9 | [LCM (Least Common Multiple)](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/lcm.py) | LCM of 8 and 17 = | 136 | lcm | `maxVal=20` | | 9 | [LCM (Least Common Multiple)](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/lcm.py) | LCM of $11$ and $12 =$ | $132$ | lcm | `maxVal=20` |
| 10 | [GCD (Greatest Common Denominator)](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/gcd.py) | GCD of 12 and 6 = | 6 | gcd | `maxVal=20` | | 10 | [GCD (Greatest Common Denominator)](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/gcd.py) | GCD of $20$ and $9 = $ | $1$ | gcd | `maxVal=20` |
| 27 | [Prime Factorisation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/prime_factors.py) | Find prime factors of 151 | [151] | prime_factors | `minVal=1` `maxVal=200` | | 27 | [Prime Factorisation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/prime_factors.py) | Find prime factors of $84$ | $2, 2, 3, 7$ | prime_factors | `minVal=1` `maxVal=200` |
| 40 | [Common Factors](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/common_factors.py) | Common Factors of 8 and 95 = | [1] | common_factors | `maxVal=100` | | 40 | [Common Factors](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/common_factors.py) | Common Factors of $7$ and $44 = $ | $[1]$ | common_factors | `maxVal=100` |
| 51 | [HCF (Highest Common Factor)](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/hcf.py) | HCF of 16 and 3 = | 1 | hcf | `maxVal=20` | | 51 | [HCF (Highest Common Factor)](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/hcf.py) | HCF of $13$ and $5 = $ | $1$ | hcf | `maxVal=20` |
| 55 | [Comparing surds](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/surds_comparison.py) | Fill in the blanks 84^(1/6) _ 97^(1/1) | < | surds_comparison | `maxValue=100` `maxRoot=10` | | 55 | [Comparing surds](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/surds_comparison.py) | Fill in the blanks $23^{\frac{1}{9}}$ _ $63^{\frac{1}{2}}$ | $<$ | surds_comparison | `maxValue=100` `maxRoot=10` |
| 63 | [Profit or Loss Percent](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/profit_loss_percent.py) | Profit percent when CP = 258 and SP = 601 is: | 132.9457364341085 | profit_loss_percent | `maxCP=1000` `maxSP=1000` | | 63 | [Profit or Loss Percent](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/profit_loss_percent.py) | Profit percent when $CP = 145$ and $SP = 782$ is: | $439.31$ | profit_loss_percent | `maxCP=1000` `maxSP=1000` |
| 66 | [Geometric Progression](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/geometric_progression.py) | For the given GP [7, 14, 28, 56, 112, 224] ,Find the value of a,common ratio,7th term value, sum upto 11th term | The value of a is 7, common ratio is 2 , 7th term is 448 , sum upto 11th term is 14329.0 | geometric_progression | `number_values=6` `min_value=2` `max_value=12` `n_term=7` `sum_term=5` | | 66 | [Geometric Progression](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/geometric_progression.py) | For the given GP $[3, 36, 432, 5184, 62208, 746496]$. Find the value of a common ratio, 10th term value, sum upto 10th term | The value of a is $3$, common ratio is $12$ , 10th term is $15479341056$, sum upto 10th term is $16886553879.0$ | geometric_progression | `number_values=6` `min_value=2` `max_value=12` `n_term=7` `sum_term=5` |
| 67 | [Geometric Mean of N Numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/geometric_mean.py) | Geometric mean of 2 numbers 58 and 61 = | (58*61)^(1/2) = 59.481089431852205 | geometric_mean | `maxValue=100` `maxNum=4` | | 67 | [Geometric Mean of N Numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/geometric_mean.py) | Geometric mean of $3$ numbers $[15, 90, 74] = $ | $46.4$ | geometric_mean | `maxValue=100` `maxCount=4` |
| 68 | [Harmonic Mean of N Numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/harmonic_mean.py) | Harmonic mean of 3 numbers 65 , 98 and 30 = | 3/((1/65) + (1/98) + (1/30)) = 50.91474245115453 | harmonic_mean | `maxValue=100` `maxNum=4` | | 68 | [Harmonic Mean of N Numbers](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/harmonic_mean.py) | Harmonic mean of $4$ numbers $4, 94, 70, 14 = $ | $40.42123738481791$ | harmonic_mean | `maxValue=100` `maxNum=4` |
| 69 | [Euclidian norm or L2 norm of a vector](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/euclidian_norm.py) | Euclidian norm or L2 norm of the vector[666.3121024557763, 339.3827343783811, 598.1073078463166, 514.5857680685369, 604.2767600509419, 642.5534920836018, 452.63625705604005, 833.1252882301409] is: | 1690.7649282758944 | euclidian_norm | `maxEltAmt=20` | | 69 | [Euclidian norm or L2 norm of a vector](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/euclidian_norm.py) | Euclidian norm or L2 norm of the vector $[667.6348977529038, 679.4272834518646, 255.59424823283462, 642.7158651607829, 619.0578738657584, 693.3434890856785, 107.39417747607006]$ is: | $1503.75$ | euclidian_norm | `maxEltAmt=20` |
| 81 | [Celsius To Fahrenheit](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/celsius_to_fahrenheit.py) | Convert 76 degrees Celsius to degrees Fahrenheit = | 168.8 | celsius_to_fahrenheit | `maxTemp=100` | | 81 | [Celsius To Fahrenheit](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/celsius_to_fahrenheit.py) | Convert $2$ degrees Celsius to degrees Fahrenheit | $35.6$ | celsius_to_fahrenheit | `maxTemp=100` |
| 82 | [AP Term Calculation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/arithmetic_progression_term.py) | Find the term number 37 of the AP series: -100, -61, -22 ... | 1304 | arithmetic_progression_term | `maxd=100` `maxa=100` `maxn=100` | | 82 | [AP Term Calculation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/arithmetic_progression_term.py) | Find term number $67$ of the AP series: $56, 133, 210 ... $ | $5138$ | arithmetic_progression_term | `maxd=100` `maxa=100` `maxn=100` |
| 83 | [AP Sum Calculation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/arithmetic_progression_sum.py) | Find the sum of first 28 terms of the AP series: 81, 64, 47 ... | -4158.0 | arithmetic_progression_sum | `maxd=100` `maxa=100` `maxn=100` | | 83 | [AP Sum Calculation](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/arithmetic_progression_sum.py) | Find the sum of first $54$ terms of the AP series: $83, 42, 1 ... $ | $-54189.0$ | arithmetic_progression_sum | `maxd=100` `maxa=100` `maxn=100` |
| 85 | [Converts decimal to Roman Numerals](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/decimal_to_roman_numerals.py) | The number 0 in Roman Numerals is: | XIII | decimal_to_roman_numerals | `maxDecimal=4000` | | 85 | [Converts decimal to Roman Numerals](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/decimal_to_roman_numerals.py) | The number $0$ in Roman Numerals is: | $MMCCCLVI$ | decimal_to_roman_numerals | `maxDecimal=4000` |
| 92 | [Complex To Polar Form](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/complex_to_polar.py) | 18.6(11.0theta + i15.0theta) | 0.94 | complex_to_polar | `minRealImaginaryNum=-20, maxRealImaginaryNum=20` | | 92 | [Complex To Polar Form](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/complex_to_polar.py) | $17.12(2.0\theta + i17.0\theta)$ | $1.45$ | complex_to_polar | `minRealImaginaryNum=-20, maxRealImaginaryNum=20` |
| 93 | [Union,Intersection,Difference of Two Sets](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/set_operation.py) | Given the two sets a={9, 2, 3, 1} ,b={8, 6}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 2, 3, 6, 8, 9},Intersection is set(), a-b is {9, 2, 3, 1},b-a is {8, 6}, Symmetric difference is {1, 2, 3, 6, 8, 9} | set_operation | `minval=3` `maxval=7` `n_a=4` `n_b=5` | | 93 | [Union,Intersection,Difference of Two Sets](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/set_operation.py) | Given the two sets $a={2, 6, 8, 9, 10}$, $b={8, 10, 4}. Find the Union, intersection, a-b, b-a, and symmetric difference | Union is ${2, 4, 6, 8, 9, 10}$. Intersection is ${8, 10}$, a-b is ${9, 2, 6}$, b-a is ${4}$. Symmetric difference is ${2, 4, 6, 9}$. | set_operation | `minval=3` `maxval=7` `n_a=4` `n_b=5` |
| 94 | [Base Conversion](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/base_conversion.py) | Convert D6E8 from base 16 to base 10. | 55016 | base_conversion | `maxNum=60000` `maxBase=16` | | 94 | [Base Conversion](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/base_conversion.py) | Convert $56371$ from base $10$ to base $5$. | $3300441$ | base_conversion | `maxNum=60000` `maxBase=16` |
| 98 | [Quotient of Powers with Same Base](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/quotient_of_power_same_base.py) | The Quotient of 46^9 and 46^1 = 46^(9-1) = 46^8 | 20047612231936 | quotient_of_power_same_base | `maxBase=50` `maxPower=10` | | 98 | [Quotient of Powers with Same Base](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/quotient_of_power_same_base.py) | The Quotient of $17^{1}$ and $17^{9} = $17^{1-9} = 17^{-8}$ | $1.4335360832968505e-10$ | quotient_of_power_same_base | `maxBase=50` `maxPower=10` |
| 99 | [Quotient of Powers with Same Power](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/quotient_of_power_same_power.py) | The Quotient of 1^8 and 21^8 = (1/21)^8 = 0.047619047619047616^8 | 2.643903757924558e-11 | quotient_of_power_same_power | `maxBase=50` `maxPower=10` | | 99 | [Quotient of Powers with Same Power](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/quotient_of_power_same_power.py) | The Quotient of $33^{4}$ and $23^{4} = (33/23)^4 = 1.434782608695652^{4}$ | $4.237838629793346$ | quotient_of_power_same_power | `maxBase=50` `maxPower=10` |
| 101 | [Leap Year or Not](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/is_leap_year.py) | Year 1942 | is not a leap year | is_leap_year | `minNumber=1900` `maxNumber=2099` | | 101 | [Leap Year or Not](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/is_leap_year.py) | Is 1906 a leap year? | 1906 is not a leap year | is_leap_year | `minNumber=1900` `maxNumber=2099` |
| 102 | [Minute to Hour conversion](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/minutes_to_hours.py) | Convert 20 minutes to Hours & Minutes | 0 hours and 20 minutes | minutes_to_hours | `maxMinutes=999` | | 102 | [Minute to Hour conversion](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/minutes_to_hours.py) | Convert $381$ minutes to hours & minutes | $6$ hours and $21$ minutes | minutes_to_hours | `maxMinutes=999` |
| 106 | [signum function](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/signum_function.py) | signum of -217 is = | -1 | signum_function | `min=-999` `max=999` | | 106 | [signum function](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/signum_function.py) | signum of 985 is = | $1$ | signum_function | `min=-999` `max=999` |
| 109 | [Binomial distribution](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/binomial_distribution.py) | A manufacturer of metal pistons finds that, on average, 34.16% of the pistons they manufacture are rejected because they are incorrectly sized. What is the probability that a batch of 11 pistons will contain no more than 9 rejected pistons? | 99.98 | binomial_distribution | `` | | 109 | [Binomial distribution](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/binomial_distribution.py) | A manufacturer of metal pistons finds that, on average, $34.46$% of the pistons they manufacture are rejected because they are incorrectly sized. What is the probability that a batch of $10$ pistons will contain no more than $8$ rejected pistons? | $99.95$ | binomial_distribution | `` |
| 116 | [Factors of a number](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/factors.py) | Factors of 513 = | [1, 3, 9, 19, 27, 57, 171, 513] | factors | `maxVal=1000` | | 116 | [Factors of a number](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/factors.py) | Factors of $949 = $ | $[1, 13, 73, 949]$ | factors | `maxVal=1000` |
| 121 | [Product of scientific notations](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/product_of_scientific_notations.py) | Product of scientific notations 2.39x10^78 and 9.75x10^44 = | 2.33x10^123 | product_of_scientific_notations | `minExpVal=-100` `maxExpVal=100` | | 121 | [Product of scientific notations](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/product_of_scientific_notations.py) | Product of scientific notations $7.83 \times 10^{-39}$ and $6.12 \times 10^{-95} = $ | $4.79 \times 10^{-133}$ | product_of_scientific_notations | `minExpVal=-100` `maxExpVal=100` |
## statistics ## statistics
| Id | Skill | Example problem | Example Solution | Function Name | Kwargs | | Id | Skill | Example problem | Example Solution | Function Name | Kwargs |
|------|-------|-----------------|------------------|---------------|--------| |------|-------|-----------------|------------------|---------------|--------|
| 30 | [Combinations of Objects](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/combinations.py) | Number of combinations from 13 objects picked 9 at a time | 715 | combinations | `maxlength=20` | | 30 | [Combinations of Objects](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/combinations.py) | Find the number of combinations from $14$ objects picked $6$ at a time. | $3003$ | combinations | `maxlength=20` |
| 42 | [Permutations](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/permutation.py) | Number of Permutations from 11 objects picked 3 at a time = | 990 | permutation | `maxlength=20` | | 42 | [Permutations](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/permutation.py) | Number of Permutations from $17$ objects picked $6$ at a time is: | $8910720$ | permutation | `maxlength=20` |
| 52 | [Probability of a certain sum appearing on faces of dice](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/dice_sum_probability.py) | If 2 dice are rolled at the same time, the probability of getting a sum of 4 = | 3/36 | dice_sum_probability | `maxDice=3` | | 52 | [Probability of a certain sum appearing on faces of dice](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/dice_sum_probability.py) | If $3$ dice are rolled at the same time, the probability of getting a sum of $3 =$ | \frac{1}{216} | dice_sum_probability | `maxDice=3` |
| 54 | [Confidence interval For sample S](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/confidence_interval.py) | The confidence interval for sample [254, 295, 271, 281, 218, 270, 242, 274, 247, 202, 253, 226, 237, 296, 286, 214, 215, 240, 248, 283, 290, 205, 230, 251, 224, 227] with 90% confidence is | (258.3421056762939, 240.04250970832146) | confidence_interval | `` | | 54 | [Confidence interval For sample S](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/confidence_interval.py) | The confidence interval for sample $[226, 260, 221, 245, 282, 274, 207, 299, 257, 211, 233, 239, 206, 208, 242, 224, 265, 287, 230, 276, 256, 237, 215, 291, 216, 251, 255, 229, 279, 275, 210, 203, 220, 292]$ with $95$% confidence is | $(254.41804694839914, 235.052541286895)$ | confidence_interval | `` |
| 59 | [Mean,Standard Deviation,Variance](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/data_summary.py) | Find the mean,standard deviation and variance for the data[21, 49, 37, 16, 24, 23, 18, 38, 50, 40, 13, 7, 29, 46, 41] | The Mean is 30.133333333333333 , Standard Deviation is 178.38222222222223, Variance is 13.35598076601723 | data_summary | `number_values=15` `minval=5` `maxval=50` | | 59 | [Mean,Standard Deviation,Variance](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/data_summary.py) | Find the mean,standard deviation and variance for the data $48, 38, 10, 5, 24, 46, 50, 17, 20, 13, 17, 14, 5, 20, 34$ | The Mean is $24.066666666666666$, Standard Deviation is $220.0622222222222$, Variance is $14.834494336586678$ | data_summary | `number_values=15` `minval=5` `maxval=50` |
| 76 | [Mean and Median](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/mean_median.py) | Given the series of numbers [4, 5, 20, 30, 32, 42, 52, 56, 71, 86]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 39.8 and Arithmetic median of this series is 37.0 | mean_median | `maxlen=10` | | 76 | [Mean and Median](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/mean_median.py) | Given the series of numbers $[6, 30, 32, 39, 42, 65, 72, 80, 84, 85]$. Find the arithmatic mean and mdian of the series | Arithmetic mean of the series is $53.5$ and Arithmetic median of this series is $53.5$ | mean_median | `maxlen=10` |
| 107 | [Conditional Probability](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/conditional_probability.py) | Someone tested positive for a nasty disease which only 1.84% of population have. Test sensitivity (true positive) is equal to SN= 95.07% whereas test specificity (true negative) SP= 95.68%. What is the probability that this guy really has that disease? | 29.2% | conditional_probability | `` | | 107 | [Conditional Probability](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/statistics/conditional_probability.py) | Someone tested positive for a nasty disease which only $1.26\%$ of the population have. Test sensitivity (true positive) is equal to $SN=93.71$% whereas test specificity (true negative) $SP=90.62\%$. What is the probability that this guy really has that disease? | $11.31$% | conditional_probability | `` |

View File

@@ -1,5 +1,4 @@
pytest pytest
hypothesis
flake8 flake8
autopep8 autopep8
sympy sympy

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxVariable=10, format='string'): def gen_func(maxVariable=10):
a = random.randint(1, maxVariable) a = random.randint(1, maxVariable)
b = random.randint(1, maxVariable) b = random.randint(1, maxVariable)
c = random.randint(b, maxVariable) c = random.randint(b, maxVariable)
@@ -21,16 +21,9 @@ def gen_func(maxVariable=10, format='string'):
elif a == 1 or a == i: elif a == 1 or a == i:
x = f"{c - b}" x = f"{c - b}"
if format == 'string': problem = f"${a}x + {b} = {c}$"
problem = f"{a}x + {b} = {c}" solution = f"${x}$"
solution = x
return problem, solution return problem, solution
elif format == 'latex':
problem = f"\\({a}x + {b} = {c}\\)"
solution = "\\(" + x + "\\)"
return problem, solution
else:
return a, b, c, x
basic_algebra = Generator("Basic Algebra", 11, gen_func, basic_algebra = Generator("Basic Algebra", 11, gen_func,

View File

@@ -2,49 +2,22 @@ from ...generator import Generator
import random import random
def gen_func(maxCoef=10, maxExp=20, maxTerms=10, format='string'): def gen_func(maxCoef=10, maxExp=20, maxTerms=10):
numTerms = random.randint(1, maxTerms) numTerms = random.randint(1, maxTerms)
problem = ""
solution = ""
coefs = [random.randint(1, maxCoef) for _ in range(numTerms)]
exponents = [random.randint(1, max(maxExp - 1, 2)) for _ in range(numTerms)]
problem = " + ".join([f"{coefs[i]}x^{{{exponents[i]}}}" for i in range(numTerms)])
d = {}
for i in range(numTerms): for i in range(numTerms):
if i > 0: if exponents[i] in d:
problem += " + " d[exponents[i]] += coefs[i]
solution += " + "
coefficient = random.randint(1, maxCoef)
exponent = random.randint(1, max(numTerms - 1, 2))
problem += str(coefficient) + "x^" + str(exponent)
solution = combineTerms(problem)
if format == 'string':
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else: else:
return problem, solution d[exponents[i]] = coefs[i]
solution = " + ".join([f"{d[k]}x^{{{k}}}" for k in sorted(d)])
return f'${problem}$', f'${solution}$'
def combineTerms(string):
each_terms = string.split("+")
dict_power_wise_terms = {}
for i in range(11):
dict_power_wise_terms[i] = []
for term in each_terms:
term = term.split("^")
appendee = term[0].split("x")[0]
if len(term) == 1:
dict_power_wise_terms[1].append(int(appendee))
else:
dict_power_wise_terms[int(term[1])].append(int(appendee))
final_string = ''
for i in range(11):
if len(dict_power_wise_terms[i]) != 0:
total = sum(dict_power_wise_terms[i])
final_string += str(total) + "x^" + str(i) + " + "
final_string = '+'.join(final_string.split("+")[:-1])
return final_string
combine_like_terms = Generator("Combine Like terms", 105, gen_func, combine_like_terms = Generator("Combine Like terms", 105, gen_func,

View File

@@ -39,16 +39,16 @@ def gen_func(prob_type=0, max_range=10, format='string'):
eq += str(c) + ' = 0' eq += str(c) + ' = 0'
problem = 'Find the roots of given Quadratic Equation ' + eq problem = f'Find the roots of given Quadratic Equation ${eq}$'
if d < 0: if d < 0:
sqrt_d = (-d)**0.5 sqrt_d = (-d)**0.5
if sqrt_d - int(sqrt_d) == 0: if sqrt_d - int(sqrt_d) == 0:
sqrt_d = int(sqrt_d) sqrt_d = int(sqrt_d)
solution = f'(({-b} + {sqrt_d}i)/2*{a}, ({-b} - {sqrt_d}i)/2*{a})' solution = f'(\\frac{{{-b} + {sqrt_d}i}}{{2*{a}}}, \\frac{{{-b} - {sqrt_d}i}}{{2*{a}}})'
else: else:
solution = f'(({-b} + sqrt({-d})i)/2*{a}, ({-b} - sqrt({-d})i)/2*{a})' solution = f'(\\frac{{{-b} + \\sqrt{{{-d}}}i}}{{2*{a}}}, \\frac{{{-b} - \\sqrt{{{-d}}}i}}{{2*{a}}})'
return problem, solution return problem, solution
@@ -60,11 +60,11 @@ def gen_func(prob_type=0, max_range=10, format='string'):
if sqrt_d - int(sqrt_d) == 0: if sqrt_d - int(sqrt_d) == 0:
sqrt_d = int(sqrt_d) sqrt_d = int(sqrt_d)
g_sol = f'(({-b} + {sqrt_d})/2*{a}, ({-b} - {sqrt_d})/2*{a})' g_sol = f'(\\frac{{{-b} + {sqrt_d}}}{{2*{a}}}, \\frac{{{-b} - {sqrt_d}}}{{2*{a}}})'
else: else:
g_sol = f'(({-b} + sqrt({d}))/2*{a}, ({-b} - sqrt({d}))/2*{a})' g_sol = f'(\\frac{{{-b} + \\sqrt{{{d}}}}}{{2*{a}}}, (\\frac{{{-b} - \\sqrt{{{d}}}}}{{2*{a}}})'
solution = f'simplified solution : ({s_root1, s_root2}), generalized solution : ' + g_sol solution = f'$({s_root1, s_root2}) = {g_sol}$'
return problem, solution return problem, solution

View File

@@ -4,23 +4,14 @@ import random
def gen_func(maxPrinciple=10000, def gen_func(maxPrinciple=10000,
maxRate=10, maxRate=10,
maxTime=10, maxTime=10):
format='string'):
p = random.randint(1000, maxPrinciple) p = random.randint(1000, maxPrinciple)
r = random.randint(1, maxRate) r = random.randint(1, maxRate)
n = random.randint(1, maxTime) n = random.randint(1, maxTime)
a = round(p * (1 + r / 100)**n, 2) a = round(p * (1 + r / 100)**n, 2)
if format == 'string': problem = f"Compound interest for a principle amount of ${p}$ dollars, ${r}$% rate of interest and for a time period of ${n}$ years is $=$"
problem = "Compound interest for a principle amount of " + \ return problem, f'${a}$'
str(p) + " dollars, " + str(r) + \
"% rate of interest and for a time period of " + \
str(n) + " year is = "
return problem, str(a)
elif format == 'latex':
return "Latex unavailable"
else:
return p, r, n, a
compound_interest = Generator( compound_interest = Generator(

View File

@@ -2,22 +2,17 @@ from ...generator import Generator
import random import random
def gen_func(maxValXY=20, minValXY=-20, format='string'): def gen_func(maxValXY=20, minValXY=-20):
point1X = random.randint(minValXY, maxValXY + 1) point1X = random.randint(minValXY, maxValXY + 1)
point1Y = random.randint(minValXY, maxValXY + 1) point1Y = random.randint(minValXY, maxValXY + 1)
point2X = random.randint(minValXY, maxValXY + 1) point2X = random.randint(minValXY, maxValXY + 1)
point2Y = random.randint(minValXY, maxValXY + 1) point2Y = random.randint(minValXY, maxValXY + 1)
distanceSq = (point1X - point2X)**2 + (point1Y - point2Y)**2 distanceSq = (point1X - point2X) ** 2 + (point1Y - point2Y) ** 2
if format == 'string': solution = f"$\\sqrt{{{distanceSq}}}$"
solution = f"sqrt({distanceSq})" problem = f"Find the distance between $({point1X}, {point1Y})$ and $({point2X}, {point2Y})$"
problem = f"Find the distance between ({point1X}, {point1Y}) and ({point2X}, {point2Y})"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return point1X, point1Y, point2X, point2Y, distanceSq
distance_two_points = Generator("Distance between 2 points", 24, distance_two_points = Generator("Distance between 2 points", 24,

View File

@@ -5,20 +5,19 @@ import random
def gen_func(range_x1=10, def gen_func(range_x1=10,
range_x2=10, range_x2=10,
range_a=10, range_a=10,
range_b=10, range_b=10):
format='string'):
x1 = random.randint(-range_x1, range_x1) x1 = random.randint(-range_x1, range_x1)
x2 = random.randint(-range_x2, range_x2) x2 = random.randint(-range_x2, range_x2)
a = random.randint(-range_a, range_a) a = random.randint(-range_a, range_a)
b = random.randint(-range_b, range_b) b = random.randint(-range_b, range_b)
def intParser(z): def intParser(z):
if (z == 0):
return ""
if (z > 0): if (z > 0):
return "+" + str(z) return f"+{z}"
if (z < 0): elif (z < 0):
return "-" + str(abs(z)) return f"-{abs(z)}"
else:
return ""
c1 = intParser(a * b) c1 = intParser(a * b)
c2 = intParser((a * x2) + (b * x1)) c2 = intParser((a * x2) + (b * x1))
@@ -35,7 +34,7 @@ def gen_func(range_x1=10,
p1 = p1[1:] p1 = p1[1:]
if p3 == "+1": if p3 == "+1":
p3 = "" p3 = ""
elif p3 == "+": elif p3[0] == "+":
p3 = p3[1:] p3 = p3[1:]
if c1 == "+1": if c1 == "+1":
@@ -45,14 +44,9 @@ def gen_func(range_x1=10,
if c2 == "+1": if c2 == "+1":
c2 = "" c2 = ""
if format == 'string': problem = f"$({p1}x{p2})({p3}x{p4})$"
problem = f"({p1}x{p2})({p3}x{p4})" solution = f"${c1}x^2{c2}x{c3}$"
solution = f"{c1}*x^2{c2}*x{c3}"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return p1, p2, p3, p4, c1, c2, c3
expanding = Generator( expanding = Generator(

View File

@@ -2,17 +2,18 @@ from ...generator import Generator
import random import random
def gen_func(range_x1=10, range_x2=10, format='string'): def gen_func(range_x1=10, range_x2=10):
"""Given a quadratic equation in the form x^2 + bx + c, factor it into it's roots (x - x1)(x -x2)"""
x1 = random.randint(-range_x1, range_x1) x1 = random.randint(-range_x1, range_x1)
x2 = random.randint(-range_x2, range_x2) x2 = random.randint(-range_x2, range_x2)
def intParser(z): def intParser(z):
if (z == 0):
return ""
if (z > 0): if (z > 0):
return "+" + str(z) return f"+{z}"
if (z < 0): elif (z < 0):
return "-" + str(abs(z)) return f"-{abs(z)}"
else:
return ""
b = intParser(x1 + x2) b = intParser(x1 + x2)
c = intParser(x1 * x2) c = intParser(x1 * x2)
@@ -24,15 +25,10 @@ def gen_func(range_x1=10, range_x2=10, format='string'):
else: else:
problem = f"x^2{b}x{c}" problem = f"x^2{b}x{c}"
if format == 'string':
x1 = intParser(x1) x1 = intParser(x1)
x2 = intParser(x2) x2 = intParser(x2)
solution = f"(x{x1})(x{x2})" solution = f"$(x{x1})(x{x2})$"
return problem, solution return f"${problem}$", solution
elif format == 'latex':
return "Latex unavailable"
else:
return b, c, x1, x2
factoring = Generator("Factoring Quadratic", 21, gen_func, factoring = Generator("Factoring Quadratic", 21, gen_func,

View File

@@ -1,23 +1,20 @@
from ...generator import Generator from ...generator import Generator
from ...latexBuilder import bmatrix
import random import random
def gen_func(maxMatrixVal=100, format='string'): def gen_func(maxMatrixVal=100):
a = random.randint(0, maxMatrixVal) a = random.randint(0, maxMatrixVal)
b = random.randint(0, maxMatrixVal) b = random.randint(0, maxMatrixVal)
c = random.randint(0, maxMatrixVal) c = random.randint(0, maxMatrixVal)
d = random.randint(0, maxMatrixVal) d = random.randint(0, maxMatrixVal)
determinant = a * d - b * c determinant = a * d - b * c
lst = [[a, b], [c, d]]
if format == 'string': problem = f"$\\det {bmatrix(lst)}= $"
problem = f"Det([[{a}, {b}], [{c}, {d}]]) = " solution = f"${determinant}$"
solution = f" {determinant}"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c, d, determinant
int_matrix_22_determinant = Generator("Determinant to 2x2 Matrix", 77, int_matrix_22_determinant = Generator("Determinant to 2x2 Matrix", 77,

View File

@@ -8,8 +8,7 @@ def gen_func(minM=-10,
minB=-10, minB=-10,
maxB=10, maxB=10,
minDenominator=1, minDenominator=1,
maxDenominator=6, maxDenominator=6):
format='string'):
def generateEquationString(m, b): def generateEquationString(m, b):
""" """
Generates an equation given the slope and intercept. Generates an equation given the slope and intercept.
@@ -66,11 +65,10 @@ def gen_func(minM=-10,
b1 = random.randint(minB, maxB) b1 = random.randint(minB, maxB)
b2 = random.randint(minB, maxB) b2 = random.randint(minB, maxB)
equation1 = generateEquationString(m1, b1) eq1 = generateEquationString(m1, b1)
equation2 = generateEquationString(m2, b2) eq2 = generateEquationString(m2, b2)
problem = "Find the point of intersection of the two lines: " problem = f"Find the point of intersection of the two lines: ${eq1}$ and ${eq2}$"
problem += f"{equation1} and {equation2}"
m1 = fractions.Fraction(*m1) m1 = fractions.Fraction(*m1)
m2 = fractions.Fraction(*m2) m2 = fractions.Fraction(*m2)
@@ -84,14 +82,9 @@ def gen_func(minM=-10,
else: else:
intersection_x = (b1 - b2) / (m2 - m1) intersection_x = (b1 - b2) / (m2 - m1)
intersection_y = ((m2 * b1) - (m1 * b2)) / (m2 - m1) intersection_y = ((m2 * b1) - (m1 * b2)) / (m2 - m1)
solution = f"({fractionToString(intersection_x)}, {fractionToString(intersection_y)})" solution = f"$({fractionToString(intersection_x)}, {fractionToString(intersection_y)})$"
if format == 'string':
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return equation1, equation2, solution
intersection_of_two_lines = Generator( intersection_of_two_lines = Generator(

View File

@@ -1,4 +1,5 @@
from ...generator import Generator from ...generator import Generator
from ...latexBuilder import bmatrix
import random import random
import math import math
import sympy import sympy
@@ -6,8 +7,7 @@ import sympy
def gen_func(SquareMatrixDimension=3, def gen_func(SquareMatrixDimension=3,
MaxMatrixElement=99, MaxMatrixElement=99,
OnlyIntegerElementsInInvertedMatrix=False, OnlyIntegerElementsInInvertedMatrix=True):
format='string'):
if OnlyIntegerElementsInInvertedMatrix is True: if OnlyIntegerElementsInInvertedMatrix is True:
isItOk = False isItOk = False
Mat = list() Mat = list()
@@ -77,17 +77,12 @@ def gen_func(SquareMatrixDimension=3,
Mat.append(z) Mat.append(z)
Mat = sympy.Matrix(Mat) Mat = sympy.Matrix(Mat)
if format == 'string': problem = 'Inverse of Matrix $' + bmatrix(Mat.tolist()) + '$ is:'
problem = 'Inverse of Matrix ' + str(Mat) + ' is:' solution = bmatrix(sympy.Matrix.inv(Mat).tolist())
solution = str(sympy.Matrix.inv(Mat))
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return Mat, sympy.Matrix.inv(Mat)
invert_matrix = Generator("Inverse of a Matrix", 74, gen_func, [ invert_matrix = Generator("Inverse of a Matrix", 74, gen_func, [
"SquareMatrixDimension=3", "MaxMatrixElement=99", "SquareMatrixDimension=3", "MaxMatrixElement=99",
"OnlyIntegerElementsInInvertedMatrix=False" "OnlyIntegerElementsInInvertedMatrix=True"
]) ])

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(n=2, varRange=20, coeffRange=20, format='string'): def gen_func(n=2, varRange=20, coeffRange=20):
if n > 10: if n > 10:
print("[!] n cannot be greater than 10") print("[!] n cannot be greater than 10")
return None, None return None, None
@@ -10,7 +10,7 @@ def gen_func(n=2, varRange=20, coeffRange=20, format='string'):
vars = ['x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g'][:n] vars = ['x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g'][:n]
soln = [random.randint(-varRange, varRange) for i in range(n)] soln = [random.randint(-varRange, varRange) for i in range(n)]
problem = list() problem = list()
solution = ", ".join( solution = "$, $".join(
["{} = {}".format(vars[i], soln[i]) for i in range(n)]) ["{} = {}".format(vars[i], soln[i]) for i in range(n)])
for _ in range(n): for _ in range(n):
@@ -27,14 +27,9 @@ def gen_func(n=2, varRange=20, coeffRange=20, format='string'):
problem.append(prob) problem.append(prob)
# problem = "\n".join(problem) # problem = "\n".join(problem)
problem = ", ".join(problem) problem = "$ and $".join(problem)
if format == 'string': return f'Given the equations ${problem}$, solve for $x$ and $y$', f'${solution}$'
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return problem, solution
linear_equations = Generator("Linear Equations", 26, gen_func, linear_equations = Generator("Linear Equations", 26, gen_func,

View File

@@ -7,16 +7,9 @@ def gen_func(maxBase=3, maxVal=8, format='string'):
b = random.randint(2, maxBase) b = random.randint(2, maxBase)
c = pow(b, a) c = pow(b, a)
if format == 'string': problem = f'$log_{{{b}}}({c})=$'
problem = "log" + str(b) + "(" + str(c) + ")" solution = f'${a}$'
solution = str(a)
return problem, solution return problem, solution
elif format == 'latex':
problem = "\\(\\log_{" + str(b) + "}" + str(c) + "\\)"
solution = "\\(" + str(a) + "\\)"
return problem, solution
else:
return b, c, a
log = Generator("Logarithm", 12, gen_func, ["maxBase=3", "maxVal=8"]) log = Generator("Logarithm", 12, gen_func, ["maxBase=3", "maxVal=8"])

View File

@@ -1,62 +1,29 @@
from ...generator import Generator from ...generator import Generator
from ...latexBuilder import bmatrix
import random import random
def gen_func(maxVal=100, max_dim=10, format='string'): def gen_func(maxVal=100, max_dim=10):
m = random.randint(2, max_dim) m = random.randint(2, max_dim)
n = random.randint(2, max_dim) n = random.randint(2, max_dim)
k = random.randint(2, max_dim) k = random.randint(2, max_dim)
# generate matrices a and b # generate matrices a and b
a = [] a = [[random.randint(-maxVal, maxVal) for _ in range(n)] for _ in range(m)]
for r in range(m): b = [[random.randint(-maxVal, maxVal) for _ in range(k)] for _ in range(n)]
a.append([])
for c in range(n):
a[r].append(random.randint(-maxVal, maxVal))
b = []
for r in range(n):
b.append([])
for c in range(k):
b[r].append(random.randint(-maxVal, maxVal))
res = [] res = []
a_string = matrixMultiplicationFuncHelper(a)
b_string = matrixMultiplicationFuncHelper(b)
for r in range(m): for r in range(m):
res.append([]) res.append([])
for c in range(k): for c in range(k):
temp = 0 temp = 0
for t in range(n): for t in range(n):
temp += a[r][t] * b[t][c] temp += a[r][t] * b[t][c]
res[r].append(temp) res[r].append(temp)
# consider using a, b instead of a_string, b_string if the problem doesn't look right problem = f"Multiply ${bmatrix(a)}$ and ${bmatrix(b)}$"
if format == 'string': solution = f'${bmatrix(res)}$'
problem = f"Multiply \n{a_string}\n and \n\n{b_string}"
solution = matrixMultiplicationFuncHelper(res)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a_string, b_string, res
def matrixMultiplicationFuncHelper(inp):
m = len(inp)
n = len(inp[0])
string = "[["
for i in range(m):
for j in range(n):
string += f"{inp[i][j]: 6d}"
string += ", " if j < n - 1 else ""
string += "]\n [" if i < m - 1 else ""
string += "]]"
return string
matrix_multiplication = Generator("Multiplication of two matrices", 46, matrix_multiplication = Generator("Multiplication of two matrices", 46,

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxValue=20, format='string'): def gen_func(maxValue=20):
x1 = random.randint(-20, maxValue) x1 = random.randint(-20, maxValue)
y1 = random.randint(-20, maxValue) y1 = random.randint(-20, maxValue)
x2 = random.randint(-20, maxValue) x2 = random.randint(-20, maxValue)
@@ -10,14 +10,9 @@ def gen_func(maxValue=20, format='string'):
xm = (x1 + x2) / 2 xm = (x1 + x2) / 2
ym = (y1 + y2) / 2 ym = (y1 + y2) / 2
if format == 'string': problem = f"The midpoint of $({x1},{y1})$ and $({x2},{y2}) = $"
problem = f"({x1},{y1}),({x2},{y2})=" solution = f"$({xm},{ym})$"
solution = f"({xm},{ym})"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return x1, y1, x2, y2, xm, ym
midpoint_of_two_points = Generator("Midpoint of the two point", 20, midpoint_of_two_points = Generator("Midpoint of the two point", 20,

View File

@@ -3,22 +3,16 @@ import random
def gen_func(minRealImaginaryNum=-20, def gen_func(minRealImaginaryNum=-20,
maxRealImaginaryNum=20, maxRealImaginaryNum=20):
format='string'):
num1 = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum), num1 = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum),
random.randint(minRealImaginaryNum, maxRealImaginaryNum)) random.randint(minRealImaginaryNum, maxRealImaginaryNum))
num2 = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum), num2 = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum),
random.randint(minRealImaginaryNum, maxRealImaginaryNum)) random.randint(minRealImaginaryNum, maxRealImaginaryNum))
product = num1 * num2 product = num1 * num2
if format == 'string': problem = f"${num1} * {num2} = $"
problem = f"{num1} * {num2} = " solution = f'${product}$'
solution = str(product)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return num1, num2, product
multiply_complex_numbers = Generator( multiply_complex_numbers = Generator(

View File

@@ -1,4 +1,5 @@
from ...generator import Generator from ...generator import Generator
from ...latexBuilder import bmatrix
import random import random
@@ -14,20 +15,12 @@ def gen_func(maxMatrixVal=10, maxRes=100, format='string'):
b1 = b * constant b1 = b * constant
c1 = c * constant c1 = c * constant
d1 = d * constant d1 = d * constant
lst = [[a, b], [c, d]]
lst1 = [[a1, b1], [c1, d1]]
if format == 'string': problem = f'${constant} * {bmatrix(lst)} =$'
problem = f"{constant} * [[{a}, {b}], [{c}, {d}]] = " solution = f'${bmatrix(lst1)}$'
solution = f"[[{a1},{b1}],[{c1},{d1}]]"
return problem, solution return problem, solution
elif format == 'latex':
problem = "\\(" + str(constant) + "\\cdot\\begin{bmatrix}" + str(
a) + "&" + str(b) + "\\\\" + str(c) + "&" + str(
d) + "\\end{bmatrix}=\\)"
solution = "\\(\\begin{bmatrix}" + str(a1) + "&" + str(b1) + \
"\\\\" + str(c1) + "&" + str(d1) + "\\end{bmatrix}\\)"
return problem, solution
else:
return constant, a, b, c, d, a1, b1, c1, d1
multiply_int_to_22_matrix = Generator("Integer Multiplication with 2x2 Matrix", multiply_int_to_22_matrix = Generator("Integer Multiplication with 2x2 Matrix",

View File

@@ -3,23 +3,17 @@ import random
import math import math
def gen_func(maxVal=100, format='string'): def gen_func(maxVal=100):
a = random.randint(1, maxVal) a = random.randint(1, maxVal)
c = random.randint(1, maxVal) c = random.randint(1, maxVal)
b = random.randint( b = random.randint(
round(math.sqrt(4 * a * c)) + 1, round(math.sqrt(4 * maxVal * maxVal))) round(math.sqrt(4 * a * c)) + 1, round(math.sqrt(4 * maxVal * maxVal)))
D = math.sqrt(b * b - 4 * a * c) D = math.sqrt(b * b - 4 * a * c)
res = [round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)] res = {round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)}
if format == 'string': problem = f"What are the zeros of the quadratic equation ${a}x^2+{b}x+{c}=0$"
problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format( solution = f'${res}$'
a, b, c)
solution = str(res)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c, res
quadratic_equation = Generator("Quadratic Equation", 50, gen_func, quadratic_equation = Generator("Quadratic Equation", 50, gen_func,

View File

@@ -4,24 +4,15 @@ import random
def gen_func(maxPrinciple=10000, def gen_func(maxPrinciple=10000,
maxRate=10, maxRate=10,
maxTime=10, maxTime=10):
format='string'): p = random.randint(1000, maxPrinciple)
a = random.randint(1000, maxPrinciple) r = random.randint(1, maxRate)
b = random.randint(1, maxRate) t = random.randint(1, maxTime)
c = random.randint(1, maxTime) s = round((p * r * t) / 100, 2)
d = round((a * b * c) / 100, 2)
if format == 'string': problem = f"Simple interest for a principle amount of ${p}$ dollars, ${r}$% rate of interest and for a time period of ${t}$ years is $=$ "
problem = "Simple interest for a principle amount of " + str( solution = f'${s}$'
a) + " dollars, " + str(
b) + "% rate of interest and for a time period of " + str(
c) + " years is = "
solution = str(d)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c, d
simple_interest = Generator("Simple Interest", 45, gen_func, simple_interest = Generator("Simple Interest", 45, gen_func,

View File

@@ -45,14 +45,9 @@ def gen_func(range_x=10,
'' if x_str != '' else '0') '' if x_str != '' else '0')
return f'{x_str}{op}{y_str} = {coeffs[2]}' return f'{x_str}{op}{y_str} = {coeffs[2]}'
if format == 'string': problem = f"Given ${coeffToFuncString(new_c1)}$ and ${coeffToFuncString(new_c2)}$, solve for $x$ and $y$."
problem = f"{coeffToFuncString(new_c1)}, {coeffToFuncString(new_c2)}" solution = f"$x = {x}$, $y = {y}$"
solution = f"x = {x}, y = {y}"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return new_c1, new_c2, x, y
# Add random (non-zero) multiple of equations to each other # Add random (non-zero) multiple of equations to each other

View File

@@ -2,22 +2,17 @@ from ...generator import Generator
import random import random
def gen_func(minVal=-20, maxVal=20, format='string'): def gen_func(minVal=-20, maxVal=20):
a = [random.randint(minVal, maxVal) for i in range(3)] a = [random.randint(minVal, maxVal) for _ in range(3)]
b = [random.randint(minVal, maxVal) for i in range(3)] b = [random.randint(minVal, maxVal) for _ in range(3)]
c = [ c = [
a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2],
a[0] * b[1] - a[1] * b[0] a[0] * b[1] - a[1] * b[0]
] ]
if format == 'string': problem = f"${a} \\times {b} = $"
problem = str(a) + " X " + str(b) + " = " solution = f"${c}$"
solution = str(c)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c
vector_cross = Generator("Cross Product of 2 Vectors", 43, gen_func, vector_cross = Generator("Cross Product of 2 Vectors", 43, gen_func,

View File

@@ -2,19 +2,14 @@ from ...generator import Generator
import random import random
def gen_func(minVal=-20, maxVal=20, format='string'): def gen_func(minVal=-20, maxVal=20):
a = [random.randint(minVal, maxVal) for i in range(3)] a = [random.randint(minVal, maxVal) for i in range(3)]
b = [random.randint(minVal, maxVal) for i in range(3)] b = [random.randint(minVal, maxVal) for i in range(3)]
c = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] c = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
if format == 'string': problem = f'${a}\\cdot{b}=$'
problem = str(a) + " . " + str(b) + " = " solution = f'${c}$'
solution = str(c)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c
vector_dot = Generator("Dot Product of 2 Vectors", 72, gen_func, vector_dot = Generator("Dot Product of 2 Vectors", 72, gen_func,

View File

@@ -2,17 +2,12 @@ from ...generator import Generator
import random import random
def gen_func(maxA=100, maxB=100, format='string'): def gen_func(maxA=100, maxB=100):
a = random.randint(-1 * maxA, maxA) a = random.randint(-1 * maxA, maxA)
b = random.randint(-1 * maxB, maxB) b = random.randint(-1 * maxB, maxB)
absDiff = abs(a - b) absDiff = abs(a - b)
if format == "string": return f'$|{a}-{b}|=$', f"${absDiff}$"
return "|" + str(a) + "-" + str(b) + "|=", absDiff
elif format == 'latex':
return ("\\(|" + str(a) + "-" + str(b) + "|=\\)", f"\\({absDiff}\\)")
else:
return a, b, absDiff
absolute_difference = Generator("Absolute difference between two numbers", 71, absolute_difference = Generator("Absolute difference between two numbers", 71,

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxSum=99, maxAddend=50, format='string'): def gen_func(maxSum=99, maxAddend=50):
if maxAddend > maxSum: if maxAddend > maxSum:
maxAddend = maxSum maxAddend = maxSum
a = random.randint(0, maxAddend) a = random.randint(0, maxAddend)
@@ -10,16 +10,9 @@ def gen_func(maxSum=99, maxAddend=50, format='string'):
b = random.randint(0, min((maxSum - a), maxAddend)) b = random.randint(0, min((maxSum - a), maxAddend))
c = a + b c = a + b
if format == "string": problem = f'${a}+{b}=$'
problem = str(a) + "+" + str(b) + "=" solution = f'${c}$'
solution = str(c)
return problem, solution return problem, solution
elif format == 'latex':
problem = "\\(" + str(a) + '+' + str(b) + "\\)"
solution = str(c)
return problem, solution
else:
return a, b, c
addition = Generator("Addition", 0, gen_func, ["maxSum=99", "maxAddend=50"]) addition = Generator("Addition", 0, gen_func, ["maxSum=99", "maxAddend=50"])

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxVal=10, format='string'): def gen_func(maxVal=10):
a = random.randint(1, maxVal) a = random.randint(1, maxVal)
b = random.randint(1, maxVal) b = random.randint(1, maxVal)
c = random.randint(1, maxVal) c = random.randint(1, maxVal)
@@ -23,16 +23,8 @@ def gen_func(maxVal=10, format='string'):
else: else:
solution = "=" solution = "="
if format == "string": problem = f"Which symbol represents the comparison between $\\frac{{{a}}}{{{b}}}$ and $\\frac{{{c}}}{{{d}}}$?"
return ( return problem, solution
f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?",
solution)
elif format == 'latex':
return (
f"Which symbol represents the comparison between \\(\\frac{{{a}}}{{{b}}}\\) and \\(\\frac{{{c}}}{{{d}}}\\)?",
solution)
else:
return a, b, c, d, solution
compare_fractions = Generator("Compare Fractions", 44, gen_func, compare_fractions = Generator("Compare Fractions", 44, gen_func,

View File

@@ -2,16 +2,11 @@ from ...generator import Generator
import random import random
def gen_func(minNo=1, maxNo=1000, format='string'): def gen_func(minNo=1, maxNo=1000):
b = random.randint(minNo, maxNo) b = random.randint(minNo, maxNo)
a = b**(1 / 3) a = b**(1 / 3)
if format == 'string': return (f"What is the cube root of: $\\sqrt[3]{{{b}}}=$ to 2 decimal places?", f"${round(a, 2)}$")
return "What is the cube root of " + str(b) + " up to 2 decimal places?", str(round(a, 2))
elif format == 'latex':
return (f"\\(\\sqrt[3]{{{b}}}=\\)", "\\(" + str(round(a, 2)) + "\\)")
else:
return b, a
cube_root = Generator("Cube Root", 47, gen_func, ["minNo=1", "maxNo=1000"]) cube_root = Generator("Cube Root", 47, gen_func, ["minNo=1", "maxNo=1000"])

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxVal=10, format='string'): def gen_func(maxVal=10):
a = random.randint(1, maxVal) a = random.randint(1, maxVal)
b = random.randint(1, maxVal) b = random.randint(1, maxVal)
@@ -25,24 +25,8 @@ def gen_func(maxVal=10, format='string'):
gcd = calculate_gcd(tmp_n, tmp_d) gcd = calculate_gcd(tmp_n, tmp_d)
sol_numerator = tmp_n // gcd sol_numerator = tmp_n // gcd
sol_denominator = tmp_d // gcd sol_denominator = tmp_d // gcd
x = f"{sol_numerator}/{sol_denominator}"
if (tmp_d == 1 or tmp_d == gcd): return f'$\\frac{{{a}}}{{{b}}}\\div\\frac{{{c}}}{{{d}}}=$', f'$\\frac{{{sol_numerator}}}{{{sol_denominator}}}$'
x = f"{sol_numerator}"
if format == 'string':
return f"({a}/{b})/({c}/{d})", x
elif format == 'latex':
problem = "\\(\\frac{" + str(a) + "}{" + str(b) + \
"}\\div\\frac{" + str(c) + "}{" + str(d) + "}=\\)"
if tmp_d == 1 or tmp_d == gcd:
solution = "\\(" + str(sol_numerator) + "\\)"
else:
solution = "\\(\\frac{" + str(sol_numerator) + \
"}{" + str(sol_denominator) + "}\\)"
return problem, solution
else:
return a, b, c, d, x
divide_fractions = Generator("Fraction Division", 16, gen_func, divide_fractions = Generator("Fraction Division", 16, gen_func,

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxA=25, maxB=25, format='string'): def gen_func(maxA=25, maxB=25):
a = random.randint(1, maxA) a = random.randint(1, maxA)
b = random.randint(1, maxB) b = random.randint(1, maxB)
@@ -10,13 +10,7 @@ def gen_func(maxA=25, maxB=25, format='string'):
dividend = random.choice([a, b]) dividend = random.choice([a, b])
quotient = int(divisor / dividend) quotient = int(divisor / dividend)
if format == 'string': return f'${divisor}\\div{dividend}=$', f'${quotient}$'
return f"{divisor}/{dividend}=", str(quotient)
elif format == 'latex':
return ("\\(" + str(divisor) + "\\div" + str(dividend) + "=\\)",
"\\(" + str(quotient) + "\\)")
else:
return divisor, dividend, quotient
division = Generator("Division", 3, gen_func, ["maxA=25", "maxB=25"]) division = Generator("Division", 3, gen_func, ["maxA=25", "maxB=25"])

View File

@@ -2,16 +2,11 @@ from ...generator import Generator
import random import random
def gen_func(maxBase=20, maxExpo=10, format='string'): def gen_func(maxBase=20, maxExpo=10):
base = random.randint(1, maxBase) base = random.randint(1, maxBase)
expo = random.randint(1, maxExpo) expo = random.randint(1, maxExpo)
if format == 'string': return f'${base}^{expo} =$', f'${base**expo}$'
return (f"{base}^{expo} =", str(base**expo))
elif format == 'latex':
return f"\\({base}^{{{expo}}}\\)", "\\(" + str(base**expo) + "\\)"
else:
return base, expo, base**expo
exponentiation = Generator("Exponentiation", 53, gen_func, exponentiation = Generator("Exponentiation", 53, gen_func,

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxInput=6, format='string'): def gen_func(maxInput=6):
a = random.randint(0, maxInput) a = random.randint(0, maxInput)
n = a n = a
b = 1 b = 1
@@ -10,12 +10,7 @@ def gen_func(maxInput=6, format='string'):
b *= n b *= n
n -= 1 n -= 1
if format == 'string': return f'${a}! =$', f'${b}$'
return str(a) + "! = ", str(b)
elif format == 'latex':
return "Latex unavailable"
else:
return a, b
factorial = Generator("Factorial", 31, gen_func, ["maxInput=6"]) factorial = Generator("Factorial", 31, gen_func, ["maxInput=6"])

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxVal=10, format='string'): def gen_func(maxVal=10):
a = random.randint(1, maxVal) a = random.randint(1, maxVal)
b = random.randint(1, maxVal) b = random.randint(1, maxVal)
c = random.randint(1, maxVal) c = random.randint(1, maxVal)
@@ -23,22 +23,13 @@ def gen_func(maxVal=10, format='string'):
tmp_d = b * d tmp_d = b * d
gcd = calculate_gcd(tmp_n, tmp_d) gcd = calculate_gcd(tmp_n, tmp_d)
x = f"{tmp_n//gcd}/{tmp_d//gcd}"
problem = f"$\\frac{{{a}}}{{{b}}}\\cdot\\frac{{{c}}}{{{d}}}=$"
if (tmp_d == 1 or tmp_d == gcd): if (tmp_d == 1 or tmp_d == gcd):
x = f"{tmp_n//gcd}" solution = f"$\\frac{{{tmp_n}}}{{{gcd}}}$"
if format == 'string':
return f"({a}/{b})*({c}/{d})", x
elif format == 'latex':
problem = f"\\(\\frac{{{a}}}{{{b}}}\\cdot\\frac{{{c}}}{{{d}}}=\\)"
if (tmp_d == 1 or tmp_d == gcd):
solution = f"\\(\\frac{{{tmp_n}}}{{{gcd}}}\\)"
else: else:
solution = f"\\(\\frac{{{tmp_n//gcd}}}{{{tmp_d//gcd}}}\\)" solution = f"$\\frac{{{tmp_n//gcd}}}{{{tmp_d//gcd}}}$"
return problem, solution return problem, solution
else:
return a, b, c, d, x
fraction_multiplication = Generator("Fraction Multiplication", 28, fraction_multiplication = Generator("Fraction Multiplication", 28,

View File

@@ -2,18 +2,12 @@ from ...generator import Generator
import random import random
def gen_func(maxRes=99, maxDivid=99, format='string'): def gen_func(maxRes=99, maxDivid=99):
a = random.randint(0, maxDivid) a = random.randint(0, maxDivid)
b = random.randint(1, min(maxRes, maxDivid)) b = random.randint(1, min(maxRes, maxDivid))
c = round(a / b, 2) c = round(a / b, 2)
if format == "string": return f'${a}\\div{b}=$', f'${c}$'
return (str(a) + "/" + str(b) + "=", str(c))
elif format == 'latex':
return ("\\(" + str(a) + "\\div" + str(b) + "=\\)",
"\\(" + str(c) + "\\)")
else:
return a, b, c
fraction_to_decimal = Generator("Fraction to Decimal", 13, gen_func, fraction_to_decimal = Generator("Fraction to Decimal", 13, gen_func,

View File

@@ -10,7 +10,7 @@ def greatestCommonDivisorOfTwoNumbers(number1, number2):
return number1 return number1
def gen_func(numbersCount=2, maximalNumberLimit=10**9, format='string'): def gen_func(numbersCount=2, maximalNumberLimit=10**9):
numbersCount = max(numbersCount, 2) numbersCount = max(numbersCount, 2)
numbers = [random.randint(0, maximalNumberLimit) numbers = [random.randint(0, maximalNumberLimit)
for number in range(numbersCount)] for number in range(numbersCount)]
@@ -22,12 +22,7 @@ def gen_func(numbersCount=2, maximalNumberLimit=10**9, format='string'):
greatestCommonDivisor = greatestCommonDivisorOfTwoNumbers( greatestCommonDivisor = greatestCommonDivisorOfTwoNumbers(
numbers[index], greatestCommonDivisor) numbers[index], greatestCommonDivisor)
if format == "string": return f'$GCD({",".join(map(str, numbers))})=$', f"${greatestCommonDivisor}$"
return "GCD(" + ",".join(map(str, numbers)) + ")=", str(greatestCommonDivisor)
elif format == "latex":
return ("\\(GCD(" + ",".join(map(str, numbers)) + ")=", f"\\({greatestCommonDivisor}\\)")
else:
return greatestCommonDivisor
greatest_common_divisor = Generator("Greatest Common Divisor of N Numbers", 120, gen_func, [ greatest_common_divisor = Generator("Greatest Common Divisor of N Numbers", 120, gen_func, [

View File

@@ -2,25 +2,18 @@ from ...generator import Generator
import random import random
def gen_func(maxNum=250, format='string'): def gen_func(maxNum=250):
a = random.randint(2, maxNum) a = random.randint(2, maxNum)
problem = f"Is {a} composite?" problem = f"Is ${a}$ composite?"
if a == 0 or a == 1: if a == 0 or a == 1:
solution = "No" return problem, "No"
return (problem, solution)
for i in range(2, a): for i in range(2, a):
if a % i == 0: if a % i == 0:
solution = "Yes" return problem, "Yes"
return (problem, solution)
solution = "No" solution = "No"
if format == 'string':
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, solution
is_composite = Generator('Is Composite', 124, gen_func, ["maxNum=250"]) is_composite = Generator('Is Composite', 124, gen_func, ["maxNum=250"])

View File

@@ -2,27 +2,19 @@ from ...generator import Generator
import random import random
def gen_func(max_num=100, format='string'): def gen_func(max_num=100):
a = random.randint(2, max_num) a = random.randint(2, max_num)
problem = f"Is {a} prime?" problem = f"Is ${a}$ prime?"
if a == 2: if a == 2:
solution = "Yes" return problem, "Yes"
return (problem, solution)
if a % 2 == 0: if a % 2 == 0:
solution = "No" return problem, "No"
return (problem, solution)
for i in range(3, a // 2 + 1, 2): for i in range(3, a // 2 + 1, 2):
if a % i == 0: if a % i == 0:
solution = "No" return problem, "No"
return (problem, solution)
solution = "Yes" solution = "Yes"
if format == 'string':
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, solution
is_prime = Generator('isprime', 90, gen_func, ["max_num=100"]) is_prime = Generator('isprime', 90, gen_func, ["max_num=100"])

View File

@@ -2,20 +2,12 @@ from ...generator import Generator
import random import random
def gen_func(maxMulti=12, format='string'): def gen_func(maxMulti=12):
a = random.randint(0, maxMulti) a = random.randint(0, maxMulti)
b = random.randint(0, maxMulti) b = random.randint(0, maxMulti)
c = a * b c = a * b
if format == 'string': return f'${a}\\cdot{b}$', f'${c}$'
problem = str(a) + "*" + str(b) + "="
solution = str(c)
return problem, solution
elif format == 'latex':
problem = "\\(" + str(a) + "\\cdot" + str(b) + "=\\)"
solution = "\\(" + str(c) + "\\)"
else:
return a, b, c
multiplication = Generator("Multiplication", 2, gen_func, multiplication = Generator("Multiplication", 2, gen_func,

View File

@@ -2,20 +2,15 @@ from ...generator import Generator
import random import random
def gen_func(maxValue=99, maxpercentage=99, format='string'): def gen_func(maxValue=99, maxpercentage=99):
a = random.randint(1, maxpercentage) a = random.randint(1, maxpercentage)
b = random.randint(1, maxValue) b = random.randint(1, maxValue)
problem = f"What is {a}% of {b}?" problem = f"What is ${a}$% of ${b}$?"
percentage = a / 100 * b percentage = a / 100 * b
formatted_float = "{:.2f}".format(percentage) formatted_float = "{:.2f}".format(percentage)
solution = f"{formatted_float}" solution = f"${formatted_float}$"
if format == 'string':
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, formatted_float
percentage = Generator("Percentage of a number", 80, gen_func, percentage = Generator("Percentage of a number", 80, gen_func,

View File

@@ -2,24 +2,17 @@ from ...generator import Generator
import random import random
def gen_func(maxValue=200, minValue=0, format='string'): def gen_func(maxValue=200, minValue=0):
value_a = random.randint(minValue, maxValue) value_a = random.randint(minValue, maxValue)
value_b = random.randint(minValue, maxValue) value_b = random.randint(minValue, maxValue)
diff = 2 * (abs(value_a - value_b) / abs(value_a + value_b)) * 100 diff = 2 * (abs(value_a - value_b) / abs(value_a + value_b)) * 100
diff = round(diff, 2) diff = round(diff, 2)
if format == 'string': problem = f"What is the percentage difference between ${value_a}$ and ${value_b}$?"
problem = f"What is the percentage difference between {value_a} and {value_b}?" solution = f'${diff}$%'
solution = str(diff) + "%"
return problem, solution return problem, solution
elif format == 'latex':
return 'Latex unavailable'
else:
return value_a, value_b, diff
percentage_difference = Generator("Percentage difference", 118, gen_func, percentage_difference = Generator("Percentage difference", 118, gen_func,
["maxValue=200", "minValue=0"]) ["maxValue=200", "minValue=0"])

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxValue=100, minValue=-100, format='string'): def gen_func(maxValue=100, minValue=-100):
observed_value = random.randint(minValue, maxValue) observed_value = random.randint(minValue, maxValue)
exact_value = random.randint(minValue, maxValue) exact_value = random.randint(minValue, maxValue)
@@ -12,17 +12,10 @@ def gen_func(maxValue=100, minValue=-100, format='string'):
error = (abs(observed_value - exact_value) / abs(exact_value)) * 100 error = (abs(observed_value - exact_value) / abs(exact_value)) * 100
error = round(error, 2) error = round(error, 2)
if format == 'string': problem = f"Find the percentage error when observed value equals ${observed_value}$ and exact value equals ${exact_value}$."
problem = f"Find the percentage error when observed value equals {observed_value} and exact value equals {exact_value}." solution = f'${error}\\%$'
solution = str(error) + "%"
return problem, solution return problem, solution
elif format == 'latex':
return 'Latex unavailable'
else:
return observed_value, exact_value, error
percentage_error = Generator( percentage_error = Generator(
"Percentage error", 119, gen_func, "Percentage error", 119, gen_func,

View File

@@ -2,23 +2,15 @@ from ...generator import Generator
import random import random
def gen_func(maxBase=50, maxPower=10, format='string'): def gen_func(maxBase=50, maxPower=10):
base = random.randint(1, maxBase) base = random.randint(1, maxBase)
power1 = random.randint(1, maxPower) power1 = random.randint(1, maxPower)
power2 = random.randint(1, maxPower) power2 = random.randint(1, maxPower)
step = power1 * power2 step = power1 * power2
if format == 'string': problem = f"Simplify ${base}^{{{power1}^{{{power2}}}}}$"
problem = f"Simplify {base}^{power1}^{power2}=" solution = f"${base}^{{{step}}}$"
solution = str(base) + '^' + str(step)
return problem, solution return problem, solution
elif format == 'latex':
problem = "Simplify \\(" + str(base) + \
"^{" + str(power1) + "^{" + str(power2) + "}}\\)"
solution = f"\\({base}^{{{step}}}\\)"
return problem, solution
else:
return base, power1, power2, base, step
power_of_powers = Generator("Power of Powers", 97, gen_func, power_of_powers = Generator("Power of Powers", 97, gen_func,

View File

@@ -2,20 +2,11 @@ from ...generator import Generator
import random import random
def gen_func(maxSquareNum=20, format='string'): def gen_func(maxSquareNum=20):
a = random.randint(1, maxSquareNum) a = random.randint(1, maxSquareNum)
b = a * a b = a ** 2
if format == 'string': return f'${a}^2=$', f'${b}$'
problem = str(a) + "^2" + "="
solution = str(b)
return problem, solution
if format == 'latex':
problem = "\\(" + str(a) + "^{2}=\\)"
solution = "\\(" + str(b) + "\\)"
return problem, solution
else:
return a, b
square = Generator("Square", 8, gen_func, ["maxSquareNum=20"]) square = Generator("Square", 8, gen_func, ["maxSquareNum=20"])

View File

@@ -2,20 +2,11 @@ from ...generator import Generator
import random import random
def gen_func(minNo=1, maxNo=12, format='string'): def gen_func(minNo=1, maxNo=12):
b = random.randint(minNo, maxNo) b = random.randint(minNo, maxNo)
a = b * b a = b ** 2
if format == 'string': return f'$\\sqrt{{{a}}}=$', f'${b}$'
problem = "sqrt(" + str(a) + ")="
solution = str(b)
return problem, solution
elif format == 'latex':
problem = "\\(\\sqrt{" + str(a) + "}=\\)"
solution = "\\(" + str(b) + "\\)"
return problem, solution
else:
return a, b
square_root = Generator("Square Root", 6, gen_func, square_root = Generator("Square Root", 6, gen_func,

View File

@@ -2,19 +2,12 @@ from ...generator import Generator
import random import random
def gen_func(maxMinuend=99, maxDiff=99, format='string'): def gen_func(maxMinuend=99, maxDiff=99):
a = random.randint(0, maxMinuend) a = random.randint(0, maxMinuend)
b = random.randint(max(0, (a - maxDiff)), a) b = random.randint(max(0, (a - maxDiff)), a)
c = a - b c = a - b
if format == 'string': return f'${a}-{b}=$', f'${c}$'
problem = str(a) + "-" + str(b) + "="
solution = str(c)
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c
subtraction = Generator("Subtraction", 1, gen_func, subtraction = Generator("Subtraction", 1, gen_func,

View File

@@ -1,5 +1,5 @@
from .definite_integral import definite_integral from .definite_integral import definite_integral
from .differentiation import differentiation
from .power_rule_differentiation import power_rule_differentiation from .power_rule_differentiation import power_rule_differentiation
from .power_rule_integration import power_rule_integration from .power_rule_integration import power_rule_integration
from .stationary_points import stationary_points from .stationary_points import stationary_points
from .trig_differentiation import trig_differentiation

View File

@@ -3,7 +3,7 @@ import random
from scipy.integrate import quad from scipy.integrate import quad
def gen_func(max_coeff=100, format='string'): def gen_func(max_coeff=100):
def integrand(x, a, b, c): def integrand(x, a, b, c):
return a * x**2 + b * x + c return a * x**2 + b * x + c
@@ -14,15 +14,9 @@ def gen_func(max_coeff=100, format='string'):
result = quad(integrand, 0, 1, args=(a, b, c))[0] result = quad(integrand, 0, 1, args=(a, b, c))[0]
S = round(result, 4) S = round(result, 4)
if format == 'string': problem = f"The definite integral within limits $0$ to $1$ of the equation ${a}x^2 + {b}x + {c} = $"
problem = "The definite integral within limits 0 to 1 of the equation " + \ solution = f'${S}$'
str(a) + "x^2 + " + str(b) + "x + " + str(c) + " is = "
solution = str(S)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c, S
definite_integral = Generator("Definite Integral of Quadratic Equation", 89, definite_integral = Generator("Definite Integral of Quadratic Equation", 89,

View File

@@ -1,59 +0,0 @@
from ...generator import Generator
import random
import sympy
def genDifferentiationProblem(diff_lvl=2):
problem = ''
types = {
'Logrithmic': ['ln'],
'Trigonometric': ['sin', 'cos', 'tan', 'cot', 'sec'],
'Exponentional': ['exp']
}
if diff_lvl == 1:
coeff = random.randrange(2, 10)
power = random.randint(2, 4)
flag = random.random()
if flag > 0.5:
power *= -1
problem += str(coeff) + '*x^' + '(' + str(power) + ')'
else:
problem += str(coeff) + '*x^' + str(power)
if diff_lvl == 2:
func_type = random.choices(list(types.keys()), weights=(1, 4, 1))[0]
func = random.choice(types[func_type])
problem += func + '(x)' + '+' + genDifferentiationProblem(1)
if diff_lvl == 3:
func_type = random.choices(list(types.keys()), weights=(1, 4, 1))[0]
func = random.choice(types[func_type])
problem += func + '(' + genDifferentiationProblem(1) + ')'
if diff_lvl == 4:
operator = random.choice(('/', '*'))
problem = '(' + genDifferentiationProblem(2) + ')' + \
operator + '(' + genDifferentiationProblem(3) + ')'
return problem
def gen_func(diff_lvl=2, format='string'):
if diff_lvl < 1 or diff_lvl > 4:
print("diff_lvl not supported")
return None
problem = genDifferentiationProblem(diff_lvl)
x = sympy.symbols('x')
solution = str(sympy.diff(problem.replace('^', '**'), x))
solution = solution.replace('**', '^')
problem = f"differentiate w.r.t x : d({problem})/dx"
if format == 'string':
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return problem, solution
differentiation = Generator("Differentiation", 88, gen_func,
["diff_lvl=2"])

View File

@@ -4,11 +4,10 @@ import random
def gen_func(maxCoef=10, def gen_func(maxCoef=10,
maxExp=10, maxExp=10,
maxTerms=5, maxTerms=5):
format='string'):
numTerms = random.randint(1, maxTerms) numTerms = random.randint(1, maxTerms)
problem = "" problem = "$"
solution = "" solution = "$"
for i in range(numTerms): for i in range(numTerms):
if i > 0: if i > 0:
@@ -17,15 +16,10 @@ def gen_func(maxCoef=10,
coefficient = random.randint(1, maxCoef) coefficient = random.randint(1, maxCoef)
exponent = random.randint(1, maxExp) exponent = random.randint(1, maxExp)
problem += str(coefficient) + "x^" + str(exponent) problem += f'{coefficient}x^{{{exponent}}}'
solution += str(coefficient * exponent) + "x^" + str(exponent - 1) solution += f'{coefficient * exponent}x^{{{exponent - 1}}}'
if format == 'string': return problem + '$', solution + '$'
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return problem, solution
power_rule_differentiation = Generator( power_rule_differentiation = Generator(

View File

@@ -4,11 +4,10 @@ import random
def gen_func(maxCoef=10, def gen_func(maxCoef=10,
maxExp=10, maxExp=10,
maxTerms=5, maxTerms=5):
format='string'):
numTerms = random.randint(1, maxTerms) numTerms = random.randint(1, maxTerms)
problem = "" problem = "$"
solution = "" solution = "$"
for i in range(numTerms): for i in range(numTerms):
if i > 0: if i > 0:
@@ -17,18 +16,12 @@ def gen_func(maxCoef=10,
coefficient = random.randint(1, maxCoef) coefficient = random.randint(1, maxCoef)
exponent = random.randint(1, maxExp) exponent = random.randint(1, maxExp)
problem += str(coefficient) + "x^" + str(exponent) problem += f'{coefficient}x^{{{exponent}}}'
solution += "(" + str(coefficient) + "/" + \ solution += f'\\frac{{{coefficient}}}{{{exponent}}}x^{{{exponent + 1}}}'
str(exponent) + ")x^" + str(exponent + 1)
solution += " + c" solution += " + C"
if format == 'string': return problem + '$', solution + '$'
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return problem, solution
power_rule_integration = Generator("Power Rule Integration", 48, power_rule_integration = Generator("Power Rule Integration", 48,

View File

@@ -3,8 +3,9 @@ import random
import sympy import sympy
def gen_func(maxExp=3, maxCoef=10, format='string'): def gen_func(maxExp=3, maxCoef=10):
while True: solution = ''
while len(solution) == 0:
x = sympy.symbols('x') x = sympy.symbols('x')
problem = 0 problem = 0
for exp in range(maxExp + 1): for exp in range(maxExp + 1):
@@ -12,17 +13,8 @@ def gen_func(maxExp=3, maxCoef=10, format='string'):
problem += coefficient * pow(x, exp) problem += coefficient * pow(x, exp)
solution = sympy.stationary_points(problem, x) solution = sympy.stationary_points(problem, x)
# if len(solution) != 0:
solution = ','.join(
'({},{})'.format(str(p), sympy.sympify(problem.replace(x, p)))
for p in solution)
problem = 'f(x)=' + str(problem).replace('**', '^') problem = 'f(x)=' + str(problem).replace('**', '^')
if format == 'string': return f'${problem}$', f'${sympy.latex(solution)[6:-8]}}}$'
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return problem, solution
stationary_points = Generator("Stationary Points", 110, gen_func, stationary_points = Generator("Stationary Points", 110, gen_func,

View File

@@ -0,0 +1,22 @@
from ...generator import Generator
import random
def gen_func():
pairs = {
'\\sin': '\\cos',
'\\cos': '-\\sin',
'\\tan': '\\sec^{{2}}',
'\\cot': '-\\csc^{{2}}',
'\\sec': '\\sec \\cdot \\tan',
'\\csc': '-\\csc \\cdot \\cot'
}
problem = random.choice(list(pairs.keys()))
solution = f'${pairs[problem]}$'
problem = f'$\\frac{{d}}{{dx}}({problem})=$'
return problem, solution
trig_differentiation = Generator("Trigonometric Differentiation", 88, gen_func,
[])

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxNumber=10000, format='string'): def gen_func(maxNumber=10000):
n = random.randint(1000, maxNumber) n = random.randint(1000, maxNumber)
binstring = '' binstring = ''
while True: while True:
@@ -16,14 +16,9 @@ def gen_func(maxNumber=10000, format='string'):
else: else:
n = q n = q
if format == 'string': problem = f"Integer of Binary Coded Decimal ${n}$ is $=$ "
problem = "Integer of Binary Coded Decimal " + str(n) + " is = " solution = f'${int(binstring, 2)}$'
solution = int(binstring, 2)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return n, int(binstring, 2)
bcd_to_decimal = Generator("Binary Coded Decimal to Integer", 91, bcd_to_decimal = Generator("Binary Coded Decimal to Integer", 91,

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxDigits=10, format='string'): def gen_func(maxDigits=10):
digits = random.randint(1, maxDigits) digits = random.randint(1, maxDigits)
question = ''.join([str(random.randint(0, 1)) question = ''.join([str(random.randint(0, 1))
for i in range(digits)]).lstrip('0') for i in range(digits)]).lstrip('0')
@@ -24,14 +24,9 @@ def gen_func(maxDigits=10, format='string'):
if j == 0 and carry is True: if j == 0 and carry is True:
answer.insert(0, '1') answer.insert(0, '1')
if format == 'string': problem = f"2's complement of ${question} = $"
problem = "2's complement of " + question + " ="
solution = ''.join(answer).lstrip('0') solution = ''.join(answer).lstrip('0')
return problem, solution return problem, f'${solution}$'
elif format == 'latex':
return "Latex unavailable"
else:
return question, answer
binary_2s_complement = Generator("Binary 2's Complement", 73, binary_2s_complement = Generator("Binary 2's Complement", 73,

View File

@@ -2,22 +2,17 @@ from ...generator import Generator
import random import random
def gen_func(maxDigits=10, format='string'): def gen_func(maxDigits=10):
question = '' question = ''
answer = '' answer = ''
for i in range(random.randint(1, maxDigits)): for _ in range(random.randint(1, maxDigits)):
temp = str(random.randint(0, 1)) temp = str(random.randint(0, 1))
question += temp question += temp
answer += "0" if temp == "1" else "1" answer += "0" if temp == "1" else "1"
if format == 'string': problem = f'${question} = $'
problem = question + "=" return problem, f'${answer}$'
return problem, answer
elif format == 'latex':
return "Latex unavailable"
else:
return problem, answer
binary_complement_1s = Generator("Binary Complement 1s", 4, binary_complement_1s = Generator("Binary Complement 1s", 4,

View File

@@ -2,20 +2,15 @@ from ...generator import Generator
import random import random
def gen_func(max_dig=10, format='string'): def gen_func(max_dig=10):
problem = '' problem = ''
for i in range(random.randint(1, max_dig)): for _ in range(random.randint(1, max_dig)):
temp = str(random.randint(0, 1)) temp = str(random.randint(0, 1))
problem += temp problem += temp
if format == 'string': solution = f'${int(problem, 2)}$'
solution = int(problem, 2) return f'${problem}$', solution
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return problem, solution
binary_to_decimal = Generator("Binary to Decimal", 15, gen_func, binary_to_decimal = Generator("Binary to Decimal", 15, gen_func,

View File

@@ -2,19 +2,14 @@ from ...generator import Generator
import random import random
def gen_func(max_dig=10, format='string'): def gen_func(max_dig=10):
problem = '' problem = ''
for i in range(random.randint(1, max_dig)): for _ in range(random.randint(1, max_dig)):
temp = str(random.randint(0, 1)) temp = str(random.randint(0, 1))
problem += temp problem += temp
if format == 'string': solution = f'${hex(int(problem, 2))}$'
solution = hex(int(problem, 2)) return f'${problem}$', solution
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return problem, solution
binary_to_hex = Generator("Binary to Hexidecimal", 64, gen_func, binary_to_hex = Generator("Binary to Hexidecimal", 64, gen_func,

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxNumber=10000, format='string'): def gen_func(maxNumber=10000):
n = random.randint(1000, maxNumber) n = random.randint(1000, maxNumber)
x = n x = n
# binstring = '' # binstring = ''
@@ -12,14 +12,8 @@ def gen_func(maxNumber=10000, format='string'):
bcdstring = str(nibble) + bcdstring bcdstring = str(nibble) + bcdstring
x >>= 4 x >>= 4
if format == 'string': problem = f"BCD of Decimal Number ${n} = $"
problem = "BCD of Decimal Number " + str(n) + " is = " return problem, f'${bcdstring}$'
solution = bcdstring
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return n, int(bcdstring)
decimal_to_bcd = Generator("Decimal to Binary Coded Decimal", 103, decimal_to_bcd = Generator("Decimal to Binary Coded Decimal", 103,

View File

@@ -2,18 +2,13 @@ from ...generator import Generator
import random import random
def gen_func(max_dec=99, format='string'): def gen_func(max_dec=99):
a = random.randint(1, max_dec) a = random.randint(1, max_dec)
b = bin(a).replace("0b", "") b = bin(a).replace("0b", "")
if format == 'string': problem = f'Binary of ${a} = $'
problem = "Binary of " + str(a) + "=" solution = f'${b}$'
solution = str(b)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, str(b)
decimal_to_binary = Generator("Decimal to Binary", 14, gen_func, decimal_to_binary = Generator("Decimal to Binary", 14, gen_func,

View File

@@ -2,18 +2,13 @@ from ...generator import Generator
import random import random
def gen_func(max_dec=1000, format='string'): def gen_func(max_dec=1000):
a = random.randint(0, max_dec) a = random.randint(0, max_dec)
b = hex(a) b = hex(a)
if format == 'string': problem = f"Binary of ${a} = $"
problem = "Binary of " + str(a) + "=" solution = f"${b}$"
solution = str(b)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, str(b)
decimal_to_hexadeci = Generator("Decimal to Hexadecimal", 79, gen_func, decimal_to_hexadeci = Generator("Decimal to Hexadecimal", 79, gen_func,

View File

@@ -2,17 +2,13 @@ from ...generator import Generator
import random import random
def gen_func(maxDecimal=4096, format='string'): def gen_func(maxDecimal=4096):
x = random.randint(0, maxDecimal) x = random.randint(0, maxDecimal)
problem = "The decimal number " + str(x) + " in Octal is: "
solution = oct(x)
if format == 'string': problem = "The decimal number ${x}$ in Octal is: "
solution = f'${oct(x)}$'
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return x, oct(x)
decimal_to_octal = Generator("Converts decimal to octal", 84, decimal_to_octal = Generator("Converts decimal to octal", 84,

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(minNo=1, format='string'): def gen_func(minNo=1):
n = random.randint(minNo, 20) n = random.randint(minNo, 20)
def createFibList(n): def createFibList(n):
@@ -17,14 +17,9 @@ def gen_func(minNo=1, format='string'):
fibList = createFibList(n) fibList = createFibList(n)
if format == 'string': problem = "The Fibonacci Series of the first ${n}$ numbers is ?"
problem = "The Fibonacci Series of the first " + str( solution = ', '.join(map(str, fibList))
n) + " numbers is ?" return problem, f'${solution}$'
return problem, fibList
elif format == 'latex':
return "Latex unavailable"
else:
return n, fibList
fibonacci_series = Generator("Fibonacci Series", 56, gen_func, fibonacci_series = Generator("Fibonacci Series", 56, gen_func,

View File

@@ -2,19 +2,14 @@ from ...generator import Generator
import random import random
def gen_func(maxRes=99, maxModulo=99, format='string'): def gen_func(maxRes=99, maxModulo=99):
a = random.randint(0, maxModulo) a = random.randint(0, maxModulo)
b = random.randint(0, min(maxRes, maxModulo)) b = random.randint(0, min(maxRes, maxModulo))
c = a % b if b != 0 else 0 c = a % b if b != 0 else 0
if format == 'string': problem = f'${a}$ % ${b} = $'
problem = str(a) + "%" + str(b) + "=" solution = f'${c}$'
solution = str(c)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c
modulo_division = Generator("Modulo Division", 5, gen_func, modulo_division = Generator("Modulo Division", 5, gen_func,

View File

@@ -3,18 +3,14 @@ import random
import math import math
def gen_func(maxN=100, format='string'): def gen_func(maxN=100):
gratio = (1 + math.sqrt(5)) / 2 gratio = (1 + math.sqrt(5)) / 2
n = random.randint(1, maxN) n = random.randint(1, maxN)
problem = f"What is the {n}th Fibonacci number?"
ans = int((math.pow(gratio, n) - math.pow(-gratio, -n)) / (math.sqrt(5)))
if format == 'string': problem = f"What is the {n}th Fibonacci number?"
return problem, str(ans) solution = int((math.pow(gratio, n) - math.pow(-gratio, -n)) / (math.sqrt(5)))
elif format == 'latex':
return "Latex unavailable" return problem, f'${solution}$'
else:
return n, ans
nth_fibonacci_number = Generator("nth Fibonacci number", 62, nth_fibonacci_number = Generator("nth Fibonacci number", 62,

View File

@@ -3,7 +3,7 @@ import random
import math import math
def gen_func(maxEltAmt=20, format='string'): def gen_func(maxEltAmt=20):
s = 0 s = 0
v1 = [ v1 = [
round(random.uniform(0, 1000), 2) round(random.uniform(0, 1000), 2)
@@ -19,19 +19,14 @@ def gen_func(maxEltAmt=20, format='string'):
ans = 0 ans = 0
try: try:
ans = round(math.acos(s / mags), 2) ans = round(math.acos(s / mags), 2)
solution = str(ans) + " radians" solution = f"${ans}$ radians"
except ValueError: except ValueError:
print('angleBtwVectorsFunc has some issues with math module, line 16') print('angleBtwVectorsFunc has some issues with math module, line 16')
solution = 'NaN' solution = 'NaN'
ans = 'NaN' ans = 'NaN'
# would return the answer in radians # would return the answer in radians
if format == 'string': problem = f"angle between the vectors ${v1}$ and ${v2}$ is:"
problem = f"angle between the vectors {v1} and {v2} is:"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return v1, v2, ans
angle_btw_vectors = Generator("Angle between 2 vectors", 70, angle_btw_vectors = Generator("Angle between 2 vectors", 70,

View File

@@ -4,17 +4,12 @@ import random
def gen_func(minVal=3, maxVal=20, format='string'): def gen_func(minVal=3, maxVal=20, format='string'):
sideNum = random.randint(minVal, maxVal) sideNum = random.randint(minVal, maxVal)
problem = f"Find the angle of a regular polygon with {sideNum} sides" problem = f"Find the angle of a regular polygon with ${sideNum}$ sides"
exteriorAngle = round((360 / sideNum), 2) exteriorAngle = round((360 / sideNum), 2)
solution = 180 - exteriorAngle solution = f'${180 - exteriorAngle}$'
if format == 'string':
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return sideNum, solution
angle_regular_polygon = Generator("Angle of a Regular Polygon", 29, angle_regular_polygon = Generator("Angle of a Regular Polygon", 29,

View File

@@ -3,20 +3,15 @@ import random
import math import math
def gen_func(maxRadius=49, maxAngle=359, format='string'): def gen_func(maxRadius=49, maxAngle=359):
radius = random.randint(1, maxRadius) radius = random.randint(1, maxRadius)
angle = random.randint(1, maxAngle) angle = random.randint(1, maxAngle)
problem = f"Given radius, {radius} and angle, {angle}. Find the arc length of the angle."
angle_arc_length = float((angle / 360) * 2 * math.pi * radius) angle_arc_length = float((angle / 360) * 2 * math.pi * radius)
formatted_float = "{:.5f}".format(angle_arc_length) formatted_float = "{:.5f}".format(angle_arc_length)
if format == 'string': problem = f"Given radius, ${radius}$ and angle, ${angle}$. Find the arc length of the angle."
solution = f"Arc length of the angle = {formatted_float}" solution = f"Arc length of the angle $= {formatted_float}$"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return radius, angle, formatted_float
arc_length = Generator("Arc length of Angle", 108, gen_func, arc_length = Generator("Arc length of Angle", 108, gen_func,

View File

@@ -1,19 +1,14 @@
from ...generator import Generator from ...generator import Generator
import random import random
from math import pi
def gen_func(maxRadius=100, format='string'): def gen_func(maxRadius=100):
r = random.randint(0, maxRadius) r = random.randint(0, maxRadius)
pi = 22 / 7 area = round(pi * r * r, 2)
area = pi * r * r
if format == 'string': problem = f'Area of circle with radius ${r}=$'
problem = f"Area of circle with radius {r}" return problem, f'${area}$'
return problem, str(area)
elif format == 'latex':
return "Latex unavailable"
else:
return r, area
area_of_circle = Generator("Area of Circle", 112, gen_func, area_of_circle = Generator("Area of Circle", 112, gen_func,

View File

@@ -3,7 +3,7 @@ import random
from math import cos, sin, pi from math import cos, sin, pi
def gen_func(maxCoordinate=10, maxRadius=10, format='string'): def gen_func(maxCoordinate=10, maxRadius=10):
r = random.randint(0, maxRadius) r = random.randint(0, maxRadius)
center_x = random.randint(-maxCoordinate, maxCoordinate) center_x = random.randint(-maxCoordinate, maxCoordinate)
center_y = random.randint(-maxCoordinate, maxCoordinate) center_y = random.randint(-maxCoordinate, maxCoordinate)
@@ -15,13 +15,8 @@ def gen_func(maxCoordinate=10, maxRadius=10, format='string'):
area = round(pi * r * r, 2) area = round(pi * r * r, 2)
if format == 'string': problem = f"Area of circle with center $({center_x},{center_y})$ and passing through $({point_x}, {point_y})$ is"
problem = f"Area of circle with center ({center_x},{center_y}) and passing through ({point_x}, {point_y}) is" return problem, f'${area}$'
return problem, str(area)
elif format == 'latex':
return "Latex unavailable"
else:
return center_x, center_y, point_x, point_y, area
area_of_circle_given_center_and_point = Generator("Area of Circle given center and a point on circle", 115, gen_func, area_of_circle_given_center_and_point = Generator("Area of Circle given center and a point on circle", 115, gen_func,

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxA=20, maxB=20, format='string'): def gen_func(maxA=20, maxB=20):
a = random.randint(1, maxA) a = random.randint(1, maxA)
b = random.randint(1, maxB) b = random.randint(1, maxB)
c = random.randint(abs(b - a) + 1, abs(a + b) - 1) c = random.randint(abs(b - a) + 1, abs(a + b) - 1)
@@ -10,15 +10,9 @@ def gen_func(maxA=20, maxB=20, format='string'):
s = (a + b + c) / 2 s = (a + b + c) / 2
area = (s * (s - a) * (s - b) * (s - c))**0.5 area = (s * (s - a) * (s - b) * (s - c))**0.5
if format == 'string': problem = f"Area of triangle with side lengths: ${a}, {b} {c} = $"
problem = "Area of triangle with side lengths: " + \ solution = f'${round(area, 2)}$'
str(a) + " " + str(b) + " " + str(c) + " = "
solution = str(round(area, 2))
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c, area
area_of_triangle = Generator("Area of Triangle", 18, gen_func, area_of_triangle = Generator("Area of Triangle", 18, gen_func,

View File

@@ -5,33 +5,27 @@ import math
# Handles degrees in quadrant one # Handles degrees in quadrant one
def gen_func(angles=[0, 30, 45, 60, 90], def gen_func(angles=[0, 30, 45, 60, 90],
functions=["sin", "cos", "tan"], functions=["sin", "cos", "tan"]):
format='string'):
angle = random.choice(angles) angle = random.choice(angles)
function = random.choice(functions) function = random.choice(functions)
problem = f"What is {function}({angle})?" problem = f"$\\{function}({angle}) = $"
expression = 'math.' + function + '(math.radians(angle))' expression = 'math.' + function + '(math.radians(angle))'
result_fraction_map = { result_fraction_map = {
0.0: "0", 0.0: "0",
0.5: "1/2", 0.5: "\\frac{1}{2}",
0.71: "1/√2", 0.71: "\\frac{1}{\\sqrt{2}}",
0.87: "√3/2", 0.87: "\\frac{\\sqrt{3}}{2}",
1.0: "1", 1.0: "1",
0.58: "1/√3", 0.58: "\\frac{1}{\\sqrt{3}}",
1.73: "√3" 1.73: "\\sqrt{3}",
} }
solution = result_fraction_map[round(eval(expression), 2)] if round( solution = result_fraction_map[round(eval(expression), 2)] if round(
eval(expression), 2) <= 99999 else "" # for handling the ∞ condition eval(expression), 2) <= 99999 else "\\infty" # for handling the ∞ condition
if format == 'string': return problem, f'${solution}$'
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return function, angle, solution
basic_trigonometry = Generator( basic_trigonometry = Generator(

View File

@@ -3,17 +3,12 @@ import random
import math import math
def gen_func(maxRadius=100, format='string'): def gen_func(maxRadius=100):
r = random.randint(0, maxRadius) r = random.randint(0, maxRadius)
circumference = 2 * math.pi * r circumference = round(2 * math.pi * r, 2)
if format == 'string': problem = f"Circumference of circle with radius ${r} = $"
problem = f"Circumference of circle with radius {r}" return problem, f'${circumference}$'
return problem, circumference
elif format == 'latex':
return "Latex unavailable"
else:
return r, circumference
circumference = Generator("Circumference", 104, gen_func, circumference = Generator("Circumference", 104, gen_func,

View File

@@ -3,20 +3,15 @@ import random
import math import math
def gen_func(maxRadius=49, maxHeight=99, format='string'): def gen_func(maxRadius=49, maxHeight=99):
r = random.randint(1, maxRadius) r = random.randint(1, maxRadius)
h = random.randint(1, maxHeight) h = random.randint(1, maxHeight)
csa = float(2 * math.pi * r * h) csa = float(2 * math.pi * r * h)
formatted_float = round(csa, 2) # "{:.5f}".format(csa) formatted_float = round(csa, 2) # "{:.5f}".format(csa)
if format == 'string': problem = f"What is the curved surface area of a cylinder of radius, ${r}$ and height, ${h}$?"
problem = f"What is the curved surface area of a cylinder of radius, {r} and height, {h}?" solution = f"${formatted_float}$"
solution = f"CSA of cylinder = {formatted_float}"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return r, h, formatted_float
curved_surface_area_cylinder = Generator("Curved surface area of a cylinder", curved_surface_area_cylinder = Generator("Curved surface area of a cylinder",

View File

@@ -3,19 +3,14 @@ import random
import math import math
def gen_func(max_deg=360, format='string'): def gen_func(max_deg=360):
a = random.randint(0, max_deg) a = random.randint(0, max_deg)
b = (math.pi * a) / 180 b = (math.pi * a) / 180
b = round(b, 2) b = round(b, 2)
if format == 'string': problem = f"Angle ${a}$ degrees in radians is: "
problem = "Angle " + str(a) + " in radians is = " solution = f'${b}$'
solution = str(b)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b
degree_to_rad = Generator("Degrees to Radians", 86, gen_func, degree_to_rad = Generator("Degrees to Radians", 86, gen_func,

View File

@@ -3,13 +3,7 @@ import random
import math import math
def gen_func(maxCoordinate=20, minCoordinate=-20, format='string'): def gen_func(maxCoordinate=20, minCoordinate=-20):
def greatest_common_divisor(num1, num2):
if num2 == 0:
return num1
else:
return math.gcd(num2, num1 % num2)
x1 = random.randint(minCoordinate, maxCoordinate) x1 = random.randint(minCoordinate, maxCoordinate)
x2 = random.randint(minCoordinate, maxCoordinate) x2 = random.randint(minCoordinate, maxCoordinate)
@@ -49,8 +43,8 @@ def gen_func(maxCoordinate=20, minCoordinate=-20, format='string'):
coeff_y = '' coeff_y = ''
else: else:
coeff_y = '-' coeff_y = '-'
if format == 'string':
problem = f"What is the equation of the line between points ({x1},{y1}) and ({x2},{y2}) in slope-intercept form?" problem = f"What is the equation of the line between points $({x1},{y1})$ and $({x2},{y2})$ in slope-intercept form?"
if coeff_x == 0: if coeff_x == 0:
solution = str(coeff_y) + "y = " + str(constant) solution = str(coeff_y) + "y = " + str(constant)
elif coeff_y == 0: elif coeff_y == 0:
@@ -60,11 +54,7 @@ def gen_func(maxCoordinate=20, minCoordinate=-20, format='string'):
solution = str(coeff_y) + "y = " + str(coeff_x) + "x + " + str(constant) solution = str(coeff_y) + "y = " + str(coeff_x) + "x + " + str(constant)
else: else:
solution = str(coeff_y) + "y = " + str(coeff_x) + "x " + str(constant) solution = str(coeff_y) + "y = " + str(coeff_x) + "x " + str(constant)
return problem, solution return problem, f'${solution}$'
elif format == 'latex':
return 'Latex unavailable'
else:
return x1, x2, y1, y2, coeff_x, coeff_y, constant
equation_of_line_from_two_points = Generator( equation_of_line_from_two_points = Generator(

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxAngle=180, format='string'): def gen_func(maxAngle=180):
angle1 = random.randint(1, maxAngle) angle1 = random.randint(1, maxAngle)
angle2 = random.randint(1, 240 - angle1) angle2 = random.randint(1, 240 - angle1)
angle3 = random.randint(1, 340 - (angle1 + angle2)) angle3 = random.randint(1, 340 - (angle1 + angle2))
@@ -10,14 +10,9 @@ def gen_func(maxAngle=180, format='string'):
sum_ = angle1 + angle2 + angle3 sum_ = angle1 + angle2 + angle3
angle4 = 360 - sum_ angle4 = 360 - sum_
if format == 'string': problem = f"Fourth angle of quadrilateral with angles ${angle1} , {angle2}, {angle3} =$"
problem = f"Fourth angle of quadrilateral with angles {angle1} , {angle2}, {angle3} =" solution = f'${angle4}$'
solution = angle4
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return angle1, angle2, angle3, angle4
fourth_angle_of_quadrilateral = Generator("Fourth Angle of Quadrilateral", 49, fourth_angle_of_quadrilateral = Generator("Fourth Angle of Quadrilateral", 49,

View File

@@ -2,23 +2,14 @@ from ...generator import Generator
import random import random
def gen_func(maxSides=12, maxLength=120, format='string'): def gen_func(maxSides=12, maxLength=120):
size_of_sides = random.randint(3, maxSides) size_of_sides = random.randint(3, maxSides)
sides = [] sides = [random.randint(1, maxLength) for _ in range(size_of_sides)]
for x in range(size_of_sides):
sides.append(random.randint(1, maxLength))
problem = "The perimeter of a " + str(size_of_sides) + \
" sided polygon with lengths of " + str(sides) + "cm is: "
solution = 0
for y in range(len(sides)):
solution += sides[y]
if format == 'string': problem = f"The perimeter of a ${size_of_sides}$ sided polygon with lengths of ${', '.join(map(str, sides))}$cm is: "
return problem, solution solution = sum(sides)
elif format == 'latex':
return "Latex unavailable" return problem, f'${solution}$'
else:
return size_of_sides, sides, solution
perimeter_of_polygons = Generator("Perimeter of Polygons", 96, perimeter_of_polygons = Generator("Perimeter of Polygons", 96,

View File

@@ -2,19 +2,14 @@ from ...generator import Generator
import random import random
def gen_func(maxLength=20, format='string'): def gen_func(maxLength=20):
a = random.randint(1, maxLength) a = random.randint(1, maxLength)
b = random.randint(1, maxLength) b = random.randint(1, maxLength)
c = (a**2 + b**2)**0.5 c = round((a ** 2 + b ** 2) ** 0.5, 2)
if format == 'string': problem = f"What is the hypotenuse of a right triangle given the other two sides have lengths ${a}$ and ${b}$?"
problem = f"The hypotenuse of a right triangle given the other two lengths {a} and {b} = " solution = f"${c}$"
solution = f"{c:.0f}" if c.is_integer() else f"{c:.2f}"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, round(c, 2)
pythagorean_theorem = Generator("Pythagorean Theorem", 25, pythagorean_theorem = Generator("Pythagorean Theorem", 25,

View File

@@ -3,21 +3,14 @@ import random
import math import math
def gen_func(max_rad=3, format='string'): def gen_func(max_rad=6.28):
# max_rad is supposed to be pi but random can't handle non-integer a = random.randint(0, int(max_rad * 100)) / 100
a = random.randint(0, max_rad) b = round((180 * a) / math.pi, 2)
b = (180 * a) / math.pi
b = round(b, 2)
if format == 'string': problem = f"Angle ${a}$ radians in degrees is: "
problem = "Angle " + str(a) + " in degrees is = " solution = f'${b}$'
solution = str(b)
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b
radian_to_deg = Generator("Radians to Degrees", 87, gen_func, radian_to_deg = Generator("Radians to Degrees", 87, gen_func,
["max_rad=3"]) ["max_rad=6.28"])

View File

@@ -3,20 +3,15 @@ import random
import math import math
def gen_func(maxRadius=49, maxAngle=359, format='string'): def gen_func(maxRadius=49, maxAngle=359):
r = random.randint(1, maxRadius) r = random.randint(1, maxRadius)
a = random.randint(1, maxAngle) a = random.randint(1, maxAngle)
secArea = float((a / 360) * math.pi * r * r) secArea = float((a / 360) * math.pi * r * r)
formatted_float = "{:.5f}".format(secArea) formatted_float = round(secArea, 2)
if format == 'string': problem = f"What is the area of a sector with radius ${r}$ and angle ${a}$ degrees?"
problem = f"Given radius, {r} and angle, {a}. Find the area of the sector." solution = f"${formatted_float}$"
solution = f"Area of sector = {formatted_float}"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return r, a, formatted_float
sector_area = Generator("Area of a Sector", 75, gen_func, sector_area = Generator("Area of a Sector", 75, gen_func,

View File

@@ -2,17 +2,12 @@ from ...generator import Generator
import random import random
def gen_func(maxSides=12, format='string'): def gen_func(maxSides=12):
side_count = random.randint(3, maxSides) side_count = random.randint(3, maxSides)
sum = (side_count - 2) * 180 sum = (side_count - 2) * 180
if format == 'string': problem = f"What is the sum of interior angles of a polygon with ${side_count}$ sides?"
problem = f"Sum of angles of polygon with {side_count} sides = " return problem, f'${sum}$'
return problem, sum
elif format == 'latex':
return "Latex unavailable"
else:
return side_count, sum
sum_of_polygon_angles = Generator("Sum of Angles of Polygon", 58, sum_of_polygon_angles = Generator("Sum of Angles of Polygon", 58,

View File

@@ -3,21 +3,16 @@ import random
import math import math
def gen_func(maxRadius=20, maxHeight=50, unit='m', format='string'): def gen_func(maxRadius=20, maxHeight=50, unit='m'):
a = random.randint(1, maxHeight) a = random.randint(1, maxHeight)
b = random.randint(1, maxRadius) b = random.randint(1, maxRadius)
slopingHeight = math.sqrt(a**2 + b**2) slopingHeight = math.sqrt(a**2 + b**2)
ans = int(math.pi * b * slopingHeight + math.pi * b * b) ans = int(math.pi * b * slopingHeight + math.pi * b * b)
if format == 'string': problem = f"Surface area of cone with height $= {a}{unit}$ and radius $= {b}{unit}$ is"
problem = f"Surface area of cone with height = {a}{unit} and radius = {b}{unit} is" solution = f"${ans} {unit}^2$"
solution = f"{ans} {unit}^2"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, ans, unit
surface_area_cone = Generator("Surface Area of cone", 38, gen_func, surface_area_cone = Generator("Surface Area of cone", 38, gen_func,

View File

@@ -2,18 +2,13 @@ from ...generator import Generator
import random import random
def gen_func(maxSide=20, unit='m', format='string'): def gen_func(maxSide=20, unit='m'):
a = random.randint(1, maxSide) a = random.randint(1, maxSide)
ans = 6 * a * a ans = 6 * (a ** 2)
if format == 'string': problem = f"Surface area of cube with side $= {a}{unit}$ is"
problem = f"Surface area of cube with side = {a}{unit} is" solution = f"${ans} {unit}^2$"
solution = f"{ans} {unit}^2"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, ans, unit
surface_area_cube = Generator("Surface Area of Cube", 32, gen_func, surface_area_cube = Generator("Surface Area of Cube", 32, gen_func,

View File

@@ -2,20 +2,15 @@ from ...generator import Generator
import random import random
def gen_func(maxSide=20, unit='m', format='string'): def gen_func(maxSide=20, unit='m'):
a = random.randint(1, maxSide) a = random.randint(1, maxSide)
b = random.randint(1, maxSide) b = random.randint(1, maxSide)
c = random.randint(1, maxSide) c = random.randint(1, maxSide)
ans = 2 * (a * b + b * c + c * a) ans = 2 * (a * b + b * c + c * a)
if format == 'string': problem = f"Surface area of cuboid with sides of lengths: ${a}{unit}, {b}{unit}, {c}{unit}$ is"
problem = f"Surface area of cuboid with sides = {a}{unit}, {b}{unit}, {c}{unit} is" solution = f"${ans} {unit}^2$"
solution = f"{ans} {unit}^2"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c, ans, unit
surface_area_cuboid = Generator("Surface Area of Cuboid", 33, surface_area_cuboid = Generator("Surface Area of Cuboid", 33,

View File

@@ -3,19 +3,14 @@ import random
import math import math
def gen_func(maxRadius=20, maxHeight=50, unit='m', format='string'): def gen_func(maxRadius=20, maxHeight=50, unit='m'):
a = random.randint(1, maxHeight) a = random.randint(1, maxHeight)
b = random.randint(1, maxRadius) b = random.randint(1, maxRadius)
ans = int(2 * math.pi * a * b + 2 * math.pi * b * b) ans = int(2 * math.pi * a * b + 2 * math.pi * b * b)
if format == 'string': problem = f"Surface area of cylinder with height $= {a}{unit}$ and radius $= {b}{unit}$ is"
problem = f"Surface area of cylinder with height = {a}{unit} and radius = {b}{unit} is" solution = f"${ans} {unit}^2$"
solution = f"{ans} {unit}^2"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, ans, unit
surface_area_cylinder = Generator("Surface Area of Cylinder", 34, surface_area_cylinder = Generator("Surface Area of Cylinder", 34,

View File

@@ -14,7 +14,7 @@ _PYTHAGOREAN = [(3, 4, 5),
(7, 24, 25)] (7, 24, 25)]
def gen_func(unit='m', format='string'): def gen_func(unit='m'):
# Generate first triplet # Generate first triplet
height, half_width, triangle_height_1 = random.sample(random.choice(_PYTHAGOREAN), 3) height, half_width, triangle_height_1 = random.sample(random.choice(_PYTHAGOREAN), 3)
@@ -33,14 +33,9 @@ def gen_func(unit='m', format='string'):
ans = base + 2 * triangle_1 + 2 * triangle_2 ans = base + 2 * triangle_1 + 2 * triangle_2
if format == 'string': problem = f"Surface area of pyramid with base length $= {2*half_length}{unit}$, base width $= {2*half_width}{unit}$, and height $= {height}{unit}$ is"
problem = f"Surface area of pyramid with base length = {2*half_length}{unit}, base width = {2*half_width}{unit}, and height = {height}{unit}" solution = f"${ans} {unit}^2$"
solution = f"{ans} {unit}^2"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return 2 * half_length, 2 * half_width, height, ans, unit
surface_area_pyramid = Generator("Surface area of pyramid", 123, gen_func, surface_area_pyramid = Generator("Surface area of pyramid", 123, gen_func,

View File

@@ -3,18 +3,13 @@ import random
import math import math
def gen_func(maxSide=20, unit='m', format='string'): def gen_func(maxSide=20, unit='m'):
r = random.randint(1, maxSide) r = random.randint(1, maxSide)
ans = 4 * math.pi * r * r ans = 4 * math.pi * r * r
if format == 'string': problem = f"Surface area of Sphere with radius $= {r}{unit}$ is"
problem = f"Surface area of Sphere with radius = {r}{unit} is" solution = f"${ans} {unit}^2$"
solution = f"{ans} {unit}^2"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return r, ans, unit
surface_area_sphere = Generator("Surface Area of Sphere", 60, surface_area_sphere = Generator("Surface Area of Sphere", 60,

View File

@@ -2,18 +2,13 @@ from ...generator import Generator
import random import random
def gen_func(maxAngle=89, format='string'): def gen_func(maxAngle=89):
angle1 = random.randint(1, maxAngle) angle1 = random.randint(1, maxAngle)
angle2 = random.randint(1, maxAngle) angle2 = random.randint(1, maxAngle)
angle3 = 180 - (angle1 + angle2) angle3 = 180 - (angle1 + angle2)
if format == 'string': problem = f"Third angle of triangle with angles ${angle1}$ and ${angle2} = $"
problem = f"Third angle of triangle with angles {angle1} and {angle2} = " return problem, f'${angle3}$'
return problem, angle3
elif format == 'latex':
return "Latex unavailable"
else:
return angle1, angle2, angle3
third_angle_of_triangle = Generator("Third Angle of Triangle", 22, third_angle_of_triangle = Generator("Third Angle of Triangle", 22,

View File

@@ -2,7 +2,7 @@ from ...generator import Generator
import random import random
def gen_func(maxSideLength=50, format='string'): def gen_func(maxSideLength=50):
sideA = random.randint(1, maxSideLength) sideA = random.randint(1, maxSideLength)
sideB = random.randint(1, maxSideLength) sideB = random.randint(1, maxSideLength)
sideC = random.randint(1, maxSideLength) sideC = random.randint(1, maxSideLength)
@@ -13,17 +13,9 @@ def gen_func(maxSideLength=50, format='string'):
exists = True & (sides[0] < sideSums[0]) & (sides[1] < sideSums[1]) & ( exists = True & (sides[0] < sideSums[0]) & (sides[1] < sideSums[1]) & (
sides[2] < sideSums[2]) sides[2] < sideSums[2])
if format == 'string': problem = f"Does triangle with sides ${sideA}, {sideB}$ and ${sideC}$ exist?"
problem = f"Does triangle with sides {sideA}, {sideB} and {sideC} exist?" solution = "Yes" if exists else "No"
if exists: return problem, f'${solution}$'
solution = "Yes"
else:
solution = "No"
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return sideA, sideB, sideC, exists
valid_triangle = Generator("Triangle exists check", 19, gen_func, valid_triangle = Generator("Triangle exists check", 19, gen_func,

View File

@@ -3,19 +3,14 @@ import random
import math import math
def gen_func(maxRadius=20, maxHeight=50, unit='m', format='string'): def gen_func(maxRadius=20, maxHeight=50, unit='m'):
a = random.randint(1, maxHeight) a = random.randint(1, maxHeight)
b = random.randint(1, maxRadius) b = random.randint(1, maxRadius)
ans = int(math.pi * b * b * a * (1 / 3)) ans = int(math.pi * b * b * a * (1 / 3))
if format == 'string': problem = f"Volume of cone with height $= {a}{unit}$ and radius $= {b}{unit}$ is"
problem = f"Volume of cone with height = {a}{unit} and radius = {b}{unit} is" solution = f"${ans} {unit}^3$"
solution = f"{ans} {unit}^3"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, ans, unit
volume_cone = Generator("Volume of cone", 39, gen_func, volume_cone = Generator("Volume of cone", 39, gen_func,

View File

@@ -2,18 +2,13 @@ from ...generator import Generator
import random import random
def gen_func(maxSide=20, unit='m', format='string'): def gen_func(maxSide=20, unit='m'):
a = random.randint(1, maxSide) a = random.randint(1, maxSide)
ans = a**3 ans = a**3
if format == 'string': problem = f"Volume of cube with a side length of ${a}{unit}$ is"
problem = f"Volume of cube with side = {a}{unit} is" solution = f"${ans} {unit}^3$"
solution = f"{ans} {unit}^3"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, ans, unit
volume_cube = Generator("Volume of Cube", 35, gen_func, volume_cube = Generator("Volume of Cube", 35, gen_func,

View File

@@ -2,20 +2,15 @@ from ...generator import Generator
import random import random
def gen_func(maxSide=20, unit='m', format='string'): def gen_func(maxSide=20, unit='m'):
a = random.randint(1, maxSide) a = random.randint(1, maxSide)
b = random.randint(1, maxSide) b = random.randint(1, maxSide)
c = random.randint(1, maxSide) c = random.randint(1, maxSide)
ans = a * b * c ans = a * b * c
if format == 'string': problem = f"Volume of cuboid with sides = ${a}{unit}, {b}{unit}, {c}{unit}$ is"
problem = f"Volume of cuboid with sides = {a}{unit}, {b}{unit}, {c}{unit} is" solution = f"${ans} {unit}^3$"
solution = f"{ans} {unit}^3"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c, ans, unit
volume_cuboid = Generator("Volume of Cuboid", 36, gen_func, volume_cuboid = Generator("Volume of Cuboid", 36, gen_func,

View File

@@ -3,19 +3,14 @@ import random
import math import math
def gen_func(maxRadius=20, maxHeight=50, unit='m', format='string'): def gen_func(maxRadius=20, maxHeight=50, unit='m'):
a = random.randint(1, maxHeight) a = random.randint(1, maxHeight)
b = random.randint(1, maxRadius) b = random.randint(1, maxRadius)
ans = int(math.pi * b * b * a) ans = int(math.pi * b * b * a)
if format == 'string': problem = f"Volume of cylinder with height $= {a}{unit}$ and radius $= {b}{unit}$ is"
problem = f"Volume of cylinder with height = {a}{unit} and radius = {b}{unit} is" solution = f"${ans} {unit}^3$"
solution = f"{ans} {unit}^3"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, ans, unit
volume_cylinder = Generator("Volume of cylinder", 37, gen_func, volume_cylinder = Generator("Volume of cylinder", 37, gen_func,

View File

@@ -3,20 +3,15 @@ import random
import math import math
def gen_func(maxR1=20, maxR2=20, maxHeight=50, unit='m', format='string'): def gen_func(maxR1=20, maxR2=20, maxHeight=50, unit='m'):
h = random.randint(1, maxHeight) h = random.randint(1, maxHeight)
r1 = random.randint(1, maxR1) r1 = random.randint(1, maxR1)
r2 = random.randint(1, maxR2) r2 = random.randint(1, maxR2)
ans = ((math.pi * h) * (r1 ** 2 + r2 ** 2 + r1 * r2)) // 3 ans = ((math.pi * h) * (r1 ** 2 + r2 ** 2 + r1 * r2)) // 3
if format == 'string': problem = f"Volume of frustum with height $= {h}{unit}$ and $r1 = {r1}{unit}$ is and $r2 = {r1}{unit}$ is "
problem = f"Volume of frustum with height = {h}{unit} and r1 = {r1}{unit} is and r2 = {r1}{unit} is " solution = f"${ans} {unit}^3$"
solution = f"{ans} {unit}^3"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return r1, r2, h, ans, unit
volume_frustum = Generator("Volume of frustum", 113, gen_func, volume_frustum = Generator("Volume of frustum", 113, gen_func,

View File

@@ -3,18 +3,13 @@ import random
import math import math
def gen_func(maxRadius=100, format='string'): def gen_func(maxRadius=100):
r = random.randint(1, maxRadius) r = random.randint(1, maxRadius)
ans = round((2 * math.pi / 3) * r**3, 3) ans = round((2 * math.pi / 3) * r**3, 3)
if format == 'string': problem = f"Volume of hemisphere with radius ${r} m =$ "
problem = f"Volume of hemisphere with radius {r} m = " solution = f"${ans} m^3$"
solution = f"{ans} m^3"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return r, ans
volume_hemisphere = Generator("Volume of Hemisphere", 117, gen_func, volume_hemisphere = Generator("Volume of Hemisphere", 117, gen_func,

View File

@@ -2,21 +2,16 @@ from ...generator import Generator
import random import random
def gen_func(maxLength=20, maxWidth=20, maxHeight=50, unit='m', format='string'): def gen_func(maxLength=20, maxWidth=20, maxHeight=50, unit='m'):
length = random.randint(1, maxLength) length = random.randint(1, maxLength)
width = random.randint(1, maxWidth) width = random.randint(1, maxWidth)
height = random.randint(1, maxHeight) height = random.randint(1, maxHeight)
ans = (length * width * height) / 3 ans = (length * width * height) / 3
if format == 'string': problem = f"Volume of pyramid with base length $= {length} {unit}$, base width $= {width} {unit}$ and height $= {height} {unit}$ is"
problem = f"Volume of pyramid with base length = {length} {unit}, base width = {width} {unit} and height = {height} {unit} is" solution = f"${ans} {unit}^3$"
solution = f"{ans} {unit}^3"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return length, width, height, ans, unit
volume_pyramid = Generator("Volume of pyramid", 122, gen_func, volume_pyramid = Generator("Volume of pyramid", 122, gen_func,

View File

@@ -3,18 +3,13 @@ import random
import math import math
def gen_func(maxRadius=100, format='string'): def gen_func(maxRadius=100):
r = random.randint(1, maxRadius) r = random.randint(1, maxRadius)
ans = (4 * math.pi / 3) * r**3 ans = (4 * math.pi / 3) * r**3
if format == 'string': problem = f"Volume of sphere with radius ${r} m = $"
problem = f"Volume of sphere with radius {r} m = " solution = f"${ans} m^3$"
solution = f"{ans} m^3"
return problem, solution return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return r, ans
volume_sphere = Generator("Volume of Sphere", 61, gen_func, volume_sphere = Generator("Volume of Sphere", 61, gen_func,

View File

@@ -4,8 +4,7 @@ import random
def gen_func(maxd=100, def gen_func(maxd=100,
maxa=100, maxa=100,
maxn=100, maxn=100):
format='string'):
d = random.randint(-1 * maxd, maxd) d = random.randint(-1 * maxd, maxd)
a1 = random.randint(-1 * maxa, maxa) a1 = random.randint(-1 * maxa, maxa)
a2 = a1 + d a2 = a1 + d
@@ -15,14 +14,8 @@ def gen_func(maxd=100,
an = a1 + (n - 1) * d an = a1 + (n - 1) * d
solution = n * (a1 + an) / 2 solution = n * (a1 + an) / 2
if format == 'string': problem = f'Find the sum of first ${n}$ terms of the AP series: ${apString}$'
problem = 'Find the sum of first ' + \ return problem, f'${solution}$'
str(n) + ' terms of the AP series: ' + apString
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return n, apString, solution
arithmetic_progression_sum = Generator("AP Sum Calculation", 83, arithmetic_progression_sum = Generator("AP Sum Calculation", 83,

View File

@@ -4,8 +4,7 @@ import random
def gen_func(maxd=100, def gen_func(maxd=100,
maxa=100, maxa=100,
maxn=100, maxn=100):
format='string'):
d = random.randint(-1 * maxd, maxd) d = random.randint(-1 * maxd, maxd)
a1 = random.randint(-1 * maxa, maxa) a1 = random.randint(-1 * maxa, maxa)
a2 = a1 + d a2 = a1 + d
@@ -14,14 +13,8 @@ def gen_func(maxd=100,
apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... ' apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... '
solution = a1 + ((n - 1) * d) solution = a1 + ((n - 1) * d)
if format == 'string': problem = f'Find term number ${n}$ of the AP series: ${apString}$'
problem = 'Find the term number ' + str( return problem, f'${solution}$'
n) + ' of the AP series: ' + apString
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return n, apString, solution
arithmetic_progression_term = Generator("AP Term Calculation", 82, arithmetic_progression_term = Generator("AP Term Calculation", 82,

Some files were not shown because too many files have changed in this diff Show More