Merge branch 'master' into master

This commit is contained in:
Mo
2020-10-21 17:43:50 -04:00
committed by GitHub
35 changed files with 353 additions and 164 deletions

View File

@@ -1,5 +1,5 @@
# This workflows will upload a Python Package using Twine when a release is created # This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries # For more information see https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package name: Upload Python Package

View File

@@ -9,15 +9,26 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: '3.x' python-version: '3.x'
- name: Install dependencies
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: | run: |
python -m pip install -U pip pip install -r dev-requirements.txt
python -m pip install -r dev-requirements.txt
- name: Linter - name: Linter
run: make lint run: make lint
- name: Test - name: Test
run: make test run: make test

186
README.md
View File

@@ -31,93 +31,99 @@ problem, solution = mathgen.genById(0)
| Id | Skill | Example problem | Example Solution | Function Name | | Id | Skill | Example problem | Example Solution | Function Name |
|------|-----------------------------------|--------------------|-----------------------|--------------------------| |------|-----------------------------------|--------------------|-----------------------|--------------------------|
[//]: # list start [//]: # list start
| 0 | Addition | 29+29= | 58 | addition | | 0 | Addition | 48+19= | 67 | addition |
| 1 | Subtraction | 10-8= | 2 | subtraction | | 1 | Subtraction | 31-0= | 31 | subtraction |
| 2 | Multiplication | 96*0= | 0 | multiplication | | 2 | Multiplication | 44*1= | 44 | multiplication |
| 3 | Division | 25/95= | 0.2631578947368421 | division | | 3 | Division | 19/73= | 0.2602739726027397 | division |
| 4 | Binary Complement 1s | 100101100= | 011010011 | binary_complement_1s | | 4 | Binary Complement 1s | 001110110= | 110001001 | binary_complement_1s |
| 5 | Modulo Division | 74%50= | 24 | modulo_division | | 5 | Modulo Division | 99%80= | 19 | modulo_division |
| 6 | Square Root | sqrt(49)= | 7 | square_root | | 6 | Square Root | sqrt(144)= | 12 | square_root |
| 7 | Power Rule Differentiation | 10x^7 + 7x^5 + 5x^8 | 70x^6 + 35x^4 + 40x^7 | power_rule_differentiation | | 7 | Power Rule Differentiation | 7x^8 + 9x^3 | 56x^7 + 27x^2 | power_rule_differentiation |
| 8 | Square | 9^2= | 81 | square | | 8 | Square | 15^2= | 225 | square |
| 9 | LCM (Least Common Multiple) | LCM of 19 and 7 = | 133 | lcm | | 9 | LCM (Least Common Multiple) | LCM of 18 and 10 = | 90 | lcm |
| 10 | GCD (Greatest Common Denominator) | GCD of 1 and 7 = | 1 | gcd | | 10 | GCD (Greatest Common Denominator) | GCD of 9 and 8 = | 1 | gcd |
| 11 | Basic Algebra | 3x + 2 = 8 | 6 | basic_algebra | | 11 | Basic Algebra | 9x + 10 = 10 | 0 | basic_algebra |
| 12 | Logarithm | log2(128) | 7 | log | | 12 | Logarithm | log2(32) | 5 | log |
| 13 | Easy Division | 228/12 = | 19 | int_division | | 13 | Easy Division | 475/19 = | 25 | int_division |
| 14 | Decimal to Binary | Binary of 37= | 100101 | decimal_to_binary | | 14 | Decimal to Binary | Binary of 97= | 1100001 | decimal_to_binary |
| 15 | Binary to Decimal | 10100001 | 161 | binary_to_decimal | | 15 | Binary to Decimal | 0110 | 6 | binary_to_decimal |
| 16 | Fraction Division | (8/2)/(8/2) | 1 | divide_fractions | | 16 | Fraction Division | (3/6)/(7/1) | 1/14 | divide_fractions |
| 17 | Integer Multiplication with 2x2 Matrix | 6 * [[3, 7], [10, 6]] = | [[18,42],[60,36]] | multiply_int_to_22_matrix | | 17 | Integer Multiplication with 2x2 Matrix | 12 * [[2, 6], [3, 3]] = | [[24,72],[36,36]] | multiply_int_to_22_matrix |
| 18 | Area of Triangle | Area of triangle with side lengths: 2 1 19 = | (5.449334243437888e-15+88.99438184514796j) | area_of_triangle | | 18 | Area of Triangle | Area of triangle with side lengths: 12 2 2 = | (2.0782945349651837e-15+33.94112549695428j) | area_of_triangle |
| 19 | Triangle exists check | Does triangle with sides 48, 16 and 30 exist? | No | valid_triangle | | 19 | Triangle exists check | Does triangle with sides 40, 5 and 39 exist? | Yes | valid_triangle |
| 20 | Midpoint of the two point | (2,-5),(12,-7)= | (7.0,-6.0) | midpoint_of_two_points | | 20 | Midpoint of the two point | (-14,11),(-2,9)= | (-8.0,10.0) | midpoint_of_two_points |
| 21 | Factoring Quadratic | x^2-18x+81 | (x-9)(x-9) | factoring | | 21 | Factoring Quadratic | x^2-5x-14 | (x+2)(x-7) | factoring |
| 22 | Third Angle of Triangle | Third angle of triangle with angles 45 and 1 = | 134 | third_angle_of_triangle | | 22 | Third Angle of Triangle | Third angle of triangle with angles 27 and 88 = | 65 | third_angle_of_triangle |
| 23 | Solve a System of Equations in R^2 | -7x - 10y = -133, 7x - 2y = 49 | x = 9, y = 7 | system_of_equations | | 23 | Solve a System of Equations in R^2 | -7x - 7y = -14, -7x - 8y = -18 | x = -2, y = 4 | system_of_equations |
| 24 | Distance between 2 points | Find the distance between (-10, 7) and (16, 6) | sqrt(677) | distance_two_points | | 24 | Distance between 2 points | Find the distance between (5, 9) and (5, 8) | sqrt(1) | distance_two_points |
| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 10 and 8 = | 12.81 | pythagorean_theorem | | 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 13 and 17 = | 21.40 | pythagorean_theorem |
| 26 | Linear Equations | 18x + -2y = -174, -13x + 6y = 194 | x = -8, y = 15 | linear_equations | | 26 | Linear Equations | 2x + -1y = -19, -14x + -9y = 149 | x = -10, y = -1 | linear_equations |
| 27 | Prime Factorisation | Find prime factors of 16 | [2, 2, 2, 2] | prime_factors | | 27 | Prime Factorisation | Find prime factors of 8 | [2, 2, 2] | prime_factors |
| 28 | Fraction Multiplication | (6/8)*(2/5) | 3/10 | fraction_multiplication | | 28 | Fraction Multiplication | (3/1)*(2/10) | 3/5 | fraction_multiplication |
| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 17 sides | 158.82 | angle_regular_polygon | | 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 20 sides | 162.0 | angle_regular_polygon |
| 30 | Combinations of Objects | Number of combinations from 17 objects picked 3 at a time | 680 | combinations | | 30 | Combinations of Objects | Number of combinations from 16 objects picked 5 at a time | 4368 | combinations |
| 31 | Factorial | 1! = | 1 | factorial | | 31 | Factorial | 0! = | 1 | factorial |
| 32 | Surface Area of Cube | Surface area of cube with side = 17m is | 1734 m^2 | surface_area_cube | | 32 | Surface Area of Cube | Surface area of cube with side = 4m is | 96 m^2 | surface_area_cube |
| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 12m, 11m, 1m is | 310 m^2 | surface_area_cuboid | | 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 19m, 10m, 16m is | 1308 m^2 | surface_area_cuboid |
| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 38m and radius = 16m is | 5428 m^2 | surface_area_cylinder | | 34 | Surface Area of Cylinder | Surface area of cylinder with height = 32m and radius = 5m is | 1162 m^2 | surface_area_cylinder |
| 35 | Volum of Cube | Volume of cube with side = 11m is | 1331 m^3 | volume_cube | | 35 | Volum of Cube | Volume of cube with side = 20m is | 8000 m^3 | volume_cube |
| 36 | Volume of Cuboid | Volume of cuboid with sides = 17m, 19m, 8m is | 2584 m^3 | volume_cuboid | | 36 | Volume of Cuboid | Volume of cuboid with sides = 11m, 17m, 1m is | 187 m^3 | volume_cuboid |
| 37 | Volume of cylinder | Volume of cylinder with height = 35m and radius = 19m is | 39694 m^3 | volume_cylinder | | 37 | Volume of cylinder | Volume of cylinder with height = 16m and radius = 17m is | 14526 m^3 | volume_cylinder |
| 38 | Surface Area of cone | Surface area of cone with height = 8m and radius = 19m is | 2364 m^2 | surface_area_cone | | 38 | Surface Area of cone | Surface area of cone with height = 36m and radius = 1m is | 116 m^2 | surface_area_cone |
| 39 | Volume of cone | Volume of cone with height = 43m and radius = 13m is | 7609 m^3 | volume_cone | | 39 | Volume of cone | Volume of cone with height = 17m and radius = 17m is | 5144 m^3 | volume_cone |
| 40 | Common Factors | Common Factors of 21 and 65 = | [1] | common_factors | | 40 | Common Factors | Common Factors of 80 and 59 = | [1] | common_factors |
| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 5/4x - 1 and y = 0/4x - 5 | (-16/5, -5) | intersection_of_two_lines | | 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 10/6x + 6 and y = 5x + 7 | (-3/10, 11/2) | intersection_of_two_lines |
| 42 | Permutations | Number of Permutations from 10 objects picked 5 at a time = | 30240 | permutation | | 42 | Permutations | Number of Permutations from 15 objects picked 1 at a time = | 15 | permutation |
| 43 | Cross Product of 2 Vectors | [12, -16, 4] X [-14, 10, -9] = | [104, 52, -104] | vector_cross | | 43 | Cross Product of 2 Vectors | [16, -8, 0] X [11, -6, -13] = | [104, 208, -8] | vector_cross |
| 44 | Compare Fractions | Which symbol represents the comparison between 7/10 and 7/5? | < | compare_fractions | | 44 | Compare Fractions | Which symbol represents the comparison between 4/6 and 7/9? | < | compare_fractions |
| 45 | Simple Interest | Simple interest for a principle amount of 6138 dollars, 9% rate of interest and for a time period of 8 years is = | 4419.36 | simple_interest | | 45 | Simple Interest | Simple interest for a principle amount of 1857 dollars, 8% rate of interest and for a time period of 7 years is = | 1039.92 | simple_interest |
| 46 | Multiplication of two matrices | Multiply<table><tr><td>-8</td><td>-8</td></tr><tr><td>-2</td><td>-9</td></tr></table>and<table><tr><td>-10</td><td>-8</td></tr><tr><td>9</td><td>-9</td></tr></table> | <table><tr><td>8</td><td>136</td></tr><tr><td>-61</td><td>97</td></tr></table> | matrix_multiplication | | 46 | Multiplication of two matrices | Multiply<table><tr><td>5</td><td>-3</td><td>0</td><td>3</td></tr><tr><td>-6</td><td>-6</td><td>-9</td><td>8</td></tr><tr><td>-4</td><td>-2</td><td>-8</td><td>-2</td></tr></table>and<table><tr><td>-10</td><td>-10</td><td>-2</td><td>10</td></tr><tr><td>-6</td><td>-9</td><td>-5</td><td>-9</td></tr><tr><td>2</td><td>7</td><td>-8</td><td>-8</td></tr><tr><td>-2</td><td>6</td><td>10</td><td>0</td></tr></table> | <table><tr><td>-38</td><td>-5</td><td>35</td><td>77</td></tr><tr><td>62</td><td>99</td><td>194</td><td>66</td></tr><tr><td>40</td><td>-10</td><td>62</td><td>42</td></tr></table> | matrix_multiplication |
| 47 | Cube Root | cuberoot of 633 upto 2 decimal places is: | 8.59 | cube_root | | 47 | Cube Root | cuberoot of 616 upto 2 decimal places is: | 8.51 | cube_root |
| 48 | Power Rule Integration | 2x^5 + 3x^3 + 4x^7 + 9x^1 + 6x^9 | (2/5)x^6 + (3/3)x^4 + (4/7)x^8 + (9/1)x^2 + (6/9)x^10 + c | power_rule_integration | | 48 | Power Rule Integration | 4x^1 | (4/1)x^2 + c | power_rule_integration |
| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 79 , 44, 37 = | 200 | fourth_angle_of_quadrilateral | | 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 72 , 42, 103 = | 143 | fourth_angle_of_quadrilateral |
| 50 | Quadratic Equation | Zeros of the Quadratic Equation 79x^2+182x+98=0 | [-0.86, -1.45] | quadratic_equation | | 50 | Quadratic Equation | Zeros of the Quadratic Equation 88x^2+181x+68=0 | [-0.49, -1.56] | quadratic_equation |
| 51 | HCF (Highest Common Factor) | HCF of 1 and 20 = | 1 | hcf | | 51 | HCF (Highest Common Factor) | HCF of 2 and 1 = | 1 | hcf |
| 52 | Probability of a certain sum appearing on faces of dice | If 1 dice are rolled at the same time, the probability of getting a sum of 2 = | 1/6 | dice_sum_probability | | 52 | Probability of a certain sum appearing on faces of dice | If 3 dice are rolled at the same time, the probability of getting a sum of 16 = | 6/216 | dice_sum_probability |
| 53 | Exponentiation | 6^9 = | 10077696 | exponentiation | | 53 | Exponentiation | 17^10 = | 2015993900449 | exponentiation |
| 54 | Confidence interval For sample S | The confidence interval for sample [260, 249, 281, 261, 236, 237, 275, 229, 256, 242, 277, 240, 278, 293, 271, 255, 216, 292, 200, 298, 282, 223] with 99% confidence is | (271.2437114485249, 242.48356127874783) | confidence_interval | | 54 | Confidence interval For sample S | The confidence interval for sample [289, 211, 294, 290, 264, 258, 229, 265, 272, 228, 257, 262, 210, 259, 246, 224, 266, 283, 273, 222, 250, 241, 225, 237] with 99% confidence is | (265.1917573633045, 239.39157597002884) | confidence_interval |
| 55 | Comparing surds | Fill in the blanks 71^(1/5) _ 31^(1/8) | > | surds_comparison | | 55 | Comparing surds | Fill in the blanks 81^(1/7) _ 54^(1/9) | > | surds_comparison |
| 56 | Fibonacci Series | The Fibonacci Series of the first 19 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584] | fibonacci_series | | 56 | Fibonacci Series | The Fibonacci Series of the first 20 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181] | fibonacci_series |
| 57 | Trigonometric Values | What is cos(45)? | 1/√2 | basic_trigonometry | | 57 | Trigonometric Values | What is cos(90)? | 0 | basic_trigonometry |
| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 10 sides = | 1440 | sum_of_polygon_angles | | 58 | Sum of Angles of Polygon | Sum of angles of polygon with 9 sides = | 1260 | sum_of_polygon_angles |
| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[13, 22, 36, 17, 9, 39, 50, 14, 32, 40, 37, 48, 47, 28, 47] | The Mean is 31.933333333333334 , Standard Deviation is 182.59555555555553, Variance is 13.51279229306643 | data_summary | | 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[43, 23, 43, 13, 16, 40, 36, 19, 17, 39, 45, 26, 12, 17, 12] | The Mean is 26.733333333333334 , Standard Deviation is 151.79555555555555, Variance is 12.3205338989654 | data_summary |
| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 18m is | 4071.5040790523717 m^2 | surface_area_sphere | | 60 | Surface Area of Sphere | Surface area of Sphere with radius = 10m is | 1256.6370614359173 m^2 | surface_area_sphere |
| 61 | Volume of Sphere | Volume of sphere with radius 61 m = | 950775.7894726198 m^3 | volume_sphere | | 61 | Volume of Sphere | Volume of sphere with radius 93 m = | 3369282.722751367 m^3 | volume_sphere |
| 62 | nth Fibonacci number | What is the 85th Fibonacci number? | 259695496911123328 | nth_fibonacci_number | | 62 | nth Fibonacci number | What is the 52th Fibonacci number? | 32951280099 | nth_fibonacci_number |
| 63 | Profit or Loss Percent | Profit percent when CP = 353 and SP = 752 is: | 113.03116147308782 | profit_loss_percent | | 63 | Profit or Loss Percent | Loss percent when CP = 798 and SP = 713 is: | 10.651629072681704 | profit_loss_percent |
| 64 | Binary to Hexidecimal | 111101011 | 0x1eb | binary_to_hex | | 64 | Binary to Hexidecimal | 0000 | 0x0 | binary_to_hex |
| 65 | Multiplication of 2 complex numbers | (-19-9j) * (-17-2j) = | (305+191j) | multiply_complex_numbers | | 65 | Multiplication of 2 complex numbers | (14-1j) * (-15+4j) = | (-206+71j) | multiply_complex_numbers |
| 66 | Geometric Progression | For the given GP [7, 77, 847, 9317, 102487, 1127357] ,Find the value of a,common ratio,6th term value, sum upto 7th term | The value of a is 7, common ratio is 11 , 6th term is 1127357 , sum upto 7th term is 13641019.0 | geometric_progression | | 66 | Geometric Progression | For the given GP [8, 24, 72, 216, 648, 1944] ,Find the value of a,common ratio,11th term value, sum upto 8th term | The value of a is 8, common ratio is 3 , 11th term is 472392 , sum upto 8th term is 26240.0 | geometric_progression |
| 67 | Geometric Mean of N Numbers | Geometric mean of 3 numbers 32 , 5 and 18 = | (32*5*18)^(1/3) = 14.227573217960249 | geometric_mean | | 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 65 , 75 , 65 , 23 = | (65*75*65*23)^(1/4) = 51.95818275737109 | geometric_mean |
| 68 | Harmonic Mean of N Numbers | Harmonic mean of 3 numbers 48 , 85 and 79 = | 3/((1/48) + (1/85) + (1/79)) = 66.28916158223076 | harmonic_mean | | 68 | Harmonic Mean of N Numbers | Harmonic mean of 2 numbers 2 and 12 = | 2/((1/2) + (1/12)) = 3.4285714285714284 | harmonic_mean |
| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[743.1109024649227, 951.2861991520674, 821.2679183199273, 831.5922742303677, 972.3005129207023, 775.1712986008336, 869.5254070360901, 34.05779748860371, 495.5299489221041, 516.2458991121815, 620.0871728488738, 12.438787805084894, 967.8138977993306, 627.6791615554401, 129.81896901435886, 566.4442009627315, 521.5300881726977, 741.5947979192599] is: | 2917.827115551868 | euclidian_norm | | 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[488.10260237588165, 438.9926997215375, 481.4248776631771, 480.58824363943177, 509.73053046857785, 268.09288505668803, 410.3732502610836, 318.6216647891933, 296.4238196042428, 808.0996438115192, 121.7211186065138, 615.1986904309553, 380.29841107431093, 195.23491823519456, 81.69943837555405, 155.69629311805645, 97.46954246782546, 634.0953876946306, 199.72352388042535, 568.2278203619796] is: | 1901.9741243296269 | euclidian_norm |
| 70 | Angle between 2 vectors | angle between the vectors [341.1766244080324, 386.90517658729595, 306.3074773969527, 542.1138441520038, 149.80203485453225, 85.6719016065689, 875.0827941729921, 292.0422074695527, 312.8929536855103, 408.95388654647445, 119.81564007869672, 177.5529661884936, 360.30983184002406, 111.71502530193955, 29.528755078141455, 478.2846569662712, 855.8978282979257] and [230.45166329807688, 922.2895458023412, 219.89492715268733, 375.8793126730714, 731.2614314505195, 277.5554009411926, 329.1490487358273, 477.7600322879586, 168.93745868538923, 423.6897582803929, 724.5555882496458, 519.6421532094823, 158.0479000313908, 679.3674240323584, 496.6795371750926, 853.4421897526636, 715.2567898992207] is: | NaN | angle_btw_vectors | | 70 | Angle between 2 vectors | angle between the vectors [955.8351549798066, 177.1594811522551, 900.6055058476991, 712.0208070601419, 601.3956854892953, 628.8267644026017, 893.2727217464875, 492.4340309181726] and [668.7008663033757, 138.7169080640255, 515.5875138676224, 230.03917249114247, 51.099523634880015, 894.1460097286858, 313.47733623460283, 837.2412043583688] is: | NaN | angle_btw_vectors |
| 71 | Absolute difference between two numbers | Absolute difference between numbers 53 and -70 = | 123 | absolute_difference | | 71 | Absolute difference between two numbers | Absolute difference between numbers -63 and 84 = | 147 | absolute_difference |
| 72 | Dot Product of 2 Vectors | [-8, -4, -10] . [-9, -6, -9] = | 186 | vector_dot | | 72 | Dot Product of 2 Vectors | [7, -9, 12] . [6, 12, 14] = | 102 | vector_dot |
| 73 | Binary 2's Complement | 2's complement of = | | binary_2s_complement | | 73 | Binary 2's Complement | 2's complement of 11101 = | 11 | binary_2s_complement |
| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[43, 95, 41], [46, 80, 67], [57, 75, 71]]) is: | Matrix([[131/7038, -367/3519, 617/7038], [553/35190, 358/17595, -199/7038], [-37/1173, 73/1173, -31/1173]]) | invert_matrix | | 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[61, 90, 56], [2, 74, 38], [29, 91, 7]]) is: | Matrix([[735/47851, -2233/95702, 181/47851], [-272/47851, 1197/191404, 1103/95702], [491/47851, 2941/191404, -2167/95702]]) | invert_matrix |
| 75 | Area of a Sector | Given radius, 40 and angle, 199. Find the area of the sector. | Area of sector = 2778.56417 | sector_area | | 75 | Area of a Sector | Given radius, 17 and angle, 98. Find the area of the sector. | Area of sector = 247.15608 | sector_area |
| 76 | Mean and Median | Given the series of numbers [44, 64, 22, 37, 63, 56, 27, 62, 98, 72]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 54.5 and Arithmetic median of this series is 59.0 | mean_median | | 76 | Mean and Median | Given the series of numbers [13, 89, 68, 53, 61, 3, 17, 66, 63, 48]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 48.1 and Arithmetic median of this series is 57.0 | mean_median |
| 77 | Determinant to 2x2 Matrix | Det([[73, 52], [55, 80]]) = | 2980 | int_matrix_22_determinant | | 77 | Determinant to 2x2 Matrix | Det([[49, 6], [62, 19]]) = | 559 | int_matrix_22_determinant |
| 78 | Compound Interest | Compound Interest for a principle amount of 8506 dollars, 8% rate of interest and for a time period of 10 compounded monthly is = | 8506.0 | compound_interest | | 78 | Compound Interest | Compound interest for a principle amount of 7750 dollars, 9% rate of interest and for a time period of 7 year is = | 14167.3 | compound_interest |
| 79 | Decimal to Hexadecimal | Binary of 293= | 0x125 | decimal_to_hexadeci | | 79 | Decimal to Hexadecimal | Binary of 972= | 0x3cc | decimal_to_hexadeci |
| 80 | Percentage of a number | What is 57% of 4? | Required percentage = 2.28% | percentage | | 80 | Percentage of a number | What is 38% of 82? | Required percentage = 31.16% | percentage |
| 81 | Celsius To Fahrenheit | Convert 57 degrees Celsius to degrees Fahrenheit = | 134.60000000000002 | celsius_to_fahrenheit | | 81 | Celsius To Fahrenheit | Convert -49 degrees Celsius to degrees Fahrenheit = | -56.2 | celsius_to_fahrenheit |
| 82 | AP Term Calculation | Find the term number 89 of the AP series: 20, 115, 210 ... | 8380 | arithmetic_progression_term | | 82 | AP Term Calculation | Find the term number 83 of the AP series: -41, -110, -179 ... | -5699 | arithmetic_progression_term |
| 83 | AP Sum Calculation | Find the sum of first 98 terms of the AP series: -58, -106, -154 ... | -233828.0 | arithmetic_progression_sum | | 83 | AP Sum Calculation | Find the sum of first 99 terms of the AP series: 20, -59, -138 ... | -381249.0 | arithmetic_progression_sum |
| 84 | Converts decimal to octal | The decimal number 1716 in Octal is: | 0o3264 | decimal_to_octal | | 84 | Converts decimal to octal | The decimal number 1424 in Octal is: | 0o2620 | decimal_to_octal |
| 85 | Converts decimal to Roman Numerals | The number 587 in Roman Numerals is: | DLXXXVII | decimal_to_roman_numerals | | 85 | Converts decimal to Roman Numerals | The number 3563 in Roman Numerals is: | MMMDLXIII | decimal_to_roman_numerals |
| 86 | Degrees to Radians | Angle 245 in radians is = | 4.28 | degree_to_rad | | 86 | Degrees to Radians | Angle 286 in radians is = | 4.99 | degree_to_rad |
| 87 | Radians to Degrees | Angle 0 in degrees is = | 0.0 | radian_to_deg | | 87 | Radians to Degrees | Angle 2 in degrees is = | 114.59 | radian_to_deg |
| 88 | Differentiation | differentiate w.r.t x : d(exp(x)+5*x^(-2))/dx | exp(x) - 10/x^3 | differentiation | | 88 | Differentiation | differentiate w.r.t x : d(exp(x)+6*x^(-3))/dx | exp(x) - 18/x^4 | differentiation |
| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 39x^2 + 72x + 74 is = | 123.0 | definite_integral | | 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 94x^2 + 86x + 97 is = | 171.3333 | definite_integral |
| 90 | isprime | 28 | False | is_prime |
| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 9 is = | 37408 | bcd_to_decimal |
| 92 | Complex To Polar Form | rexp(itheta) = | 15.65exp(i-2.68) | complex_to_polar |
| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={2, 3, 5} ,b={2, 3, 6, 7}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {2, 3, 5, 6, 7},Intersection is {2, 3}, a-b is {5},b-a is {6, 7}, Symmetric difference is {5, 6, 7} | set_operation |
| 94 | Base Conversion | Convert E656 from base 16 to base 12. | 2A15A | base_conversion |
| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 43 and height, 85? | CSA of cylinder = 22965.04 | curved_surface_area_cylinder |

