diff --git a/README.md b/README.md index 2bdc428..5c7341a 100644 --- a/README.md +++ b/README.md @@ -31,93 +31,98 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| [//]: # list start -| 0 | Addition | 29+29= | 58 | addition | -| 1 | Subtraction | 10-8= | 2 | subtraction | -| 2 | Multiplication | 96*0= | 0 | multiplication | -| 3 | Division | 25/95= | 0.2631578947368421 | division | -| 4 | Binary Complement 1s | 100101100= | 011010011 | binary_complement_1s | -| 5 | Modulo Division | 74%50= | 24 | modulo_division | -| 6 | Square Root | sqrt(49)= | 7 | square_root | -| 7 | Power Rule Differentiation | 10x^7 + 7x^5 + 5x^8 | 70x^6 + 35x^4 + 40x^7 | power_rule_differentiation | -| 8 | Square | 9^2= | 81 | square | -| 9 | LCM (Least Common Multiple) | LCM of 19 and 7 = | 133 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 1 and 7 = | 1 | gcd | -| 11 | Basic Algebra | 3x + 2 = 8 | 6 | basic_algebra | -| 12 | Logarithm | log2(128) | 7 | log | -| 13 | Easy Division | 228/12 = | 19 | int_division | -| 14 | Decimal to Binary | Binary of 37= | 100101 | decimal_to_binary | -| 15 | Binary to Decimal | 10100001 | 161 | binary_to_decimal | -| 16 | Fraction Division | (8/2)/(8/2) | 1 | divide_fractions | -| 17 | Integer Multiplication with 2x2 Matrix | 6 * [[3, 7], [10, 6]] = | [[18,42],[60,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 | -| 19 | Triangle exists check | Does triangle with sides 48, 16 and 30 exist? | No | valid_triangle | -| 20 | Midpoint of the two point | (2,-5),(12,-7)= | (7.0,-6.0) | midpoint_of_two_points | -| 21 | Factoring Quadratic | x^2-18x+81 | (x-9)(x-9) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 45 and 1 = | 134 | 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 | -| 24 | Distance between 2 points | Find the distance between (-10, 7) and (16, 6) | sqrt(677) | distance_two_points | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 10 and 8 = | 12.81 | pythagorean_theorem | -| 26 | Linear Equations | 18x + -2y = -174, -13x + 6y = 194 | x = -8, y = 15 | linear_equations | +| 0 | Addition | 15+31= | 46 | addition | +| 1 | Subtraction | 43-14= | 29 | subtraction | +| 2 | Multiplication | 45*1= | 45 | multiplication | +| 3 | Division | 72/45= | 1.6 | division | +| 4 | Binary Complement 1s | 0011= | 1100 | binary_complement_1s | +| 5 | Modulo Division | 14%68= | 14 | modulo_division | +| 6 | Square Root | sqrt(9)= | 3 | square_root | +| 7 | Power Rule Differentiation | 9x^8 | 72x^7 | power_rule_differentiation | +| 8 | Square | 5^2= | 25 | square | +| 9 | LCM (Least Common Multiple) | LCM of 18 and 10 = | 90 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 5 and 17 = | 1 | gcd | +| 11 | Basic Algebra | 10x + 9 = 10 | 1/10 | basic_algebra | +| 12 | Logarithm | log2(32) | 5 | log | +| 13 | Easy Division | 80/16 = | 5 | int_division | +| 14 | Decimal to Binary | Binary of 66= | 1000010 | decimal_to_binary | +| 15 | Binary to Decimal | 011001010 | 202 | binary_to_decimal | +| 16 | Fraction Division | (3/8)/(10/7) | 21/80 | divide_fractions | +| 17 | Integer Multiplication with 2x2 Matrix | 0 * [[2, 6], [0, 4]] = | [[0,0],[0,0]] | multiply_int_to_22_matrix | +| 18 | Area of Triangle | Area of triangle with side lengths: 13 2 10 = | (7.843059660345589e-16+12.808688457449499j) | area_of_triangle | +| 19 | Triangle exists check | Does triangle with sides 33, 10 and 7 exist? | No | valid_triangle | +| 20 | Midpoint of the two point | (-1,-7),(13,-13)= | (6.0,-10.0) | midpoint_of_two_points | +| 21 | Factoring Quadratic | x^2+8x+7 | (x+1)(x+7) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 47 and 37 = | 96 | third_angle_of_triangle | +| 23 | Solve a System of Equations in R^2 | 3x - 5y = -74, -3x + 9y = 114 | x = -8, y = 10 | system_of_equations | +| 24 | Distance between 2 points | Find the distance between (7, 7) and (3, -3) | sqrt(116) | distance_two_points | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 20 and 9 = | 21.93 | pythagorean_theorem | +| 26 | Linear Equations | 5x + -8y = -25, -12x + -1y = -243 | x = 19, y = 15 | linear_equations | | 27 | Prime Factorisation | Find prime factors of 16 | [2, 2, 2, 2] | prime_factors | -| 28 | Fraction Multiplication | (6/8)*(2/5) | 3/10 | fraction_multiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 17 sides | 158.82 | angle_regular_polygon | -| 30 | Combinations of Objects | Number of combinations from 17 objects picked 3 at a time | 680 | combinations | -| 31 | Factorial | 1! = | 1 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 17m is | 1734 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 | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 38m and radius = 16m is | 5428 m^2 | surface_area_cylinder | -| 35 | Volum of Cube | Volume of cube with side = 11m is | 1331 m^3 | volume_cube | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 17m, 19m, 8m is | 2584 m^3 | volume_cuboid | -| 37 | Volume of cylinder | Volume of cylinder with height = 35m and radius = 19m is | 39694 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 | -| 39 | Volume of cone | Volume of cone with height = 43m and radius = 13m is | 7609 m^3 | volume_cone | -| 40 | Common Factors | Common Factors of 21 and 65 = | [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 | -| 42 | Permutations | Number of Permutations from 10 objects picked 5 at a time = | 30240 | permutation | -| 43 | Cross Product of 2 Vectors | [12, -16, 4] X [-14, 10, -9] = | [104, 52, -104] | vector_cross | -| 44 | Compare Fractions | Which symbol represents the comparison between 7/10 and 7/5? | < | 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 | -| 46 | Multiplication of two matrices | Multiply
-8-8
-2-9
and
-10-8
9-9
|
8136
-6197
| matrix_multiplication | -| 47 | Cube Root | cuberoot of 633 upto 2 decimal places is: | 8.59 | 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 | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 79 , 44, 37 = | 200 | fourth_angle_of_quadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 79x^2+182x+98=0 | [-0.86, -1.45] | quadratic_equation | -| 51 | HCF (Highest Common Factor) | HCF of 1 and 20 = | 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 | -| 53 | Exponentiation | 6^9 = | 10077696 | 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 | -| 55 | Comparing surds | Fill in the blanks 71^(1/5) _ 31^(1/8) | > | 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 | -| 57 | Trigonometric Values | What is cos(45)? | 1/√2 | basic_trigonometry | -| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 10 sides = | 1440 | 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 | -| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 18m is | 4071.5040790523717 m^2 | surface_area_sphere | -| 61 | Volume of Sphere | Volume of sphere with radius 61 m = | 950775.7894726198 m^3 | volume_sphere | -| 62 | nth Fibonacci number | What is the 85th Fibonacci number? | 259695496911123328 | nth_fibonacci_number | -| 63 | Profit or Loss Percent | Profit percent when CP = 353 and SP = 752 is: | 113.03116147308782 | profit_loss_percent | -| 64 | Binary to Hexidecimal | 111101011 | 0x1eb | binary_to_hex | -| 65 | Multiplication of 2 complex numbers | (-19-9j) * (-17-2j) = | (305+191j) | 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 | -| 67 | Geometric Mean of N Numbers | Geometric mean of 3 numbers 32 , 5 and 18 = | (32*5*18)^(1/3) = 14.227573217960249 | 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 | -| 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 | -| 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 | -| 71 | Absolute difference between two numbers | Absolute difference between numbers 53 and -70 = | 123 | absolute_difference | -| 72 | Dot Product of 2 Vectors | [-8, -4, -10] . [-9, -6, -9] = | 186 | vector_dot | -| 73 | Binary 2's Complement | 2's complement of = | | 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 | -| 75 | Area of a Sector | Given radius, 40 and angle, 199. Find the area of the sector. | Area of sector = 2778.56417 | 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 | -| 77 | Determinant to 2x2 Matrix | Det([[73, 52], [55, 80]]) = | 2980 | 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 | -| 79 | Decimal to Hexadecimal | Binary of 293= | 0x125 | decimal_to_hexadeci | -| 80 | Percentage of a number | What is 57% of 4? | Required percentage = 2.28% | percentage | -| 81 | Celsius To Fahrenheit | Convert 57 degrees Celsius to degrees Fahrenheit = | 134.60000000000002 | celsius_to_fahrenheit | -| 82 | AP Term Calculation | Find the term number 89 of the AP series: 20, 115, 210 ... | 8380 | 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 | -| 84 | Converts decimal to octal | The decimal number 1716 in Octal is: | 0o3264 | decimal_to_octal | -| 85 | Converts decimal to Roman Numerals | The number 587 in Roman Numerals is: | DLXXXVII | decimal_to_roman_numerals | -| 86 | Degrees to Radians | Angle 245 in radians is = | 4.28 | degree_to_rad | -| 87 | Radians to Degrees | Angle 0 in degrees is = | 0.0 | radian_to_deg | -| 88 | Differentiation | differentiate w.r.t x : d(exp(x)+5*x^(-2))/dx | exp(x) - 10/x^3 | 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 | +| 28 | Fraction Multiplication | (3/1)*(5/3) | 5 | fraction_multiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 5 sides | 108.0 | angle_regular_polygon | +| 30 | Combinations of Objects | Number of combinations from 19 objects picked 2 at a time | 171 | combinations | +| 31 | Factorial | 2! = | 2 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 1m is | 6 m^2 | surface_area_cube | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 9m, 16m, 20m is | 1288 m^2 | surface_area_cuboid | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 7m and radius = 16m is | 2312 m^2 | surface_area_cylinder | +| 35 | Volum of Cube | Volume of cube with side = 12m is | 1728 m^3 | volume_cube | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 11m, 19m, 8m is | 1672 m^3 | volume_cuboid | +| 37 | Volume of cylinder | Volume of cylinder with height = 9m and radius = 15m is | 6361 m^3 | volume_cylinder | +| 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 = 26m and radius = 15m is | 6126 m^3 | volume_cone | +| 40 | Common Factors | Common Factors of 64 and 17 = | [1] | common_factors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 10/6x + 3 and y = -1/3x + 10 | (7/2, 53/6) | intersection_of_two_lines | +| 42 | Permutations | Number of Permutations from 14 objects picked 1 at a time = | 14 | permutation | +| 43 | Cross Product of 2 Vectors | [-16, -17, -11] X [12, -19, 5] = | [-294, -52, 508] | vector_cross | +| 44 | Compare Fractions | Which symbol represents the comparison between 7/2 and 1/7? | > | compare_fractions | +| 45 | Simple Interest | Simple interest for a principle amount of 7256 dollars, 6% rate of interest and for a time period of 2 years is = | 870.72 | simple_interest | +| 46 | Multiplication of two matrices | Multiply
-63104
99-37
and
10-95
2-10-5
6-3-7
21-8
|
14-2-147
104-155-35
| matrix_multiplication | +| 47 | Cube Root | cuberoot of 723 upto 2 decimal places is: | 8.98 | cube_root | +| 48 | Power Rule Integration | 1x^5 + 2x^8 + 1x^5 + 10x^7 + 1x^6 | (1/5)x^6 + (2/8)x^9 + (1/5)x^6 + (10/7)x^8 + (1/6)x^7 + c | power_rule_integration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 58 , 157, 113 = | 32 | fourth_angle_of_quadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 14x^2+92x+17=0 | [-0.19, -6.38] | quadratic_equation | +| 51 | HCF (Highest Common Factor) | HCF of 13 and 20 = | 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 5 = | 1/6 | dice_sum_probability | +| 53 | Exponentiation | 5^10 = | 9765625 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [266, 244, 292, 288, 230, 251, 211, 272, 260, 257, 231, 234, 254, 277, 202, 206, 258, 298, 243, 213, 214, 239, 247, 232, 203, 296, 238, 282, 222, 283, 261, 253, 252, 278, 215, 267, 212] with 90% confidence is | (255.6152095323176, 240.65506073795265) | confidence_interval | +| 55 | Comparing surds | Fill in the blanks 29^(1/1) _ 37^(1/8) | > | surds_comparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 10 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] | fibonacci_series | +| 57 | Trigonometric Values | What is sin(45)? | 1/√2 | basic_trigonometry | +| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 5 sides = | 540 | sum_of_polygon_angles | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[22, 32, 15, 45, 40, 34, 40, 29, 33, 43, 34, 19, 43, 17, 42] | The Mean is 32.53333333333333 , Standard Deviation is 95.71555555555555, Variance is 9.783432708183541 | data_summary | +| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 7m is | 615.7521601035994 m^2 | surface_area_sphere | +| 61 | Volume of Sphere | Volume of sphere with radius 18 m = | 24429.024474314232 m^3 | volume_sphere | +| 62 | nth Fibonacci number | What is the 76th Fibonacci number? | 3416454622906716 | nth_fibonacci_number | +| 63 | Profit or Loss Percent | Profit percent when CP = 300 and SP = 745 is: | 148.33333333333334 | profit_loss_percent | +| 64 | Binary to Hexidecimal | 0011110 | 0x1e | binary_to_hex | +| 65 | Multiplication of 2 complex numbers | (15+4j) * (13+6j) = | (171+142j) | multiply_complex_numbers | +| 66 | Geometric Progression | For the given GP [7, 42, 252, 1512, 9072, 54432] ,Find the value of a,common ratio,9th term value, sum upto 11th term | The value of a is 7, common ratio is 6 , 9th term is 11757312 , sum upto 11th term is 507915877.0 | geometric_progression | +| 67 | Geometric Mean of N Numbers | Geometric mean of 3 numbers 22 , 15 and 25 = | (22*15*25)^(1/3) = 20.206200103110948 | geometric_mean | +| 68 | Harmonic Mean of N Numbers | Harmonic mean of 3 numbers 37 , 33 and 53 = | 3/((1/37) + (1/33) + (1/53)) = 39.371121476373965 | harmonic_mean | +| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[492.40786515780576, 983.9467887251965, 631.4868422143192, 867.3371448756883, 563.3456646686222, 708.0397121576655] is: | 1783.3521007855009 | euclidian_norm | +| 70 | Angle between 2 vectors | angle between the vectors [541.0289697890829, 573.3715402714977, 323.21175522813905, 134.3110759527537, 485.181412466299, 734.1757394805238, 632.1836650961008, 874.4930077772807, 392.3682318405426, 198.18533509253734, 259.3024324493266, 692.6808468046293, 983.0594493368139, 246.1431141764312, 169.47055701867663, 179.3769672014288, 653.3731083951614, 608.0069028185225] and [716.8150260194301, 661.3439350537182, 503.6201707807608, 922.7936933135436, 887.4562350809547, 764.2289969841399, 743.9308000789802, 604.6893588822073, 185.60578793368342, 335.83315817451984, 969.7123500771294, 181.4419381940483, 275.5957393468893, 228.41527442819876, 971.7792535281106, 0.79249601650766, 878.4199844485163, 888.9960985572237] is: | NaN | angle_btw_vectors | +| 71 | Absolute difference between two numbers | Absolute difference between numbers -9 and -91 = | 82 | absolute_difference | +| 72 | Dot Product of 2 Vectors | [14, -20, -3] . [-3, -18, 15] = | 273 | vector_dot | +| 73 | Binary 2's Complement | 2's complement of 100 = | 100 | binary_2s_complement | +| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[77, 3, 65], [46, 99, 23], [31, 83, 47]]) is: | Matrix([[196/18259, 2627/127813, -3183/127813], [-207/36518, 802/127813, 1219/255626], [107/36518, -3149/127813, 7485/255626]]) | invert_matrix | +| 75 | Area of a Sector | Given radius, 15 and angle, 235. Find the area of the sector. | Area of sector = 461.42142 | sector_area | +| 76 | Mean and Median | Given the series of numbers [41, 17, 55, 6, 9, 93, 97, 59, 45, 54]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 47.6 and Arithmetic median of this series is 49.5 | mean_median | +| 77 | Determinant to 2x2 Matrix | Det([[55, 32], [27, 54]]) = | 2106 | int_matrix_22_determinant | +| 78 | Compound Interest | Compound interest for a principle amount of 4870 dollars, 3% rate of interest and for a time period of 8 year is = | 6169.17 | compound_interest | +| 79 | Decimal to Hexadecimal | Binary of 35= | 0x23 | decimal_to_hexadeci | +| 80 | Percentage of a number | What is 98% of 63? | Required percentage = 61.74% | percentage | +| 81 | Celsius To Fahrenheit | Convert -6 degrees Celsius to degrees Fahrenheit = | 21.2 | celsius_to_fahrenheit | +| 82 | AP Term Calculation | Find the term number 33 of the AP series: 72, 140, 208 ... | 2248 | arithmetic_progression_term | +| 83 | AP Sum Calculation | Find the sum of first 72 terms of the AP series: 41, 110, 179 ... | 179316.0 | arithmetic_progression_sum | +| 84 | Converts decimal to octal | The decimal number 406 in Octal is: | 0o626 | decimal_to_octal | +| 85 | Converts decimal to Roman Numerals | The number 397 in Roman Numerals is: | CCCXCVII | decimal_to_roman_numerals | +| 86 | Degrees to Radians | Angle 122 in radians is = | 2.13 | degree_to_rad | +| 87 | Radians to Degrees | Angle 2 in degrees is = | 114.59 | radian_to_deg | +| 88 | Differentiation | differentiate w.r.t x : d(tan(x)+4*x^(-3))/dx | tan(x)^2 + 1 - 12/x^4 | differentiation | +| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 54x^2 + 77x + 69 is = | 125.5 | definite_integral | +| 90 | isprime | 95 | False | is_prime | +| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 4 is = | 16643 | bcd_to_decimal | +| 92 | Complex To Polar Form | rexp(itheta) = | 1.41exp(i-2.36) | complex_to_polar | +| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={9, 5, 6} ,b={8, 1, 6}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 5, 6, 8, 9},Intersection is {6}, a-b is {9, 5},b-a is {8, 1}, Symmetric difference is {1, 5, 8, 9} | set_operation | +| 94 | Base Conversion | Convert 121143 from base 7 to base 8. | 53020 | base_conversion | diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index be02113..fdc580f 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -95,4 +95,8 @@ from .radian_to_deg import * from .differentiation import * from .definite_integral import * from .is_prime import * +from .bcd_to_decimal import * +from .complex_to_polar import * +from .set_operation import * +from .base_conversion import * from .curvedSurfaceAreaCylinderFunc import * diff --git a/mathgenerator/funcs/base_conversion.py b/mathgenerator/funcs/base_conversion.py new file mode 100644 index 0000000..c9ef48f --- /dev/null +++ b/mathgenerator/funcs/base_conversion.py @@ -0,0 +1,50 @@ +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) diff --git a/mathgenerator/funcs/bcd_to_decimal.py b/mathgenerator/funcs/bcd_to_decimal.py new file mode 100644 index 0000000..fc356d0 --- /dev/null +++ b/mathgenerator/funcs/bcd_to_decimal.py @@ -0,0 +1,24 @@ +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) diff --git a/mathgenerator/funcs/complex_to_polar.py b/mathgenerator/funcs/complex_to_polar.py new file mode 100644 index 0000000..ecab5ec --- /dev/null +++ b/mathgenerator/funcs/complex_to_polar.py @@ -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 = f"rexp(itheta) = " + solution = plr + return problem, solution + + +complex_to_polar = Generator("Complex To Polar Form", 92, + "rexp(itheta) = ", "plr", complexToPolarFunc) diff --git a/mathgenerator/funcs/compound_interest.py b/mathgenerator/funcs/compound_interest.py index 4278d10..8f7d48d 100644 --- a/mathgenerator/funcs/compound_interest.py +++ b/mathgenerator/funcs/compound_interest.py @@ -1,24 +1,17 @@ from .__init__ import * -def compoundInterestFunc(maxPrinciple=10000, - maxRate=10, - maxTime=10, - maxPeriod=10): - p = random.randint(100, maxPrinciple) +def compoundInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10): + p = random.randint(1000, maxPrinciple) r = random.randint(1, maxRate) - t = random.randint(1, maxTime) - n = random.randint(1, maxPeriod) - A = p * ((1 + (r / (100 * n))**(n * t))) - problem = "Compound Interest for a principle amount of " + str( - p) + " dollars, " + str( - r) + "% rate of interest and for a time period of " + str( - t) + " compounded monthly is = " - solution = round(A, 2) + n = random.randint(1, maxTime) + a = p * (1 + r / 100)**n + problem = "Compound interest for a principle amount of " + \ + str(p) + " dollars, " + str(r) + \ + "% rate of interest and for a time period of " + str(n) + " year is = " + solution = round(a, 2) return problem, solution compound_interest = Generator( - "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 = ", - "A dollars", compoundInterestFunc) + "Compound Interest", 78, "Compound interest for a principle amount of a dollars, b% rate of interest and for a time period of c years is = ", "d dollars", compoundInterestFunc) diff --git a/mathgenerator/funcs/set_operation.py b/mathgenerator/funcs/set_operation.py new file mode 100644 index 0000000..f328368 --- /dev/null +++ b/mathgenerator/funcs/set_operation.py @@ -0,0 +1,24 @@ +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) diff --git a/test.py b/test.py index 2fa65b7..cc34a10 100644 --- a/test.py +++ b/test.py @@ -10,4 +10,4 @@ for item in list: print(item[2]) # print(mathgen.getGenList()) -print(mathgen.genById(85)) +print(mathgen.genById(94))