From 2fbedfeb07627eb5116aa1ffb1f51e208afbbae2 Mon Sep 17 00:00:00 2001 From: Vhizux Date: Fri, 23 Oct 2020 14:45:47 +0200 Subject: [PATCH 1/6] added conditional probability generator --- mathgenerator/funcs/__init__.py | 1 + mathgenerator/funcs/conitionalProbability.py | 25 ++++++++++++++++++++ test.py | 10 ++++---- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 mathgenerator/funcs/conitionalProbability.py diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index c48f9d8..b565e30 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -105,3 +105,4 @@ from .power_of_powers import * from .quotient_of_power_same_base import * from .quotient_of_power_same_power import * from .complex_quadratic import * +from .conitionalProbability import * diff --git a/mathgenerator/funcs/conitionalProbability.py b/mathgenerator/funcs/conitionalProbability.py new file mode 100644 index 0000000..b7182b6 --- /dev/null +++ b/mathgenerator/funcs/conitionalProbability.py @@ -0,0 +1,25 @@ +from .__init__ import * + +def conditionalProbFunc(): + P_disease= round(2.*random.random(), 2) + true_positive= round(random.random()+float(random.randint(90,99)), 2) + true_negative= round(random.random()+float(random.randint(90,99)), 2) + + def BayesFormula(P_disease, true_positive, true_negative): + P_notDisease= 100.-P_disease + false_positive= 100.-true_negative + false_negative= 100.-false_positive + P_plus= (P_disease)*(true_positive)+(P_notDisease)*(false_positive) + P_disease_plus=( (true_positive)*(100*P_disease) )/P_plus + + return P_disease_plus + + problem= "Someone tested positive for a nasty disease which only {0:.2f}% of population have. " \ + "Test sensitivity (true positive) is equal to SN= {1:.2f}% whereas test specificity (true negative) SP= {2:.2f}%. " \ + "What is the probability that this guy really has that disease?".format(P_disease, true_positive, true_negative ) + + answer=str(round(BayesFormula(P_disease, true_positive, true_negative), 2))+"%" + + return problem, answer + +conditionalProb= Generator("Conditional Probability", 101, "P(A|+)=", "c", conditionalProbFunc) \ No newline at end of file diff --git a/test.py b/test.py index 8f1bf49..ee450c0 100644 --- a/test.py +++ b/test.py @@ -2,12 +2,12 @@ from mathgenerator import mathgen # test your generators here -print(mathgen.addition()) +# print(mathgen.addition()) # prints each generator in genList -list = mathgen.getGenList() -for item in list: - print(item[2]) +# list = mathgen.getGenList() +# for item in list: +# print(item[2]) # print(mathgen.getGenList()) -print(mathgen.genById(100)) +print(mathgen.genById(101)) From db1ed3d1dd915c79a529d532650ea48bf6899093 Mon Sep 17 00:00:00 2001 From: Vhizux Date: Fri, 23 Oct 2020 14:53:30 +0200 Subject: [PATCH 2/6] generated new readme --- README.md | 203 +++++++++++++++++++++++++++--------------------------- 1 file changed, 102 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index f215bfe..b055f98 100644 --- a/README.md +++ b/README.md @@ -31,104 +31,105 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| [//]: # list start -| 0 | Addition | 20+38= | 58 | addition | -| 1 | Subtraction | 2-0= | 2 | subtraction | -| 2 | Multiplication | 31*1= | 31 | multiplication | -| 3 | Division | 53/7= | 7.571428571428571 | division | -| 4 | Binary Complement 1s | 111= | 000 | binary_complement_1s | -| 5 | Modulo Division | 90%6= | 0 | modulo_division | -| 6 | Square Root | sqrt(16)= | 4 | square_root | -| 7 | Power Rule Differentiation | 7x^5 + 8x^10 + 4x^1 + 4x^5 + 7x^3 | 35x^4 + 80x^9 + 4x^0 + 20x^4 + 21x^2 | power_rule_differentiation | -| 8 | Square | 9^2= | 81 | square | -| 9 | LCM (Least Common Multiple) | LCM of 20 and 5 = | 20 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 11 and 2 = | 1 | gcd | -| 11 | Basic Algebra | 10x + 4 = 8 | 2/5 | basic_algebra | -| 12 | Logarithm | log3(2187) | 7 | log | -| 13 | Easy Division | 247/19 = | 13 | int_division | -| 14 | Decimal to Binary | Binary of 13= | 1101 | decimal_to_binary | -| 15 | Binary to Decimal | 001 | 1 | binary_to_decimal | -| 16 | Fraction Division | (6/9)/(4/2) | 1/3 | divide_fractions | -| 17 | Integer Multiplication with 2x2 Matrix | 11 * [[5, 2], [0, 8]] = | [[55,22],[0,88]] | multiply_int_to_22_matrix | -| 18 | Area of Triangle | Area of triangle with side lengths: 10 2 11 = | 9.051933495115836 | area_of_triangle | -| 19 | Triangle exists check | Does triangle with sides 35, 7 and 11 exist? | No | valid_triangle | -| 20 | Midpoint of the two point | (12,-4),(-4,9)= | (4.0,2.5) | midpoint_of_two_points | -| 21 | Factoring Quadratic | x^2-3x-28 | (x-7)(x+4) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 50 and 19 = | 111 | third_angle_of_triangle | -| 23 | Solve a System of Equations in R^2 | -6x - 4y = -2, x + 10y = 47 | x = -3, y = 5 | system_of_equations | -| 24 | Distance between 2 points | Find the distance between (16, 20) and (-9, 14) | sqrt(661) | distance_two_points | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 7 and 3 = | 7.62 | pythagorean_theorem | -| 26 | Linear Equations | 14x + -10y = -26, 15x + -11y = -29 | x = 1, y = 4 | linear_equations | -| 27 | Prime Factorisation | Find prime factors of 29 | [29] | prime_factors | -| 28 | Fraction Multiplication | (3/7)*(10/3) | 10/7 | fraction_multiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 18 sides | 160.0 | angle_regular_polygon | -| 30 | Combinations of Objects | Number of combinations from 12 objects picked 5 at a time | 792 | combinations | -| 31 | Factorial | 2! = | 2 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 9m is | 486 m^2 | surface_area_cube | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 19m, 9m, 6m is | 678 m^2 | surface_area_cuboid | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 39m and radius = 6m is | 1696 m^2 | surface_area_cylinder | -| 35 | Volum of Cube | Volume of cube with side = 14m is | 2744 m^3 | volume_cube | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 4m, 19m, 20m is | 1520 m^3 | volume_cuboid | -| 37 | Volume of cylinder | Volume of cylinder with height = 27m and radius = 4m is | 1357 m^3 | volume_cylinder | -| 38 | Surface Area of cone | Surface area of cone with height = 47m and radius = 15m is | 3031 m^2 | surface_area_cone | -| 39 | Volume of cone | Volume of cone with height = 46m and radius = 1m is | 48 m^3 | volume_cone | -| 40 | Common Factors | Common Factors of 5 and 89 = | [1] | common_factors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -10x - 3 and y = -10/5x - 4 | (1/8, -17/4) | intersection_of_two_lines | -| 42 | Permutations | Number of Permutations from 17 objects picked 6 at a time = | 8910720 | permutation | -| 43 | Cross Product of 2 Vectors | [14, -7, -18] X [3, -16, 12] = | [-372, -222, -203] | vector_cross | -| 44 | Compare Fractions | Which symbol represents the comparison between 6/7 and 2/1? | < | compare_fractions | -| 45 | Simple Interest | Simple interest for a principle amount of 1752 dollars, 10% rate of interest and for a time period of 5 years is = | 876.0 | simple_interest | -| 46 | Multiplication of two matrices | Multiply
-27-10
0-4-9
21010
and
6-6
-53
610
|
-107-67
-34-102
22118
| matrix_multiplication | -| 47 | Cube Root | cuberoot of 212 upto 2 decimal places is: | 5.96 | cube_root | -| 48 | Power Rule Integration | 4x^4 | (4/4)x^5 + c | power_rule_integration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 81 , 131, 8 = | 140 | fourth_angle_of_quadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 66x^2+177x+45=0 | [-0.28, -2.4] | quadratic_equation | -| 51 | HCF (Highest Common Factor) | HCF of 8 and 10 = | 2 | hcf | -| 52 | Probability of a certain sum appearing on faces of dice | If 2 dice are rolled at the same time, the probability of getting a sum of 7 = | 6/36 | dice_sum_probability | -| 53 | Exponentiation | 16^3 = | 4096 | exponentiation | -| 54 | Confidence interval For sample S | The confidence interval for sample [240, 211, 206, 296, 223, 220, 264, 251, 245, 248, 207, 215, 277, 274, 297, 243, 278, 292, 256, 233, 266, 236, 270, 227, 209, 258, 298] with 99% confidence is | (263.9293815733304, 235.32987768592884) | confidence_interval | -| 55 | Comparing surds | Fill in the blanks 63^(1/2) _ 37^(1/4) | > | surds_comparison | -| 56 | Fibonacci Series | The Fibonacci Series of the first 12 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | fibonacci_series | -| 57 | Trigonometric Values | What is sin(0)? | 0 | basic_trigonometry | -| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 7 sides = | 900 | sum_of_polygon_angles | -| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[30, 21, 26, 36, 34, 7, 46, 21, 15, 29, 9, 33, 16, 28, 43] | The Mean is 26.266666666666666 , Standard Deviation is 123.39555555555556, Variance is 11.108355213781902 | data_summary | -| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 6m is | 452.3893421169302 m^2 | surface_area_sphere | -| 61 | Volume of Sphere | Volume of sphere with radius 10 m = | 4188.790204786391 m^3 | volume_sphere | -| 62 | nth Fibonacci number | What is the 41th Fibonacci number? | 165580141 | nth_fibonacci_number | -| 63 | Profit or Loss Percent | Profit percent when CP = 411 and SP = 499 is: | 21.41119221411192 | profit_loss_percent | -| 64 | Binary to Hexidecimal | 00010 | 0x2 | binary_to_hex | -| 65 | Multiplication of 2 complex numbers | (-2-6j) * (-10+2j) = | (32+56j) | multiply_complex_numbers | -| 66 | Geometric Progression | For the given GP [7, 77, 847, 9317, 102487, 1127357] ,Find the value of a,common ratio,8th term value, sum upto 7th term | The value of a is 7, common ratio is 11 , 8th term is 136410197 , sum upto 7th term is 13641019.0 | geometric_progression | -| 67 | Geometric Mean of N Numbers | Geometric mean of 4 numbers 76 , 98 , 2 , 58 = | (76*98*2*58)^(1/4) = 30.487682589384825 | geometric_mean | -| 68 | Harmonic Mean of N Numbers | Harmonic mean of 3 numbers 77 , 98 and 69 = | 3/((1/77) + (1/98) + (1/69)) = 79.60970388869067 | harmonic_mean | -| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[229.4364953887822, 570.6032154600009, 199.52328312454694, 658.3975413255898, 605.9566521345233, 616.6627240713517, 572.9546490919761, 508.8683987353998, 666.172347641998, 865.2735159823208, 594.8620516188639, 418.8436115273115, 69.46437421671337, 385.84806581739593] is: | 2015.3622923166513 | euclidian_norm | -| 70 | Angle between 2 vectors | angle between the vectors [954.08, 488.66, 694.46, 127.67, 912.65, 462.11, 713.4, 179.41, 728.87, 811.04, 760.22, 688.68, 444.93, 237.29, 485.89, 565.71, 520.56, 44.1, 684.62, 665.12] and [736.88, 60.8, 240.61, 677.58, 887.06, 73.3, 470.5, 884.06, 453.97, 168.97, 921.73, 538.36, 967.82, 236.94, 51.62, 402.46, 57.88, 166.91, 676.47, 708.47] is: | 0.63 radians | angle_btw_vectors | -| 71 | Absolute difference between two numbers | Absolute difference between numbers -87 and 69 = | 156 | absolute_difference | -| 72 | Dot Product of 2 Vectors | [14, -1, 7] . [-12, 15, -9] = | -246 | vector_dot | -| 73 | Binary 2's Complement | 2's complement of 11010 = | 110 | binary_2s_complement | -| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[17, 31, 76], [3, 65, 91], [42, 2, 28]]) is: | Matrix([[-273/10550, 179/15825, 2119/63300], [-623/10550, 679/15825, 1319/63300], [227/5275, -317/15825, -253/15825]]) | invert_matrix | -| 75 | Area of a Sector | Given radius, 4 and angle, 2. Find the area of the sector. | Area of sector = 0.27925 | sector_area | -| 76 | Mean and Median | Given the series of numbers [87, 97, 75, 27, 91, 31, 15, 40, 73, 74]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 61.0 and Arithmetic median of this series is 73.5 | mean_median | -| 77 | Determinant to 2x2 Matrix | Det([[83, 41], [15, 13]]) = | 464 | int_matrix_22_determinant | -| 78 | Compound Interest | Compound interest for a principle amount of 2702 dollars, 7% rate of interest and for a time period of 2 year is = | 3093.52 | compound_interest | -| 79 | Decimal to Hexadecimal | Binary of 386= | 0x182 | decimal_to_hexadeci | -| 80 | Percentage of a number | What is 64% of 8? | Required percentage = 5.12% | percentage | -| 81 | Celsius To Fahrenheit | Convert 50 degrees Celsius to degrees Fahrenheit = | 122.0 | celsius_to_fahrenheit | -| 82 | AP Term Calculation | Find the term number 89 of the AP series: -35, -98, -161 ... | -5579 | arithmetic_progression_term | -| 83 | AP Sum Calculation | Find the sum of first 63 terms of the AP series: 7, 100, 193 ... | 182070.0 | arithmetic_progression_sum | -| 84 | Converts decimal to octal | The decimal number 265 in Octal is: | 0o411 | decimal_to_octal | -| 85 | Converts decimal to Roman Numerals | The number 1439 in Roman Numerals is: | MCDXXXIX | decimal_to_roman_numerals | -| 86 | Degrees to Radians | Angle 68 in radians is = | 1.19 | degree_to_rad | -| 87 | Radians to Degrees | Angle 3 in degrees is = | 171.89 | radian_to_deg | -| 88 | Differentiation | differentiate w.r.t x : d(ln(x)+2*x^3)/dx | 6*x^2 + 1/x | differentiation | -| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 74x^2 + 55x + 86 is = | 138.1667 | definite_integral | -| 90 | isprime | 32 | False | is_prime | -| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 1 is = | 5461 | bcd_to_decimal | -| 92 | Complex To Polar Form | rexp(itheta) = | 27.59exp(i-2.38) | complex_to_polar | -| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 2, 3, 5, 6, 8} ,b={1, 10, 2, 9}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 2, 3, 5, 6, 8, 9, 10},Intersection is {1, 2}, a-b is {8, 3, 5, 6},b-a is {9, 10}, Symmetric difference is {3, 5, 6, 8, 9, 10} | set_operation | -| 94 | Base Conversion | Convert 131222 from base 6 to base 2. | 10111010111110 | base_conversion | -| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 27 and height, 94? | CSA of cylinder = 15946.72 | curved_surface_area_cylinder | -| 96 | Perimeter of Polygons | The perimeter of a 9 sided polygon with lengths of [48, 30, 110, 95, 10, 33, 87, 70, 78]cm is: | 561 | perimeter_of_polygons | -| 97 | Power of Powers | The 24^1^3 = 24^(1*3) = 24^3 | 13824 | power_of_powers | -| 98 | Quotient of Powers with Same Base | The Quotient of 41^2 and 41^3 = 41^(2-3) = 41^-1 | 0.024390243902439025 | quotient_of_power_same_base | -| 99 | Quotient of Powers with Same Power | The Quotient of 30^5 and 35^5 = (30/35)^5 = 0.8571428571428571^5 | 0.46266436603796024 | quotient_of_power_same_power | -| 100 | complex Quadratic Equation | 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 | +| 0 | Addition | 37+8= | 45 | addition | +| 1 | Subtraction | 45-36= | 9 | subtraction | +| 2 | Multiplication | 92*1= | 92 | multiplication | +| 3 | Division | 26/67= | 0.3880597014925373 | division | +| 4 | Binary Complement 1s | 010111011= | 101000100 | binary_complement_1s | +| 5 | Modulo Division | 64%55= | 9 | modulo_division | +| 6 | Square Root | sqrt(81)= | 9 | square_root | +| 7 | Power Rule Differentiation | 10x^7 + 5x^9 + 8x^9 + 3x^2 + 7x^5 | 70x^6 + 45x^8 + 72x^8 + 6x^1 + 35x^4 | power_rule_differentiation | +| 8 | Square | 16^2= | 256 | square | +| 9 | LCM (Least Common Multiple) | LCM of 16 and 1 = | 16 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 2 and 18 = | 2 | gcd | +| 11 | Basic Algebra | 4x + 5 = 10 | 5/4 | basic_algebra | +| 12 | Logarithm | log2(2) | 1 | log | +| 13 | Easy Division | 4/1 = | 4 | int_division | +| 14 | Decimal to Binary | Binary of 37= | 100101 | decimal_to_binary | +| 15 | Binary to Decimal | 0100110 | 38 | binary_to_decimal | +| 16 | Fraction Division | (10/8)/(1/2) | 5/2 | divide_fractions | +| 17 | Integer Multiplication with 2x2 Matrix | 7 * [[7, 10], [3, 9]] = | [[49,70],[21,63]] | multiply_int_to_22_matrix | +| 18 | Area of Triangle | Area of triangle with side lengths: 9 2 5 = | (7.347880794884119e-16+12j) | area_of_triangle | +| 19 | Triangle exists check | Does triangle with sides 8, 33 and 19 exist? | No | valid_triangle | +| 20 | Midpoint of the two point | (-2,1),(6,2)= | (2.0,1.5) | midpoint_of_two_points | +| 21 | Factoring Quadratic | x^2+13x+30 | (x+3)(x+10) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 57 and 85 = | 38 | third_angle_of_triangle | +| 23 | Solve a System of Equations in R^2 | -3x + 3y = 39, 4x - 8y = -72 | x = -8, y = 5 | system_of_equations | +| 24 | Distance between 2 points | Find the distance between (17, 21) and (-14, 1) | sqrt(1361) | distance_two_points | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 17 and 14 = | 22.02 | pythagorean_theorem | +| 26 | Linear Equations | -16x + 4y = -160, 12x + -1y = 96 | x = 7, y = -12 | linear_equations | +| 27 | Prime Factorisation | Find prime factors of 117 | [3, 3, 13] | prime_factors | +| 28 | Fraction Multiplication | (1/2)*(1/4) | 1/8 | fraction_multiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 19 sides | 161.05 | angle_regular_polygon | +| 30 | Combinations of Objects | Number of combinations from 17 objects picked 4 at a time | 2380 | combinations | +| 31 | Factorial | 6! = | 720 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 3m is | 54 m^2 | surface_area_cube | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 17m, 7m, 16m is | 1006 m^2 | surface_area_cuboid | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 4m and radius = 19m is | 2745 m^2 | surface_area_cylinder | +| 35 | Volum of Cube | Volume of cube with side = 7m is | 343 m^3 | volume_cube | +| 36 | Volume of Cuboid | Volume of cuboid with sides = 11m, 18m, 9m is | 1782 m^3 | volume_cuboid | +| 37 | Volume of cylinder | Volume of cylinder with height = 28m and radius = 17m is | 25421 m^3 | volume_cylinder | +| 38 | Surface Area of cone | Surface area of cone with height = 21m and radius = 7m is | 640 m^2 | surface_area_cone | +| 39 | Volume of cone | Volume of cone with height = 23m and radius = 13m is | 4070 m^3 | volume_cone | +| 40 | Common Factors | Common Factors of 86 and 2 = | [1, 2] | common_factors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 10/4x - 8 and y = -9/4x - 2 | (24/19, -92/19) | intersection_of_two_lines | +| 42 | Permutations | Number of Permutations from 20 objects picked 5 at a time = | 1860480 | permutation | +| 43 | Cross Product of 2 Vectors | [17, -12, 17] X [-13, -17, 10] = | [169, -391, -445] | vector_cross | +| 44 | Compare Fractions | Which symbol represents the comparison between 4/10 and 10/3? | < | compare_fractions | +| 45 | Simple Interest | Simple interest for a principle amount of 8120 dollars, 3% rate of interest and for a time period of 9 years is = | 2192.4 | simple_interest | +| 46 | Multiplication of two matrices | Multiply
14-3-9
-10-9-57
58-75
and
-6-10
-47-7
302
-7-8-7
|
329929
32-1094
-11811-105
| matrix_multiplication | +| 47 | Cube Root | cuberoot of 7 upto 2 decimal places is: | 1.91 | cube_root | +| 48 | Power Rule Integration | 8x^1 | (8/1)x^2 + c | power_rule_integration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 44 , 100, 31 = | 185 | fourth_angle_of_quadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 19x^2+181x+1=0 | [-0.01, -9.52] | quadratic_equation | +| 51 | HCF (Highest Common Factor) | HCF of 9 and 4 = | 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 | 2^1 = | 2 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [241, 269, 277, 202, 271, 215, 260, 265, 216, 267, 297, 219, 262, 273, 212, 268, 294, 210, 286, 235, 270, 231, 272, 289, 245, 283, 250] with 80% confidence is | (261.63267428757547, 247.92288126798007) | confidence_interval | +| 55 | Comparing surds | Fill in the blanks 57^(1/5) _ 94^(1/7) | > | surds_comparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 9 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21] | fibonacci_series | +| 57 | Trigonometric Values | What is sin(90)? | 1 | 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[39, 33, 10, 49, 21, 9, 9, 20, 50, 10, 41, 12, 50, 50, 29] | The Mean is 28.8 , Standard Deviation is 262.56000000000006, Variance is 16.203703280423277 | data_summary | +| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 3m is | 113.09733552923255 m^2 | surface_area_sphere | +| 61 | Volume of Sphere | Volume of sphere with radius 38 m = | 229847.29611703884 m^3 | volume_sphere | +| 62 | nth Fibonacci number | What is the 24th Fibonacci number? | 46368 | nth_fibonacci_number | +| 63 | Profit or Loss Percent | Profit percent when CP = 173 and SP = 357 is: | 106.35838150289017 | profit_loss_percent | +| 64 | Binary to Hexidecimal | 1000110 | 0x46 | binary_to_hex | +| 65 | Multiplication of 2 complex numbers | (14-4j) * (5-12j) = | (22-188j) | multiply_complex_numbers | +| 66 | Geometric Progression | For the given GP [11, 66, 396, 2376, 14256, 85536] ,Find the value of a,common ratio,11th term value, sum upto 7th term | The value of a is 11, common ratio is 6 , 11th term is 665127936 , sum upto 7th term is 615857.0 | geometric_progression | +| 67 | Geometric Mean of N Numbers | Geometric mean of 2 numbers 61 and 67 = | (61*67)^(1/2) = 63.92964883369844 | geometric_mean | +| 68 | Harmonic Mean of N Numbers | Harmonic mean of 2 numbers 62 and 84 = | 2/((1/62) + (1/84)) = 71.34246575342466 | harmonic_mean | +| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[783.9868296299311, 482.5604033573253, 863.1029339509203, 956.7790571651393, 863.0425006034349] is: | 1803.5285106129884 | euclidian_norm | +| 70 | Angle between 2 vectors | angle between the vectors [379.65, 308.56] and [100.22, 686.67] is: | 0.74 radians | angle_btw_vectors | +| 71 | Absolute difference between two numbers | Absolute difference between numbers 18 and 79 = | 61 | absolute_difference | +| 72 | Dot Product of 2 Vectors | [14, 11, -1] . [-20, 10, 18] = | -188 | vector_dot | +| 73 | Binary 2's Complement | 2's complement of 111110 = | 10 | binary_2s_complement | +| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[68, 2, 85], [70, 19, 47], [17, 38, 6]]) is: | Matrix([[-1672/85707, 3218/85707, -169/9523], [379/85707, -1037/85707, 306/9523], [779/28569, -850/28569, 128/9523]]) | invert_matrix | +| 75 | Area of a Sector | Given radius, 18 and angle, 67. Find the area of the sector. | Area of sector = 189.43804 | sector_area | +| 76 | Mean and Median | Given the series of numbers [40, 66, 30, 32, 78, 27, 6, 35, 86, 3]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 40.3 and Arithmetic median of this series is 33.5 | mean_median | +| 77 | Determinant to 2x2 Matrix | Det([[65, 36], [75, 98]]) = | 3670 | int_matrix_22_determinant | +| 78 | Compound Interest | Compound interest for a principle amount of 9481 dollars, 5% rate of interest and for a time period of 1 year is = | 9955.05 | compound_interest | +| 79 | Decimal to Hexadecimal | Binary of 972= | 0x3cc | decimal_to_hexadeci | +| 80 | Percentage of a number | What is 92% of 17? | Required percentage = 15.64% | percentage | +| 81 | Celsius To Fahrenheit | Convert 68 degrees Celsius to degrees Fahrenheit = | 154.4 | celsius_to_fahrenheit | +| 82 | AP Term Calculation | Find the term number 58 of the AP series: 21, -42, -105 ... | -3570 | arithmetic_progression_term | +| 83 | AP Sum Calculation | Find the sum of first 6 terms of the AP series: -37, -108, -179 ... | -1287.0 | arithmetic_progression_sum | +| 84 | Converts decimal to octal | The decimal number 988 in Octal is: | 0o1734 | decimal_to_octal | +| 85 | Converts decimal to Roman Numerals | The number 1930 in Roman Numerals is: | MCMXXX | decimal_to_roman_numerals | +| 86 | Degrees to Radians | Angle 87 in radians is = | 1.52 | 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(cos(x)+7*x^(-4))/dx | -sin(x) - 28/x^5 | differentiation | +| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 12x^2 + 95x + 87 is = | 138.5 | definite_integral | +| 90 | isprime | 77 | False | is_prime | +| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 3 is = | 13891 | bcd_to_decimal | +| 92 | Complex To Polar Form | rexp(itheta) = | 21.63exp(i-2.16) | complex_to_polar | +| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 3, 4, 5, 7} ,b={1, 3, 4, 7}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 3, 4, 5, 7},Intersection is {1, 3, 4, 7}, a-b is {5},b-a is set(), Symmetric difference is {5} | set_operation | +| 94 | Base Conversion | Convert 6C38 from base 15 to base 10. | 23003 | base_conversion | +| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 15 and height, 67? | CSA of cylinder = 6314.6 | curved_surface_area_cylinder | +| 96 | Perimeter of Polygons | The perimeter of a 11 sided polygon with lengths of [34, 21, 86, 40, 83, 32, 4, 75, 86, 106, 48]cm is: | 615 | perimeter_of_polygons | +| 97 | Power of Powers | The 4^8^4 = 4^(8*4) = 4^32 | 18446744073709551616 | power_of_powers | +| 98 | Quotient of Powers with Same Base | The Quotient of 17^6 and 17^5 = 17^(6-5) = 17^1 | 17 | quotient_of_power_same_base | +| 99 | Quotient of Powers with Same Power | The Quotient of 45^7 and 41^7 = (45/41)^7 = 1.0975609756097562^7 | 1.9186713887127431 | quotient_of_power_same_power | +| 100 | complex Quadratic Equation | Find the roots of given Quadratic Equation 6x^2 + 8x + 2 = 0 | simplified solution : ((-0.333, -1.0)), generalized solution : ((-8 + 4)/2*6, (-8 - 4)/2*6) | complex_quadratic | +| 101 | Conditional Probability | Someone tested positive for a nasty disease which only 1.96% of population have. Test sensitivity (true positive) is equal to SN= 99.00% whereas test specificity (true negative) SP= 94.80%. What is the probability that this guy really has that disease? | 27.57% | conitionalProbability | From 66ec954a72a8c64459bfb0aec62535112a851abd Mon Sep 17 00:00:00 2001 From: Vhizux Date: Fri, 23 Oct 2020 15:16:33 +0200 Subject: [PATCH 3/6] fixed typo in function filename --- README.md | 202 +++++++++--------- mathgenerator/funcs/__init__.py | 2 +- ...obability.py => conditionalProbability.py} | 0 3 files changed, 102 insertions(+), 102 deletions(-) rename mathgenerator/funcs/{conitionalProbability.py => conditionalProbability.py} (100%) diff --git a/README.md b/README.md index b055f98..39cce4e 100644 --- a/README.md +++ b/README.md @@ -31,105 +31,105 @@ problem, solution = mathgen.genById(0) | Id | Skill | Example problem | Example Solution | Function Name | |------|-----------------------------------|--------------------|-----------------------|--------------------------| [//]: # list start -| 0 | Addition | 37+8= | 45 | addition | -| 1 | Subtraction | 45-36= | 9 | subtraction | -| 2 | Multiplication | 92*1= | 92 | multiplication | -| 3 | Division | 26/67= | 0.3880597014925373 | division | -| 4 | Binary Complement 1s | 010111011= | 101000100 | binary_complement_1s | -| 5 | Modulo Division | 64%55= | 9 | modulo_division | -| 6 | Square Root | sqrt(81)= | 9 | square_root | -| 7 | Power Rule Differentiation | 10x^7 + 5x^9 + 8x^9 + 3x^2 + 7x^5 | 70x^6 + 45x^8 + 72x^8 + 6x^1 + 35x^4 | power_rule_differentiation | -| 8 | Square | 16^2= | 256 | square | -| 9 | LCM (Least Common Multiple) | LCM of 16 and 1 = | 16 | lcm | -| 10 | GCD (Greatest Common Denominator) | GCD of 2 and 18 = | 2 | gcd | -| 11 | Basic Algebra | 4x + 5 = 10 | 5/4 | basic_algebra | -| 12 | Logarithm | log2(2) | 1 | log | -| 13 | Easy Division | 4/1 = | 4 | int_division | -| 14 | Decimal to Binary | Binary of 37= | 100101 | decimal_to_binary | -| 15 | Binary to Decimal | 0100110 | 38 | binary_to_decimal | -| 16 | Fraction Division | (10/8)/(1/2) | 5/2 | divide_fractions | -| 17 | Integer Multiplication with 2x2 Matrix | 7 * [[7, 10], [3, 9]] = | [[49,70],[21,63]] | multiply_int_to_22_matrix | -| 18 | Area of Triangle | Area of triangle with side lengths: 9 2 5 = | (7.347880794884119e-16+12j) | area_of_triangle | -| 19 | Triangle exists check | Does triangle with sides 8, 33 and 19 exist? | No | valid_triangle | -| 20 | Midpoint of the two point | (-2,1),(6,2)= | (2.0,1.5) | midpoint_of_two_points | -| 21 | Factoring Quadratic | x^2+13x+30 | (x+3)(x+10) | factoring | -| 22 | Third Angle of Triangle | Third angle of triangle with angles 57 and 85 = | 38 | third_angle_of_triangle | -| 23 | Solve a System of Equations in R^2 | -3x + 3y = 39, 4x - 8y = -72 | x = -8, y = 5 | system_of_equations | -| 24 | Distance between 2 points | Find the distance between (17, 21) and (-14, 1) | sqrt(1361) | distance_two_points | -| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 17 and 14 = | 22.02 | pythagorean_theorem | -| 26 | Linear Equations | -16x + 4y = -160, 12x + -1y = 96 | x = 7, y = -12 | linear_equations | -| 27 | Prime Factorisation | Find prime factors of 117 | [3, 3, 13] | prime_factors | -| 28 | Fraction Multiplication | (1/2)*(1/4) | 1/8 | fraction_multiplication | -| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 19 sides | 161.05 | angle_regular_polygon | -| 30 | Combinations of Objects | Number of combinations from 17 objects picked 4 at a time | 2380 | combinations | -| 31 | Factorial | 6! = | 720 | factorial | -| 32 | Surface Area of Cube | Surface area of cube with side = 3m is | 54 m^2 | surface_area_cube | -| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 17m, 7m, 16m is | 1006 m^2 | surface_area_cuboid | -| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 4m and radius = 19m is | 2745 m^2 | surface_area_cylinder | -| 35 | Volum of Cube | Volume of cube with side = 7m is | 343 m^3 | volume_cube | -| 36 | Volume of Cuboid | Volume of cuboid with sides = 11m, 18m, 9m is | 1782 m^3 | volume_cuboid | -| 37 | Volume of cylinder | Volume of cylinder with height = 28m and radius = 17m is | 25421 m^3 | volume_cylinder | -| 38 | Surface Area of cone | Surface area of cone with height = 21m and radius = 7m is | 640 m^2 | surface_area_cone | -| 39 | Volume of cone | Volume of cone with height = 23m and radius = 13m is | 4070 m^3 | volume_cone | -| 40 | Common Factors | Common Factors of 86 and 2 = | [1, 2] | common_factors | -| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = 10/4x - 8 and y = -9/4x - 2 | (24/19, -92/19) | intersection_of_two_lines | -| 42 | Permutations | Number of Permutations from 20 objects picked 5 at a time = | 1860480 | permutation | -| 43 | Cross Product of 2 Vectors | [17, -12, 17] X [-13, -17, 10] = | [169, -391, -445] | vector_cross | -| 44 | Compare Fractions | Which symbol represents the comparison between 4/10 and 10/3? | < | compare_fractions | -| 45 | Simple Interest | Simple interest for a principle amount of 8120 dollars, 3% rate of interest and for a time period of 9 years is = | 2192.4 | simple_interest | -| 46 | Multiplication of two matrices | Multiply
14-3-9
-10-9-57
58-75
and
-6-10
-47-7
302
-7-8-7
|
329929
32-1094
-11811-105
| matrix_multiplication | -| 47 | Cube Root | cuberoot of 7 upto 2 decimal places is: | 1.91 | cube_root | -| 48 | Power Rule Integration | 8x^1 | (8/1)x^2 + c | power_rule_integration | -| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 44 , 100, 31 = | 185 | fourth_angle_of_quadrilateral | -| 50 | Quadratic Equation | Zeros of the Quadratic Equation 19x^2+181x+1=0 | [-0.01, -9.52] | quadratic_equation | -| 51 | HCF (Highest Common Factor) | HCF of 9 and 4 = | 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 | 2^1 = | 2 | exponentiation | -| 54 | Confidence interval For sample S | The confidence interval for sample [241, 269, 277, 202, 271, 215, 260, 265, 216, 267, 297, 219, 262, 273, 212, 268, 294, 210, 286, 235, 270, 231, 272, 289, 245, 283, 250] with 80% confidence is | (261.63267428757547, 247.92288126798007) | confidence_interval | -| 55 | Comparing surds | Fill in the blanks 57^(1/5) _ 94^(1/7) | > | surds_comparison | -| 56 | Fibonacci Series | The Fibonacci Series of the first 9 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21] | fibonacci_series | +| 0 | Addition | 6+34= | 40 | addition | +| 1 | Subtraction | 66-1= | 65 | subtraction | +| 2 | Multiplication | 69*1= | 69 | multiplication | +| 3 | Division | 19/52= | 0.36538461538461536 | division | +| 4 | Binary Complement 1s | 10000= | 01111 | binary_complement_1s | +| 5 | Modulo Division | 79%84= | 79 | modulo_division | +| 6 | Square Root | sqrt(64)= | 8 | square_root | +| 7 | Power Rule Differentiation | 2x^8 + 6x^2 + 10x^7 | 16x^7 + 12x^1 + 70x^6 | power_rule_differentiation | +| 8 | Square | 18^2= | 324 | square | +| 9 | LCM (Least Common Multiple) | LCM of 1 and 14 = | 14 | lcm | +| 10 | GCD (Greatest Common Denominator) | GCD of 5 and 7 = | 1 | gcd | +| 11 | Basic Algebra | 8x + 1 = 9 | 8 | basic_algebra | +| 12 | Logarithm | log2(32) | 5 | log | +| 13 | Easy Division | 165/11 = | 15 | int_division | +| 14 | Decimal to Binary | Binary of 95= | 1011111 | decimal_to_binary | +| 15 | Binary to Decimal | 1111001000 | 968 | binary_to_decimal | +| 16 | Fraction Division | (3/8)/(1/3) | 9/8 | divide_fractions | +| 17 | Integer Multiplication with 2x2 Matrix | 11 * [[9, 6], [9, 9]] = | [[99,66],[99,99]] | multiply_int_to_22_matrix | +| 18 | Area of Triangle | Area of triangle with side lengths: 2 3 9 = | (1.0246130234694952e-15+16.73320053068151j) | area_of_triangle | +| 19 | Triangle exists check | Does triangle with sides 15, 24 and 22 exist? | Yes | valid_triangle | +| 20 | Midpoint of the two point | (8,-11),(8,-6)= | (8.0,-8.5) | midpoint_of_two_points | +| 21 | Factoring Quadratic | x^2+7x+10 | (x+5)(x+2) | factoring | +| 22 | Third Angle of Triangle | Third angle of triangle with angles 53 and 11 = | 116 | third_angle_of_triangle | +| 23 | Solve a System of Equations in R^2 | -8x - 2y = 78, -8x + 3y = 63 | x = -9, y = -3 | system_of_equations | +| 24 | Distance between 2 points | Find the distance between (-9, -20) and (17, -19) | sqrt(677) | distance_two_points | +| 25 | Pythagorean Theorem | The hypotenuse of a right triangle given the other two lengths 17 and 10 = | 19.72 | pythagorean_theorem | +| 26 | Linear Equations | 20x + -5y = -240, -8x + -9y = -36 | x = -9, y = 12 | linear_equations | +| 27 | Prime Factorisation | Find prime factors of 60 | [2, 2, 3, 5] | prime_factors | +| 28 | Fraction Multiplication | (10/8)*(2/8) | 5/16 | fraction_multiplication | +| 29 | Angle of a Regular Polygon | Find the angle of a regular polygon with 4 sides | 90.0 | angle_regular_polygon | +| 30 | Combinations of Objects | Number of combinations from 10 objects picked 1 at a time | 10 | combinations | +| 31 | Factorial | 3! = | 6 | factorial | +| 32 | Surface Area of Cube | Surface area of cube with side = 5m is | 150 m^2 | surface_area_cube | +| 33 | Surface Area of Cuboid | Surface area of cuboid with sides = 20m, 2m, 4m is | 256 m^2 | surface_area_cuboid | +| 34 | Surface Area of Cylinder | Surface area of cylinder with height = 4m and radius = 6m is | 376 m^2 | surface_area_cylinder | +| 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 = 10m, 6m, 17m is | 1020 m^3 | volume_cuboid | +| 37 | Volume of cylinder | Volume of cylinder with height = 50m and radius = 14m is | 30787 m^3 | volume_cylinder | +| 38 | Surface Area of cone | Surface area of cone with height = 9m and radius = 5m is | 240 m^2 | surface_area_cone | +| 39 | Volume of cone | Volume of cone with height = 26m and radius = 9m is | 2205 m^3 | volume_cone | +| 40 | Common Factors | Common Factors of 85 and 23 = | [1] | common_factors | +| 41 | Intersection of Two Lines | Find the point of intersection of the two lines: y = -8/2x + 6 and y = -7/5x + 5 | (5/13, 58/13) | intersection_of_two_lines | +| 42 | Permutations | Number of Permutations from 18 objects picked 9 at a time = | 17643225600 | permutation | +| 43 | Cross Product of 2 Vectors | [-9, -11, -7] X [-6, -14, 4] = | [-142, 78, 60] | vector_cross | +| 44 | Compare Fractions | Which symbol represents the comparison between 9/1 and 9/4? | > | compare_fractions | +| 45 | Simple Interest | Simple interest for a principle amount of 6270 dollars, 4% rate of interest and for a time period of 8 years is = | 2006.4 | simple_interest | +| 46 | Multiplication of two matrices | Multiply
8-41
22-1
and
3-5-4
2-10-7
8-87
|
24-83
2-22-29
| matrix_multiplication | +| 47 | Cube Root | cuberoot of 462 upto 2 decimal places is: | 7.73 | cube_root | +| 48 | Power Rule Integration | 3x^5 | (3/5)x^6 + c | power_rule_integration | +| 49 | Fourth Angle of Quadrilateral | Fourth angle of quadrilateral with angles 173 , 63, 34 = | 90 | fourth_angle_of_quadrilateral | +| 50 | Quadratic Equation | Zeros of the Quadratic Equation 64x^2+175x+26=0 | [-0.16, -2.58] | quadratic_equation | +| 51 | HCF (Highest Common Factor) | HCF of 15 and 3 = | 3 | hcf | +| 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 13 = | 21/216 | dice_sum_probability | +| 53 | Exponentiation | 11^9 = | 2357947691 | exponentiation | +| 54 | Confidence interval For sample S | The confidence interval for sample [234, 272, 289, 255, 291, 219, 225, 282, 266, 288, 259, 269, 275, 260, 262, 250, 270, 241, 287, 294, 200, 210, 298, 273] with 90% confidence is | (270.221486487058, 252.19518017960863) | confidence_interval | +| 55 | Comparing surds | Fill in the blanks 22^(1/2) _ 74^(1/6) | > | surds_comparison | +| 56 | Fibonacci Series | The Fibonacci Series of the first 14 numbers is ? | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233] | fibonacci_series | | 57 | Trigonometric Values | What is sin(90)? | 1 | 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[39, 33, 10, 49, 21, 9, 9, 20, 50, 10, 41, 12, 50, 50, 29] | The Mean is 28.8 , Standard Deviation is 262.56000000000006, Variance is 16.203703280423277 | data_summary | -| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 3m is | 113.09733552923255 m^2 | surface_area_sphere | -| 61 | Volume of Sphere | Volume of sphere with radius 38 m = | 229847.29611703884 m^3 | volume_sphere | -| 62 | nth Fibonacci number | What is the 24th Fibonacci number? | 46368 | nth_fibonacci_number | -| 63 | Profit or Loss Percent | Profit percent when CP = 173 and SP = 357 is: | 106.35838150289017 | profit_loss_percent | -| 64 | Binary to Hexidecimal | 1000110 | 0x46 | binary_to_hex | -| 65 | Multiplication of 2 complex numbers | (14-4j) * (5-12j) = | (22-188j) | multiply_complex_numbers | -| 66 | Geometric Progression | For the given GP [11, 66, 396, 2376, 14256, 85536] ,Find the value of a,common ratio,11th term value, sum upto 7th term | The value of a is 11, common ratio is 6 , 11th term is 665127936 , sum upto 7th term is 615857.0 | geometric_progression | -| 67 | Geometric Mean of N Numbers | Geometric mean of 2 numbers 61 and 67 = | (61*67)^(1/2) = 63.92964883369844 | geometric_mean | -| 68 | Harmonic Mean of N Numbers | Harmonic mean of 2 numbers 62 and 84 = | 2/((1/62) + (1/84)) = 71.34246575342466 | harmonic_mean | -| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[783.9868296299311, 482.5604033573253, 863.1029339509203, 956.7790571651393, 863.0425006034349] is: | 1803.5285106129884 | euclidian_norm | -| 70 | Angle between 2 vectors | angle between the vectors [379.65, 308.56] and [100.22, 686.67] is: | 0.74 radians | angle_btw_vectors | -| 71 | Absolute difference between two numbers | Absolute difference between numbers 18 and 79 = | 61 | absolute_difference | -| 72 | Dot Product of 2 Vectors | [14, 11, -1] . [-20, 10, 18] = | -188 | vector_dot | -| 73 | Binary 2's Complement | 2's complement of 111110 = | 10 | binary_2s_complement | -| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[68, 2, 85], [70, 19, 47], [17, 38, 6]]) is: | Matrix([[-1672/85707, 3218/85707, -169/9523], [379/85707, -1037/85707, 306/9523], [779/28569, -850/28569, 128/9523]]) | invert_matrix | -| 75 | Area of a Sector | Given radius, 18 and angle, 67. Find the area of the sector. | Area of sector = 189.43804 | sector_area | -| 76 | Mean and Median | Given the series of numbers [40, 66, 30, 32, 78, 27, 6, 35, 86, 3]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 40.3 and Arithmetic median of this series is 33.5 | mean_median | -| 77 | Determinant to 2x2 Matrix | Det([[65, 36], [75, 98]]) = | 3670 | int_matrix_22_determinant | -| 78 | Compound Interest | Compound interest for a principle amount of 9481 dollars, 5% rate of interest and for a time period of 1 year is = | 9955.05 | compound_interest | -| 79 | Decimal to Hexadecimal | Binary of 972= | 0x3cc | decimal_to_hexadeci | -| 80 | Percentage of a number | What is 92% of 17? | Required percentage = 15.64% | percentage | -| 81 | Celsius To Fahrenheit | Convert 68 degrees Celsius to degrees Fahrenheit = | 154.4 | celsius_to_fahrenheit | -| 82 | AP Term Calculation | Find the term number 58 of the AP series: 21, -42, -105 ... | -3570 | arithmetic_progression_term | -| 83 | AP Sum Calculation | Find the sum of first 6 terms of the AP series: -37, -108, -179 ... | -1287.0 | arithmetic_progression_sum | -| 84 | Converts decimal to octal | The decimal number 988 in Octal is: | 0o1734 | decimal_to_octal | -| 85 | Converts decimal to Roman Numerals | The number 1930 in Roman Numerals is: | MCMXXX | decimal_to_roman_numerals | -| 86 | Degrees to Radians | Angle 87 in radians is = | 1.52 | 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(cos(x)+7*x^(-4))/dx | -sin(x) - 28/x^5 | differentiation | -| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 12x^2 + 95x + 87 is = | 138.5 | definite_integral | -| 90 | isprime | 77 | False | is_prime | -| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 3 is = | 13891 | bcd_to_decimal | -| 92 | Complex To Polar Form | rexp(itheta) = | 21.63exp(i-2.16) | complex_to_polar | -| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={1, 3, 4, 5, 7} ,b={1, 3, 4, 7}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {1, 3, 4, 5, 7},Intersection is {1, 3, 4, 7}, a-b is {5},b-a is set(), Symmetric difference is {5} | set_operation | -| 94 | Base Conversion | Convert 6C38 from base 15 to base 10. | 23003 | base_conversion | -| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 15 and height, 67? | CSA of cylinder = 6314.6 | curved_surface_area_cylinder | -| 96 | Perimeter of Polygons | The perimeter of a 11 sided polygon with lengths of [34, 21, 86, 40, 83, 32, 4, 75, 86, 106, 48]cm is: | 615 | perimeter_of_polygons | -| 97 | Power of Powers | The 4^8^4 = 4^(8*4) = 4^32 | 18446744073709551616 | power_of_powers | -| 98 | Quotient of Powers with Same Base | The Quotient of 17^6 and 17^5 = 17^(6-5) = 17^1 | 17 | quotient_of_power_same_base | -| 99 | Quotient of Powers with Same Power | The Quotient of 45^7 and 41^7 = (45/41)^7 = 1.0975609756097562^7 | 1.9186713887127431 | quotient_of_power_same_power | -| 100 | complex Quadratic Equation | Find the roots of given Quadratic Equation 6x^2 + 8x + 2 = 0 | simplified solution : ((-0.333, -1.0)), generalized solution : ((-8 + 4)/2*6, (-8 - 4)/2*6) | complex_quadratic | -| 101 | Conditional Probability | Someone tested positive for a nasty disease which only 1.96% of population have. Test sensitivity (true positive) is equal to SN= 99.00% whereas test specificity (true negative) SP= 94.80%. What is the probability that this guy really has that disease? | 27.57% | conitionalProbability | +| 58 | Sum of Angles of Polygon | Sum of angles of polygon with 12 sides = | 1800 | sum_of_polygon_angles | +| 59 | Mean,Standard Deviation,Variance | Find the mean,standard deviation and variance for the data[29, 50, 21, 44, 44, 17, 34, 47, 7, 10, 26, 7, 6, 49, 21] | The Mean is 27.466666666666665 , Standard Deviation is 249.5822222222222, Variance is 15.798171483504735 | data_summary | +| 60 | Surface Area of Sphere | Surface area of Sphere with radius = 8m is | 804.247719318987 m^2 | surface_area_sphere | +| 61 | Volume of Sphere | Volume of sphere with radius 80 m = | 2144660.584850632 m^3 | volume_sphere | +| 62 | nth Fibonacci number | What is the 4th Fibonacci number? | 3 | nth_fibonacci_number | +| 63 | Profit or Loss Percent | Profit percent when CP = 37 and SP = 447 is: | 1108.1081081081081 | profit_loss_percent | +| 64 | Binary to Hexidecimal | 01100001 | 0x61 | binary_to_hex | +| 65 | Multiplication of 2 complex numbers | (17+7j) * (7+14j) = | (21+287j) | multiply_complex_numbers | +| 66 | Geometric Progression | For the given GP [12, 60, 300, 1500, 7500, 37500] ,Find the value of a,common ratio,8th term value, sum upto 6th term | The value of a is 12, common ratio is 5 , 8th term is 937500 , sum upto 6th term is 46872.0 | geometric_progression | +| 67 | Geometric Mean of N Numbers | Geometric mean of 2 numbers 46 and 20 = | (46*20)^(1/2) = 30.331501776206203 | geometric_mean | +| 68 | Harmonic Mean of N Numbers | Harmonic mean of 2 numbers 35 and 3 = | 2/((1/35) + (1/3)) = 5.526315789473684 | harmonic_mean | +| 69 | Euclidian norm or L2 norm of a vector | Euclidian norm or L2 norm of the vector[653.9717397584312, 689.1069921882294, 19.887404949723187, 17.33889409833278, 762.6266577725075, 189.70375690805275, 673.7332899787874] is: | 1405.2569550674714 | euclidian_norm | +| 70 | Angle between 2 vectors | angle between the vectors [638.9, 178.91, 936.86, 859.08, 27.18, 730.15, 513.96, 244.4, 698.55] and [546.02, 51.57, 631.8, 932.17, 558.58, 598.42, 537.63, 334.25, 289.47] is: | 0.43 radians | angle_btw_vectors | +| 71 | Absolute difference between two numbers | Absolute difference between numbers -98 and 73 = | 171 | absolute_difference | +| 72 | Dot Product of 2 Vectors | [11, -12, -15] . [1, -1, 3] = | -22 | vector_dot | +| 73 | Binary 2's Complement | 2's complement of 1 = | 1 | binary_2s_complement | +| 74 | Inverse of a Matrix | Inverse of Matrix Matrix([[75, 30, 13], [5, 89, 16], [74, 48, 59]]) is: | Matrix([[4483/280397, -1146/280397, -677/280397], [889/280397, 3463/280397, -1135/280397], [-6346/280397, -1380/280397, 6525/280397]]) | invert_matrix | +| 75 | Area of a Sector | Given radius, 18 and angle, 137. Find the area of the sector. | Area of sector = 387.35837 | sector_area | +| 76 | Mean and Median | Given the series of numbers [80, 93, 16, 39, 48, 88, 7, 95, 40, 2]. find the arithmatic mean and mdian of the series | Arithmetic mean of the series is 50.8 and Arithmetic median of this series is 44.0 | mean_median | +| 77 | Determinant to 2x2 Matrix | Det([[68, 11], [22, 34]]) = | 2070 | int_matrix_22_determinant | +| 78 | Compound Interest | Compound interest for a principle amount of 6075 dollars, 8% rate of interest and for a time period of 9 year is = | 12143.95 | compound_interest | +| 79 | Decimal to Hexadecimal | Binary of 716= | 0x2cc | decimal_to_hexadeci | +| 80 | Percentage of a number | What is 13% of 5? | Required percentage = 0.65% | percentage | +| 81 | Celsius To Fahrenheit | Convert -42 degrees Celsius to degrees Fahrenheit = | -43.60000000000001 | celsius_to_fahrenheit | +| 82 | AP Term Calculation | Find the term number 11 of the AP series: -17, 71, 159 ... | 863 | arithmetic_progression_term | +| 83 | AP Sum Calculation | Find the sum of first 80 terms of the AP series: 2, 86, 170 ... | 265600.0 | arithmetic_progression_sum | +| 84 | Converts decimal to octal | The decimal number 3350 in Octal is: | 0o6426 | decimal_to_octal | +| 85 | Converts decimal to Roman Numerals | The number 1203 in Roman Numerals is: | MCCIII | decimal_to_roman_numerals | +| 86 | Degrees to Radians | Angle 313 in radians is = | 5.46 | degree_to_rad | +| 87 | Radians to Degrees | Angle 1 in degrees is = | 57.3 | radian_to_deg | +| 88 | Differentiation | differentiate w.r.t x : d(cos(x)+6*x^(-2))/dx | -sin(x) - 12/x^3 | differentiation | +| 89 | Definite Integral of Quadratic Equation | The definite integral within limits 0 to 1 of the equation 24x^2 + 13x + 13 is = | 27.5 | definite_integral | +| 90 | isprime | 84 | False | is_prime | +| 91 | Binary Coded Decimal to Integer | Integer of Binary Coded Decimal 1 is = | 5458 | bcd_to_decimal | +| 92 | Complex To Polar Form | rexp(itheta) = | 12.21exp(i0.61) | complex_to_polar | +| 93 | Union,Intersection,Difference of Two Sets | Given the two sets a={10, 3, 4, 7} ,b={2, 5, 6, 7}.Find the Union,intersection,a-b,b-a and symmetric difference | Union is {2, 3, 4, 5, 6, 7, 10},Intersection is {7}, a-b is {10, 3, 4},b-a is {2, 5, 6}, Symmetric difference is {2, 3, 4, 5, 6, 10} | set_operation | +| 94 | Base Conversion | Convert 44854 from base 10 to base 2. | 1010111100110110 | base_conversion | +| 95 | Curved surface area of a cylinder | What is the curved surface area of a cylinder of radius, 1 and height, 20? | CSA of cylinder = 125.66 | curved_surface_area_cylinder | +| 96 | Perimeter of Polygons | The perimeter of a 9 sided polygon with lengths of [35, 114, 106, 106, 66, 53, 18, 96, 27]cm is: | 621 | perimeter_of_polygons | +| 97 | Power of Powers | The 15^7^6 = 15^(7*6) = 15^42 | 24878997722115027320114677422679960727691650390625 | power_of_powers | +| 98 | Quotient of Powers with Same Base | The Quotient of 47^3 and 47^10 = 47^(3-10) = 47^-7 | 1.973853856267171e-12 | quotient_of_power_same_base | +| 99 | Quotient of Powers with Same Power | The Quotient of 34^1 and 17^1 = (34/17)^1 = 2.0^1 | 2.0 | quotient_of_power_same_power | +| 100 | complex Quadratic Equation | Find the roots of given Quadratic Equation 4x^2 + 8x + 3 = 0 | simplified solution : ((-0.5, -1.5)), generalized solution : ((-8 + 4)/2*4, (-8 - 4)/2*4) | complex_quadratic | +| 101 | Conditional Probability | Someone tested positive for a nasty disease which only 1.61% of population have. Test sensitivity (true positive) is equal to SN= 93.28% whereas test specificity (true negative) SP= 92.26%. What is the probability that this guy really has that disease? | 16.47% | conditionalProbability | diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index b565e30..bf856ee 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -105,4 +105,4 @@ from .power_of_powers import * from .quotient_of_power_same_base import * from .quotient_of_power_same_power import * from .complex_quadratic import * -from .conitionalProbability import * +from .conditionalProbability import * diff --git a/mathgenerator/funcs/conitionalProbability.py b/mathgenerator/funcs/conditionalProbability.py similarity index 100% rename from mathgenerator/funcs/conitionalProbability.py rename to mathgenerator/funcs/conditionalProbability.py From 63e2492bc2464b3c34bdd224f9a54fba74e3ee87 Mon Sep 17 00:00:00 2001 From: Vhizux Date: Fri, 23 Oct 2020 15:34:24 +0200 Subject: [PATCH 4/6] fixing linter errors --- .vscode/settings.json | 5 ++++ mathgenerator/funcs/conditionalProbability.py | 26 +++++++++---------- 2 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9fadd3a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "python.linting.pylintEnabled": false, + "python.linting.flake8Enabled": true, + "python.linting.enabled": true +} \ No newline at end of file diff --git a/mathgenerator/funcs/conditionalProbability.py b/mathgenerator/funcs/conditionalProbability.py index b7182b6..8b768c9 100644 --- a/mathgenerator/funcs/conditionalProbability.py +++ b/mathgenerator/funcs/conditionalProbability.py @@ -1,25 +1,25 @@ from .__init__ import * + def conditionalProbFunc(): - P_disease= round(2.*random.random(), 2) - true_positive= round(random.random()+float(random.randint(90,99)), 2) - true_negative= round(random.random()+float(random.randint(90,99)), 2) + P_disease = round(2. * random.random(), 2) + true_positive = round(random.random() + float(random.randint(90, 99)), 2) + true_negative = round(random.random() + float(random.randint(90, 99)), 2) def BayesFormula(P_disease, true_positive, true_negative): - P_notDisease= 100.-P_disease - false_positive= 100.-true_negative - false_negative= 100.-false_positive - P_plus= (P_disease)*(true_positive)+(P_notDisease)*(false_positive) - P_disease_plus=( (true_positive)*(100*P_disease) )/P_plus + P_notDisease = 100. - P_disease + false_positive = 100. - true_negative + P_plus = (P_disease) * (true_positive) + (P_notDisease) * (false_positive) + P_disease_plus = ((true_positive) * (100 * P_disease)) / P_plus return P_disease_plus - problem= "Someone tested positive for a nasty disease which only {0:.2f}% of population have. " \ + problem = "Someone tested positive for a nasty disease which only {0:.2f}% of population have. " \ "Test sensitivity (true positive) is equal to SN= {1:.2f}% whereas test specificity (true negative) SP= {2:.2f}%. " \ - "What is the probability that this guy really has that disease?".format(P_disease, true_positive, true_negative ) - - answer=str(round(BayesFormula(P_disease, true_positive, true_negative), 2))+"%" + "What is the probability that this guy really has that disease?".format(P_disease, true_positive, true_negative) + answer = str(round(BayesFormula(P_disease, true_positive, true_negative), 2)) + "%" return problem, answer -conditionalProb= Generator("Conditional Probability", 101, "P(A|+)=", "c", conditionalProbFunc) \ No newline at end of file + +conditionalProb = Generator("Conditional Probability", 101, "P(A|+)=", "c", conditionalProbFunc) From 7d3c938e0f8e3f65ad797d97eaa04e15ad35af74 Mon Sep 17 00:00:00 2001 From: Vhizux Date: Fri, 23 Oct 2020 15:38:02 +0200 Subject: [PATCH 5/6] fixing linter errors --- mathgenerator/funcs/conditionalProbability.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/conditionalProbability.py b/mathgenerator/funcs/conditionalProbability.py index 8b768c9..88feb0b 100644 --- a/mathgenerator/funcs/conditionalProbability.py +++ b/mathgenerator/funcs/conditionalProbability.py @@ -15,8 +15,8 @@ def conditionalProbFunc(): return P_disease_plus problem = "Someone tested positive for a nasty disease which only {0:.2f}% of population have. " \ - "Test sensitivity (true positive) is equal to SN= {1:.2f}% whereas test specificity (true negative) SP= {2:.2f}%. " \ - "What is the probability that this guy really has that disease?".format(P_disease, true_positive, true_negative) + "Test sensitivity (true positive) is equal to SN= {1:.2f}% whereas test specificity (true negative) SP= {2:.2f}%. " \ + "What is the probability that this guy really has that disease?".format(P_disease, true_positive, true_negative) answer = str(round(BayesFormula(P_disease, true_positive, true_negative), 2)) + "%" return problem, answer From b7b2115330583f6aeed337e42f8feac05f1ab0fd Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Fri, 23 Oct 2020 13:53:15 -0400 Subject: [PATCH 6/6] Delete settings.json --- .vscode/settings.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9fadd3a..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "python.linting.pylintEnabled": false, - "python.linting.flake8Enabled": true, - "python.linting.enabled": true -} \ No newline at end of file