View File

@@ -11,7 +11,8 @@ class Generator:
self.generalSol = generalSol self.generalSol = generalSol
self.func = func self.func = func
(filename, line_number, function_name, text) = traceback.extract_stack()[-2] (filename, line_number, function_name,
text) = traceback.extract_stack()[-2]
funcname = filename[filename.rfind('/'):].strip() funcname = filename[filename.rfind('/'):].strip()
funcname = funcname[1:-3] funcname = funcname[1:-3]
# print(funcname) # print(funcname)

View File

@@ -96,3 +96,8 @@ from .differentiation import *
from .definite_integral import * from .definite_integral import *
from .is_prime import * from .is_prime import *
from .perimeter_of_polygons import * from .perimeter_of_polygons import *
from .bcd_to_decimal import *
from .complex_to_polar import *
from .set_operation import *
from .base_conversion import *
from .curved_surface_area_cylinder import *

View File

@@ -10,7 +10,8 @@ def angleBtwVectorsFunc(maxEltAmt=20):
for j in v2: for j in v2:
s += i * j s += i * j
mags = math.sqrt(sum([i**2 for i in v1])) * math.sqrt(sum([i**2 for i in v2])) mags = math.sqrt(sum([i**2
for i in v1])) * math.sqrt(sum([i**2 for i in v2]))
problem = f"angle between the vectors {v1} and {v2} is:" problem = f"angle between the vectors {v1} and {v2} is:"
solution = '' solution = ''
try: try:

