def parallel_forms_reliability(): """check whether the same equality and similarity of the test on different parallel forms. """ X1 = np.array([4, 5, 3, 6, 7, 5, 6, 4, 3, 3]) X2 = np.array([5, 6, 5, 6, 7, 6, 7, 8, 7, 7]) r = coefficient(X1, X2) return r
def __init__(self, coeff=None, generators=() ): if not isinstance(coeff,coefficient.coefficient): coeff = coefficient.coefficient(coeff) if type(generators) is str: generators = (generators,) generators = tuple(generators) for i in generators: assert re.match(monomial.generatorRE,i) self.coefficient = coeff.clean() self.generators = generators
def __call__(self,poly): answer = coefficient.coefficient(0) for mono in poly: if self.degree() != mono.degree(): answer = answer + mono #TODO: check impact of this choice of order of condition checks on running time elif self.leftMonomial == mono.submonomial(0,self.leftMonomial.degree()) \ and self.rightMonomial == mono.submonomial(self.leftMonomial.degree() + self.relation.degree(),mono.degree())\ and self.relation.doesAct(mono.submonomial(self.leftMonomial.degree(),self.leftMonomial.degree()+self.relation.degree())): answer = answer + mono.coefficient * self.leftMonomial * self.relation.lowerOrderTerms * self.rightMonomial else: answer = answer + mono return answer.clean()
def __init__(self, monomials=(), coeff=coefficient.coefficient(1)): if type(monomials) not in [list,tuple]: monomials = (monomials,) monomials= tuple(monomials) self.coefficient = coeff index = 0 while index < len(monomials): if type(monomials[index]) in [coefficient.coefficient,int,float]: monomials = monomials[:index] + (monomial.monomial(monomials[index]),) + monomials[index+1:] index +=1 for i in monomials: self.coefficient = self.coefficient * i.coefficient self.monomials = tuple( [x.withCoefficientOf1() for x in monomials])
def __init__(self,*args,**kwargs): relationClass.__init__(self,args,kwargs) self.coefficient = coefficient.coefficient(1)
def retest_reliablity(): """check whether a test is reliable in different period""" X1 = np.array([54, 67, 67, 83, 87, 89, 84, 90, 98, 65]) X2 = np.array([56, 77, 87, 89, 89, 90, 87, 92, 99, 76]) r = coefficient(X1, X2) return r
def __init__(self, leftHandRepresentation ,rightHandRepresentation): self.leftHandRepresentation = leftHandRepresentation self.rightHandRepresentation = rightHandRepresentation self.coefficient = coefficient.coefficient(1)
import cos, sin, coefficient, songs import matplotlib.pyplot as plt omega = coefficient.omega fourier = coefficient.coefficient() the_fox = songs.the_fox basehunter_dota = songs.basehunter_dota thrift_shop = songs.thrift_shop beautiful_girls = songs.beautiful_girls wrecking_ball = songs.wrecking_ball unknown = songs.unknown_song current = the_fox def plot(): x = 0.01 x_values = [] while x <= 10.0: x_values.append(x) x += 0.01 # x*sin(x) and fourier series of it: y_fourier = [] for x in x_values: f_x = fourier[0] / 2 for n in range(1, 16): f_x += fourier[n * 2 - 1] * cos.number(n * omega * x) + fourier[n * 2] * sin.number(n * omega * x)