mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
Merge branch 'master' into master
This commit is contained in:
@@ -4,3 +4,4 @@ flake8
|
|||||||
autopep8
|
autopep8
|
||||||
sympy
|
sympy
|
||||||
numpy
|
numpy
|
||||||
|
scipy
|
||||||
|
|||||||
43
mathgen.py
43
mathgen.py
@@ -1,43 +0,0 @@
|
|||||||
import random
|
|
||||||
|
|
||||||
|
|
||||||
genList = []
|
|
||||||
|
|
||||||
|
|
||||||
# || Generator class
|
|
||||||
class Generator:
|
|
||||||
def __init__(self, title, id, generalProb, generalSol, func):
|
|
||||||
self.title = title
|
|
||||||
self.id = id
|
|
||||||
self.generalProb = generalProb
|
|
||||||
self.generalSol = generalSol
|
|
||||||
self.func = func
|
|
||||||
genList.append([id, title, self])
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return str(self.id) + " " + self.title + " " + self.generalProb + " " + self.generalSol
|
|
||||||
|
|
||||||
def __call__(self, **kwargs):
|
|
||||||
return self.func(**kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
def isprime(max_a=100):
|
|
||||||
a = random.randint(2, max_a)
|
|
||||||
problem = a
|
|
||||||
if a == 2:
|
|
||||||
solution = True
|
|
||||||
return (problem, solution)
|
|
||||||
if a % 2 == 0:
|
|
||||||
solution = False
|
|
||||||
return (problem, solution)
|
|
||||||
for i in range(3, a // 2 + 1, 2):
|
|
||||||
if a % i == 0:
|
|
||||||
solution = False
|
|
||||||
return (problem, solution)
|
|
||||||
solution = True
|
|
||||||
return (problem, solution)
|
|
||||||
|
|
||||||
|
|
||||||
is_prime = Generator('isprime', 74, 'a any positive integer',
|
|
||||||
'True/False', isprime)
|
|
||||||
print(is_prime.func)
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
import scipy
|
||||||
from scipy.integrate import quad
|
from scipy.integrate import quad
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,3 +16,7 @@ def isprime(max_a=100):
|
|||||||
return (problem, solution)
|
return (problem, solution)
|
||||||
solution = True
|
solution = True
|
||||||
return (problem, solution)
|
return (problem, solution)
|
||||||
|
|
||||||
|
|
||||||
|
is_prime = Generator('isprime', 90, 'a any positive integer',
|
||||||
|
'True/False', isprime)
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
import random
|
|
||||||
import math
|
|
||||||
import fractions
|
|
||||||
from .funcs import *
|
from .funcs import *
|
||||||
from .__init__ import getGenList
|
from .__init__ import getGenList
|
||||||
import scipy
|
|
||||||
|
|
||||||
genList = getGenList()
|
genList = getGenList()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user