View File

@@ -8,11 +8,13 @@ def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100):
a3 = a2 + d a3 = a2 + d
n = random.randint(4, maxn) n = random.randint(4, maxn)
apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... ' apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... '
problem = 'Find the sum of first ' + str(n) + ' terms of the AP series: ' + apString problem = 'Find the sum of first ' + str(
n) + ' terms of the AP series: ' + apString
solution = n * ((2 * a1) + ((n - 1) * d)) / 2 solution = n * ((2 * a1) + ((n - 1) * d)) / 2
return problem, solution return problem, solution
arithmetic_progression_sum = Generator("AP Sum Calculation", 83, arithmetic_progression_sum = Generator(
"Find the sum of first n terms of the AP series: a1, a2, a3 ...", "AP Sum Calculation", 83,
"Sum", arithmeticProgressionSumFunc) "Find the sum of first n terms of the AP series: a1, a2, a3 ...", "Sum",
arithmeticProgressionSumFunc)

View File

@@ -8,11 +8,13 @@ def arithmeticProgressionTermFunc(maxd=100, maxa=100, maxn=100):
a3 = a2 + d a3 = a2 + d
n = random.randint(4, maxn) n = random.randint(4, maxn)
apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... ' apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... '
problem = 'Find the term number ' + str(n) + ' of the AP series: ' + apString problem = 'Find the term number ' + str(
n) + ' of the AP series: ' + apString
solution = a1 + ((n - 1) * d) solution = a1 + ((n - 1) * d)
return problem, solution return problem, solution
arithmetic_progression_term = Generator("AP Term Calculation", 82, arithmetic_progression_term = Generator(
"Find the term number n of the AP series: a1, a2, a3 ...", "AP Term Calculation", 82,
"a-n", arithmeticProgressionTermFunc) "Find the term number n of the AP series: a1, a2, a3 ...", "a-n",
arithmeticProgressionTermFunc)

