diff --git a/README.md b/README.md index 72380d0..5dfc913 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,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 233 minutes to Hours & Minutes | 3 hours and 53 minutes | minutes_to_hours | `maxMinutes=999` | | 106 | [signum function](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/signum_function.py) | signum of -103 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, 31.73% of the pistons they manufacture are rejected because they are incorrectly sized. What is the probability that a batch of 11 pistons will contain no more than 5 rejected pistons? | 90.06 | binomial_distribution | `` | +| 115 | [Product of scientific notations](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/misc/product_of_scientific_notations.py) | Product of scientific notations: 5.12x10^93 6.28x10^73 = | 3.22x10^167 | product_of_scientific_notations | `minExpVal=-100` `maxExpVal=100` | ## statistics | Id | Skill | Example problem | Example Solution | Function Name | Kwargs | |------|-------|-----------------|------------------|---------------|--------| diff --git a/mathgenerator/funcs/misc/__init__.py b/mathgenerator/funcs/misc/__init__.py index 41f52e3..8aa17b6 100644 --- a/mathgenerator/funcs/misc/__init__.py +++ b/mathgenerator/funcs/misc/__init__.py @@ -25,3 +25,4 @@ from .quotient_of_power_same_power import * from .set_operation import * from .signum_function import * from .surds_comparison import * +from .scientific_notation_multiplication import * \ No newline at end of file diff --git a/mathgenerator/funcs/misc/product_of_scientific_notations b/mathgenerator/funcs/misc/product_of_scientific_notations new file mode 100644 index 0000000..0c1ecd4 --- /dev/null +++ b/mathgenerator/funcs/misc/product_of_scientific_notations @@ -0,0 +1,25 @@ +from .__init__ import * + + +def gen_func(minExpVal=-100, maxExpVal=100, format='string'): + a = [round(random.uniform(1,10), 2), random.randint(minExpVal, maxExpVal)] + b = [round(random.uniform(1,10), 2), random.randint(minExpVal, maxExpVal)] + c = [a[0]*b[0], a[1]+b[1]] + + if c[0] >= 10: + c[0] /= 10 + c[1] += 1 + + if format == 'string': + problem = "Product of scientific notations: " + \ + str(a[0])+"x10^"+str(a[1]) + " " + str(b[0])+"x10^"+str(b[1]) + " = " + solution = str(round(c[0], 2))+"x10^"+str(c[1]) + return problem, solution + elif format == 'latex': + return "Latex unavailable" + else: + return a, b, c + + +product_of_scientific_notations = Generator("Product of scientific notaions", 115, gen_func, + ["minExpVal=-100", "maxExpVal=100"])