Merge pull request #365 from jsun1590/main

Added generator for multiplying 2 numbers in scientific notation form
This commit is contained in:
Luke Weiler
2021-10-10 21:03:40 -04:00
committed by GitHub
3 changed files with 27 additions and 0 deletions

View File

@@ -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 and 6.28x10^73 = | 3.22x10^167 | product_of_scientific_notations | `minExpVal=-100` `maxExpVal=100` |
## statistics
| Id | Skill | Example problem | Example Solution | Function Name | Kwargs |
|------|-------|-----------------|------------------|---------------|--------|

View File

@@ -25,3 +25,4 @@ from .quotient_of_power_same_power import *
from .set_operation import *
from .signum_function import *
from .surds_comparison import *
from .product_of_scientific_notations import *

View File

@@ -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]) + " and " + 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"])