View File

@@ -0,0 +1,58 @@
from .__init__ import *
# base from 2 to 36
alpha = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def fromBaseTenTo(n, toBase):
assert type(
toBase
) == int and toBase >= 2 and toBase <= 36, "toBase({}) must be >=2 and <=36"
# trivial cases
if toBase == 2:
return bin(n)[2:]
elif toBase == 8:
return oct(n)[2:]
elif toBase == 10:
return str(n)
elif toBase == 16:
return hex(n)[2:].upper()
res = alpha[n % toBase]
n = n // toBase
while n > 0:
res = alpha[n % toBase] + res
n = n // toBase
return res
# Useful to check answers, but not needed here
# def toBaseTen(n,fromBase):
# return int(n,fromBase)
def baseConversionFunc(maxNum=60000, maxBase=16):
assert type(
maxNum
) == int and maxNum >= 100 and maxNum <= 65536, "maxNum({}) must be >=100 and <=65536".format(
maxNum)
assert type(
maxBase
) == int and maxBase >= 2 and maxBase <= 36, "maxBase({}) must be >= 2 and <=36".format(
maxBase)
n = random.randint(40, maxNum)
dist = [10] * 10 + [2] * 5 + [16] * 5 + [i for i in range(2, maxBase + 1)]
# set this way since converting to/from bases 2,10,16 are more common -- can be changed if needed.
bases = random.choices(dist, k=2)
while bases[0] == bases[1]:
bases = random.choices(dist, k=2)
problem = "Convert {} from base {} to base {}.".format(
fromBaseTenTo(n, bases[0]), bases[0], bases[1])
ans = fromBaseTenTo(n, bases[1])
return problem, ans
base_conversion = Generator("Base Conversion", 94,
"Convert 152346 from base 8 to base 10.", "54502",
baseConversionFunc)

