From 820775e87ae2761c334b97ae3ff8c6f7917cde16 Mon Sep 17 00:00:00 2001 From: BiscuitCandy <70342294+BiscuitCandy@users.noreply.github.com> Date: Fri, 8 Oct 2021 18:58:10 -0700 Subject: [PATCH 1/8] added area of circle given center and a point --- .../area_of_circle_given_center_and_point.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py diff --git a/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py b/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py new file mode 100644 index 0000000..e928fa7 --- /dev/null +++ b/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py @@ -0,0 +1,27 @@ +from .__init__ import * +from math import cos, sin, pi + + +def gen_func(maxCoordinate = 10, maxRadius=10, format='string'): + r = random.randint(0, maxRadius) + center_x = random.randint(-maxCoordinate, maxCoordinate) + center_y = random.randint(-maxCoordinate, maxCoordinate) + + angle = random.choice([0, pi//6, pi//2, pi, pi+pi//6, 3*pi//2]) + + point_x = center_x + round(r*cos(angle), 2) + point_y = center_y + round(r*sin(angle), 2) + + area = round(pi * r * r, 2) + + if format == 'string': + problem = f"Area of circle with center ({center_x},{center_y}) and passing through ({point_x}, {point_y}) is" + return problem, str(area) + elif format == 'latex': + return "Latex unavailable" + else: + return center_x, center_y, point_x, point_y, area + + +area_of_circle = Generator("Area of Circle given center and a point on circle", 789, gen_func, + ["maxCoordinate = 10", "maxRadius=10"]) \ No newline at end of file From 9ef063af17ac77bcd3da70d2073cbf7ed518a889 Mon Sep 17 00:00:00 2001 From: BiscuitCandy <70342294+BiscuitCandy@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:03:05 -0700 Subject: [PATCH 2/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0e3812e..8722560 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,7 @@ This creates the pdf `ws.pdf` in your current directory | 112 | [Area of Circle](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/area_of_circle.py) | Area of circle with radius 3 | 28.285714285714285 | area_of_circle | `maxRadius=100` | | 113 | [Volume of frustum](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_frustum.py) | Volume of frustum with height = 23m and r1 = 19m is and r2 = 19m is | 15679.0 m^3 | volume_frustum | `maxR1=20` `maxR2=20` `maxHeight=50` `unit='m'` | | 114 | [Equation of line from two points](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/equation_of_line_from_two_points.py) | What is the equation of the line between points (-19,-11) and (-4,20) in slope-intercept form? | 15y = 31x + 424 | equation_of_line_from_two_points | `maxCoordinate=20` `minCoordinate=-20` | +| 115 | [Area of circle given center and a point on it](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py) | Area of circle with center (2,9) and passing through (12.0, 9.0) is? | 314.16 | area_of_circle_given_center_and_point | `maxCoordinate=10` `maxRadius=10` | ## misc | Id | Skill | Example problem | Example Solution | Function Name | Kwargs | |------|-------|-----------------|------------------|---------------|--------| From bfa2640f2601921c4c5618fff34668bb9daeb446 Mon Sep 17 00:00:00 2001 From: BiscuitCandy <70342294+BiscuitCandy@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:06:22 -0700 Subject: [PATCH 3/8] added area_of_circle_given_center_and_point --- .../funcs/geometry/area_of_circle_given_center_and_point.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py b/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py index e928fa7..eb4a555 100644 --- a/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py +++ b/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py @@ -23,5 +23,5 @@ def gen_func(maxCoordinate = 10, maxRadius=10, format='string'): return center_x, center_y, point_x, point_y, area -area_of_circle = Generator("Area of Circle given center and a point on circle", 789, gen_func, - ["maxCoordinate = 10", "maxRadius=10"]) \ No newline at end of file +area_of_circle = Generator("Area of Circle given center and a point on circle", 115, gen_func, + ["maxCoordinate = 10", "maxRadius=10"]) From 88f64bf897b7eed70973d0dfc6ca2c5006cbd7ba Mon Sep 17 00:00:00 2001 From: BiscuitCandy <70342294+BiscuitCandy@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:16:59 -0700 Subject: [PATCH 4/8] added factors --- mathgenerator/funcs/misc/Factors.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 mathgenerator/funcs/misc/Factors.py diff --git a/mathgenerator/funcs/misc/Factors.py b/mathgenerator/funcs/misc/Factors.py new file mode 100644 index 0000000..8781bc9 --- /dev/null +++ b/mathgenerator/funcs/misc/Factors.py @@ -0,0 +1,31 @@ +from .__init__ import * + + +def gen_func(maxVal=1000, format='string'): + n = x = random.randint(1, maxVal) + + factors = [] + + for i in range(1, int(n**0.5) + 1) : + if i**2 == n : + factors.append(i) + elif n%i ==0 : + factors.append(i) + factors.append(n//i) + else : + pass + + factors.sort() + + if format == 'string': + problem = f"Factors of {n} = " + solution = factors + return problem, solution + elif format == 'latex': + return "Latex unavailable" + else: + return n, factors + + +common_factors = Generator("Factors", 116, gen_func, + ["maxVal=1000"]) \ No newline at end of file From ed57e6c22eb83e68ee151ae797f75ecc2fec996f Mon Sep 17 00:00:00 2001 From: BiscuitCandy <70342294+BiscuitCandy@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:21:04 -0700 Subject: [PATCH 5/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8722560..5e77ecf 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,7 @@ This creates the pdf `ws.pdf` in your current directory | 102 | [Minute to Hour conversion](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/minutes_to_hours.py) | Convert 525 minutes to Hours & Minutes | 8 hours and 45 minutes | minutes_to_hours | `maxMinutes=999` | | 106 | [signum function](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/signum_function.py) | signum of 17 is = | 1 | signum_function | `min=-999` `max=999` | | 109 | [Binomial distribution](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/binomial_distribution.py) | A manufacturer of metal pistons finds that, on average, 32.13% of the pistons they manufacture are rejected because they are incorrectly sized. What is the probability that a batch of 14 pistons will contain no more than 1 rejected pistons? | 3.36 | binomial_distribution | `` | +| 116 | [Factors](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/Factors.py) | Factors of 820 = | [1, 2, 4, 5, 10, 20, 41, 82, 164, 205, 410, 820] | Factors | `maxVal=1000` | ## statistics | Id | Skill | Example problem | Example Solution | Function Name | Kwargs | |------|-------|-----------------|------------------|---------------|--------| From ce5b3168bdcb39ef614cb73bdaf94824122d6bdb Mon Sep 17 00:00:00 2001 From: BiscuitCandy <70342294+BiscuitCandy@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:38:50 -0700 Subject: [PATCH 6/8] added volume Hemisphere --- .../funcs/geometry/volume_hemisphere.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 mathgenerator/funcs/geometry/volume_hemisphere.py diff --git a/mathgenerator/funcs/geometry/volume_hemisphere.py b/mathgenerator/funcs/geometry/volume_hemisphere.py new file mode 100644 index 0000000..95b612a --- /dev/null +++ b/mathgenerator/funcs/geometry/volume_hemisphere.py @@ -0,0 +1,19 @@ +from .__init__ import * + + +def gen_func(maxRadius=100, format='string'): + r = random.randint(1, maxRadius) + ans = round((2 * math.pi / 3) * r**3, 3) + + if format == 'string': + problem = f"Volume of hemisphere with radius {r} m = " + solution = f"{ans} m^3" + return problem, solution + elif format == 'latex': + return "Latex unavailable" + else: + return r, ans + + +volume_sphere = Generator("Volume of Hemisphere", 61, gen_func, + ["maxRadius=100"]) \ No newline at end of file From 4c336bd7f707ac69d74d21f8fc31b81df3094348 Mon Sep 17 00:00:00 2001 From: BiscuitCandy <70342294+BiscuitCandy@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:39:40 -0700 Subject: [PATCH 7/8] Update volume_hemisphere.py --- mathgenerator/funcs/geometry/volume_hemisphere.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/geometry/volume_hemisphere.py b/mathgenerator/funcs/geometry/volume_hemisphere.py index 95b612a..4b4bb2d 100644 --- a/mathgenerator/funcs/geometry/volume_hemisphere.py +++ b/mathgenerator/funcs/geometry/volume_hemisphere.py @@ -15,5 +15,5 @@ def gen_func(maxRadius=100, format='string'): return r, ans -volume_sphere = Generator("Volume of Hemisphere", 61, gen_func, - ["maxRadius=100"]) \ No newline at end of file +volume_sphere = Generator("Volume of Hemisphere", 117, gen_func, + ["maxRadius=100"]) From a619caaa18e2ad0fd3c9a3260d1bb06dff2004e4 Mon Sep 17 00:00:00 2001 From: BiscuitCandy <70342294+BiscuitCandy@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:41:50 -0700 Subject: [PATCH 8/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5e77ecf..815a41c 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,7 @@ This creates the pdf `ws.pdf` in your current directory | 113 | [Volume of frustum](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_frustum.py) | Volume of frustum with height = 23m and r1 = 19m is and r2 = 19m is | 15679.0 m^3 | volume_frustum | `maxR1=20` `maxR2=20` `maxHeight=50` `unit='m'` | | 114 | [Equation of line from two points](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/equation_of_line_from_two_points.py) | What is the equation of the line between points (-19,-11) and (-4,20) in slope-intercept form? | 15y = 31x + 424 | equation_of_line_from_two_points | `maxCoordinate=20` `minCoordinate=-20` | | 115 | [Area of circle given center and a point on it](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/area_of_circle_given_center_and_point.py) | Area of circle with center (2,9) and passing through (12.0, 9.0) is? | 314.16 | area_of_circle_given_center_and_point | `maxCoordinate=10` `maxRadius=10` | +| 117 | [Volume of Hemisphere](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/geometry/volume_hemisphere.py) | Volume of hemisphere with radius 6 m = | 452.389 m^3 | volume_hemisphere | `maxRadius=100` | ## misc | Id | Skill | Example problem | Example Solution | Function Name | Kwargs | |------|-------|-----------------|------------------|---------------|--------|