View File

@@ -0,0 +1,25 @@
from .__init__ import *
def BCDtoDecimalFunc(maxNumber=10000):
n = random.randint(1000, maxNumber)
binstring = ''
while True:
q, r = divmod(n, 10)
nibble = bin(r).replace('0b', "")
while len(nibble) < 4:
nibble = '0' + nibble
binstring = nibble + binstring
if q == 0:
break
else:
n = q
problem = "Integer of Binary Coded Decimal " + str(n) + " is = "
solution = int(binstring, 2)
return problem, solution
bcd_to_decimal = Generator("Binary Coded Decimal to Integer", 91,
"Integer of Binary Coded Decimal b is ", "n",
BCDtoDecimalFunc)

View File

@@ -11,5 +11,5 @@ def binaryToHexFunc(max_dig=10):
return problem, solution return problem, solution
binary_to_hex = Generator("Binary to Hexidecimal", 64, "Hexidecimal of a=", "b", binary_to_hex = Generator("Binary to Hexidecimal", 64, "Hexidecimal of a=",
binaryToHexFunc) "b", binaryToHexFunc)

View File

@@ -4,10 +4,12 @@ from .__init__ import *
def celsiustofahrenheitFunc(maxTemp=100): def celsiustofahrenheitFunc(maxTemp=100):
celsius = random.randint(-50, maxTemp) celsius = random.randint(-50, maxTemp)
fahrenheit = (celsius * (9 / 5)) + 32 fahrenheit = (celsius * (9 / 5)) + 32
problem = "Convert " + str(celsius) + " degrees Celsius to degrees Fahrenheit =" problem = "Convert " + str(
celsius) + " degrees Celsius to degrees Fahrenheit ="
solution = str(fahrenheit) solution = str(fahrenheit)
return problem, solution return problem, solution
celsius_to_fahrenheit = Generator("Celsius To Fahrenheit", 81, celsius_to_fahrenheit = Generator("Celsius To Fahrenheit", 81,
"(C +(9/5))+32=", "F", celsiustofahrenheitFunc) "(C +(9/5))+32=", "F",
celsiustofahrenheitFunc)

View File

@@ -0,0 +1,18 @@
from .__init__ import *
def complexToPolarFunc(minRealImaginaryNum=-20, maxRealImaginaryNum=20):
num = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum),
random.randint(minRealImaginaryNum, maxRealImaginaryNum))
a = num.real
b = num.imag
r = round(math.hypot(a, b), 2)
theta = round(math.atan2(b, a), 2)
plr = str(r) + "exp(i" + str(theta) + ")"
problem = "rexp(itheta) = "
solution = plr
return problem, solution
complex_to_polar = Generator("Complex To Polar Form", 92, "rexp(itheta) = ",
"plr", complexToPolarFunc)

View File

@@ -1,24 +1,19 @@
from .__init__ import * from .__init__ import *
def compoundInterestFunc(maxPrinciple=10000, def compoundInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10):
maxRate=10, p = random.randint(1000, maxPrinciple)
maxTime=10,
maxPeriod=10):
p = random.randint(100, maxPrinciple)
r = random.randint(1, maxRate) r = random.randint(1, maxRate)
t = random.randint(1, maxTime) n = random.randint(1, maxTime)
n = random.randint(1, maxPeriod) a = p * (1 + r / 100)**n
A = p * ((1 + (r / (100 * n))**(n * t))) problem = "Compound interest for a principle amount of " + \
problem = "Compound Interest for a principle amount of " + str( str(p) + " dollars, " + str(r) + \
p) + " dollars, " + str( "% rate of interest and for a time period of " + str(n) + " year is = "
r) + "% rate of interest and for a time period of " + str( solution = round(a, 2)
t) + " compounded monthly is = "
solution = round(A, 2)
return problem, solution return problem, solution
compound_interest = Generator( compound_interest = Generator(
"Compound Interest", 78, "Compound Interest", 78,
"Compound interest for a principle amount of p dollars, r% rate of interest and for a time period of t years with n times compounded annually is = ", "Compound interest for a principle amount of a dollars, b% rate of interest and for a time period of c years is = ",
"A dollars", compoundInterestFunc) "d dollars", compoundInterestFunc)

View File

@@ -10,5 +10,6 @@ def cubeRootFunc(minNo=1, maxNo=1000):
return problem, solution return problem, solution
cube_root = Generator("Cube Root", 47, "Cuberoot of a upto 2 decimal places is", cube_root = Generator("Cube Root", 47,
"b", cubeRootFunc) "Cuberoot of a upto 2 decimal places is", "b",
cubeRootFunc)

View File

@@ -0,0 +1,17 @@
from .__init__ import *
def curvedSurfaceAreaCylinderFunc(maxRadius=49, maxHeight=99):
r = random.randint(1, maxRadius)
h = random.randint(1, maxHeight)
problem = f"What is the curved surface area of a cylinder of radius, {r} and height, {h}?"
csa = float(2 * math.pi * r * h)
formatted_float = round(csa, 2) # "{:.5f}".format(csa)
solution = f"CSA of cylinder = {formatted_float}"
return problem, solution
curved_surface_area_cylinder = Generator(
"Curved surface area of a cylinder", 95,
"What is CSA of a cylinder of radius, r and height, h?", "csa of cylinder",
curvedSurfaceAreaCylinderFunc)

View File

@@ -16,7 +16,7 @@ def dataSummaryFunc(number_values=15, minval=5, maxval=50):
var += (random_list[i] - mean)**2 var += (random_list[i] - mean)**2
standardDeviation = var / number_values standardDeviation = var / number_values
variance = (var / number_values) ** 0.5 variance = (var / number_values)**0.5
problem = "Find the mean,standard deviation and variance for the data" + \ problem = "Find the mean,standard deviation and variance for the data" + \
str(random_list) str(random_list)

View File

@@ -9,4 +9,5 @@ def decimalToOctalFunc(maxDecimal=4096):
decimal_to_octal = Generator("Converts decimal to octal", 84, decimal_to_octal = Generator("Converts decimal to octal", 84,
"What's the octal representation of 98?", "0o142", decimalToOctalFunc) "What's the octal representation of 98?", "0o142",
decimalToOctalFunc)

View File

@@ -4,7 +4,15 @@ from .__init__ import *
def decimalToRomanNumeralsFunc(maxDecimal=4000): def decimalToRomanNumeralsFunc(maxDecimal=4000):
x = random.randint(0, maxDecimal) x = random.randint(0, maxDecimal)
problem = "The number " + str(x) + " in Roman Numerals is: " problem = "The number " + str(x) + " in Roman Numerals is: "
roman_dict = {1: "I", 5: "V", 10: "X", 50: "L", 100: "C", 500: "D", 1000: "M"} roman_dict = {
1: "I",
5: "V",
10: "X",
50: "L",
100: "C",
500: "D",
1000: "M"
}
divisor = 1 divisor = 1
while x >= divisor: while x >= divisor:
divisor *= 10 divisor *= 10
@@ -15,7 +23,7 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000):
if last_value <= 3: if last_value <= 3:
solution += (roman_dict[divisor] * last_value) solution += (roman_dict[divisor] * last_value)
elif last_value == 4: elif last_value == 4:
solution += (roman_dict[divisor] * roman_dict[divisor * 5]) solution += (roman_dict[divisor] + roman_dict[divisor * 5])
elif 5 <= last_value <= 8: elif 5 <= last_value <= 8:
solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * (last_value - 5))) solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * (last_value - 5)))
elif last_value == 9: elif last_value == 9:
@@ -25,5 +33,6 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000):
return problem, solution return problem, solution
decimal_to_roman_numerals = Generator("Converts decimal to Roman Numerals", decimal_to_roman_numerals = Generator("Converts decimal to Roman Numerals", 85,
85, "Convert 20 into Roman Numerals", "XX", decimalToRomanNumeralsFunc) "Convert 20 into Roman Numerals", "XX",
decimalToRomanNumeralsFunc)

View File

@@ -4,9 +4,8 @@ from scipy.integrate import quad
def definiteIntegralFunc(max_coeff=100): def definiteIntegralFunc(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
a = random.randint(0, max_coeff) a = random.randint(0, max_coeff)
b = random.randint(0, max_coeff) b = random.randint(0, max_coeff)
@@ -23,5 +22,7 @@ def definiteIntegralFunc(max_coeff=100):
return problem, solution return problem, solution
definite_integral = Generator("Definite Integral of Quadratic Equation", 89, definite_integral = Generator(
"The definite integral within limits 0 to 1 of quadratic equation ax^2+bx+c is = ", "S", definiteIntegralFunc) "Definite Integral of Quadratic Equation", 89,
"The definite integral within limits 0 to 1 of quadratic equation ax^2+bx+c is = ",
"S", definiteIntegralFunc)

View File

@@ -13,5 +13,5 @@ def degreeToRadFunc(max_deg=360):
return problem, solution return problem, solution
degree_to_rad = Generator("Degrees to Radians", 86, degree_to_rad = Generator("Degrees to Radians", 86, "Angle a in radians is = ",
"Angle a in radians is = ", "b", degreeToRadFunc) "b", degreeToRadFunc)

View File

@@ -49,5 +49,6 @@ def differentiationFunc(diff_lvl=2):
return problem, solution return problem, solution
differentiation = Generator( differentiation = Generator("Differentiation", 88,
"Differentiation", 88, "differentiate w.r.t x : d(f(x))/dx", "g(x)", differentiationFunc) "differentiate w.r.t x : d(f(x))/dx", "g(x)",
differentiationFunc)

View File

@@ -14,6 +14,7 @@ def distanceTwoPointsFunc(maxValXY=20, minValXY=-20):
return problem, solution return problem, solution
distance_two_points = Generator("Distance between 2 points", 24, distance_two_points = Generator(
"Find the distance between (x1,y1) and (x2,y2)", "Distance between 2 points", 24,
"sqrt(distanceSquared)", distanceTwoPointsFunc) "Find the distance between (x1,y1) and (x2,y2)", "sqrt(distanceSquared)",
distanceTwoPointsFunc)

View File

@@ -2,12 +2,15 @@ from .__init__ import *
def euclidianNormFunc(maxEltAmt=20): def euclidianNormFunc(maxEltAmt=20):
vec = [random.uniform(0, 1000) for i in range(random.randint(2, maxEltAmt))] vec = [
random.uniform(0, 1000) for i in range(random.randint(2, maxEltAmt))
]
problem = f"Euclidian norm or L2 norm of the vector{vec} is:" problem = f"Euclidian norm or L2 norm of the vector{vec} is:"
solution = math.sqrt(sum([i**2 for i in vec])) solution = math.sqrt(sum([i**2 for i in vec]))
return problem, solution return problem, solution
eucldian_norm = Generator("Euclidian norm or L2 norm of a vector", 69, eucldian_norm = Generator(
"Euclidian norm or L2 norm of a vector", 69,
"Euclidian Norm of a vector V:[v1, v2, ......., vn]", "Euclidian Norm of a vector V:[v1, v2, ......., vn]",
"sqrt(v1^2 + v2^2 ........ +vn^2)", euclidianNormFunc) "sqrt(v1^2 + v2^2 ........ +vn^2)", euclidianNormFunc)

View File

@@ -27,6 +27,7 @@ def geometricMeanFunc(maxValue=100, maxNum=4):
return problem, solution return problem, solution
geometric_mean = Generator("Geometric Mean of N Numbers", 67, geometric_mean = Generator(
"Geometric Mean of N Numbers", 67,
"Geometric mean of n numbers A1 , A2 , ... , An = ", "Geometric mean of n numbers A1 , A2 , ... , An = ",
"(A1*A2*...An)^(1/n) = ans", geometricMeanFunc) "(A1*A2*...An)^(1/n) = ans", geometricMeanFunc)

View File

@@ -78,5 +78,6 @@ def matrixInversion(SquareMatrixDimension=3,
return problem, solution return problem, solution
invert_matrix = Generator("Inverse of a Matrix", 74, "Inverse of a matrix A is", invert_matrix = Generator("Inverse of a Matrix", 74,
"A^(-1)", matrixInversion) "Inverse of a matrix A is", "A^(-1)",
matrixInversion)

View File

@@ -18,5 +18,5 @@ def isprime(max_a=100):
return (problem, solution) return (problem, solution)
is_prime = Generator('isprime', 90, 'a any positive integer', is_prime = Generator('isprime', 90, 'a any positive integer', 'True/False',
'True/False', isprime) isprime)

View File

@@ -13,5 +13,6 @@ def MidPointOfTwoPointFunc(maxValue=20):
midPoint_of_two_points = Generator("Midpoint of the two point", 20, midPoint_of_two_points = Generator("Midpoint of the two point", 20,
"((X1,Y1),(X2,Y2))=", "((X1+X2)/2,(Y1+Y2)/2)", "((X1,Y1),(X2,Y2))=",
"((X1+X2)/2,(Y1+Y2)/2)",
MidPointOfTwoPointFunc) MidPointOfTwoPointFunc)

View File

@@ -18,6 +18,6 @@ def powerRuleDifferentiationFunc(maxCoef=10, maxExp=10, maxTerms=5):
return problem, solution return problem, solution
power_rule_differentiation = Generator("Power Rule Differentiation", 7, "nx^m=", power_rule_differentiation = Generator("Power Rule Differentiation", 7,
"(n*m)x^(m-1)", "nx^m=", "(n*m)x^(m-1)",
powerRuleDifferentiationFunc) powerRuleDifferentiationFunc)

View File

@@ -14,5 +14,5 @@ def radianToDegFunc(max_rad=3):
return problem, solution return problem, solution
radian_to_deg = Generator("Radians to Degrees", 87, radian_to_deg = Generator("Radians to Degrees", 87, "Angle a in degrees is = ",
"Angle a in degrees is = ", "b", radianToDegFunc) "b", radianToDegFunc)

View File

@@ -12,5 +12,5 @@ def sectorAreaFunc(maxRadius=49, maxAngle=359):
sector_area = Generator("Area of a Sector", 75, sector_area = Generator("Area of a Sector", 75,
"Area of a sector with radius, r and angle, a ", "Area", "Area of a sector with radius, r and angle, a ",
sectorAreaFunc) "Area", sectorAreaFunc)

View File

@@ -0,0 +1,27 @@
from .__init__ import *
def set_operation(minval=3, maxval=7, n_a=4, n_b=5):
number_variables_a = random.randint(minval, maxval)
number_variables_b = random.randint(minval, maxval)
a = []
b = []
for i in range(number_variables_a):
a.append(random.randint(1, 10))
for i in range(number_variables_b):
b.append(random.randint(1, 10))
a = set(a)
b = set(b)
problem = "Given the two sets a=" + \
str(a) + " ,b=" + str(b) + ".Find the Union,intersection,a-b,b-a and symmetric difference"
solution = "Union is " + str(a.union(b)) + ",Intersection is " + str(
a.intersection(b)) + ", a-b is " + str(
a.difference(b)) + ",b-a is " + str(
b.difference(a)) + ", Symmetric difference is " + str(
a.symmetric_difference(b))
return problem, solution
set_operation = Generator("Union,Intersection,Difference of Two Sets", 93,
"Union,intersection,difference", "aUb,a^b,a-b,b-a,",
set_operation)

View File

@@ -1,7 +1,6 @@
from .funcs import * from .funcs import *
from .__init__ import getGenList from .__init__ import getGenList
genList = getGenList() genList = getGenList()

View File

@@ -1,12 +1,12 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
setup(name='mathgenerator', setup(name='mathgenerator',
version='1.1.3', version='1.1.4',
description='An open source solution for generating math problems', description='An open source solution for generating math problems',
url='https://github.com/todarith/mathgenerator', url='https://github.com/todarith/mathgenerator',
author='Luke Weiler', author='Luke Weiler',
author_email='lukew25073@gmail.com', author_email='lukew25073@gmail.com',
license='MIT', license='MIT',
packages=find_packages(), packages=find_packages(),
install_requires=[], install_requires=['sympy', 'numpy', 'scipy'],
entry_points={}) entry_points={})

View File

@@ -10,4 +10,4 @@ for item in list:
print(item[2]) print(item[2])
# print(mathgen.getGenList()) # print(mathgen.getGenList())
print(mathgen.genById(89)) print(mathgen.genById(95))