def DeBroglieErr(voltage,voltageErr,m = Me): v = Symbol("v",positive = True) # initialize symbols h = Symbol("h",positive = True) c = Symbol("c",positive = True) m = Symbol("m",positive = True) from sympy import sqrt # initialize symbols waveLen = h/(sqrt(2*m*v)*c) # get the error function func = er.getRelError([v],waveLen) # calculate error for each point error = func(voltage,voltageErr) return error
def BraggErr(Diam,DiamErr,d,L = L,r = r): v = Symbol("v",positive = True) # initialize symbols D = Symbol("D",positive = True) L = Symbol("L",positive = True) from sympy import sqrt,atan,sin,pprint # initialize symbols a = sqrt(r**2-D**2/4) x = (L/(L-(r-a))-1)*D/2 #based on geometric calculations that can bee seen in my lab notebook DCorect = D+2*x theta = DCorect/(2*L)/2 waveLen = 2*d*theta # get the error function func = er.getRelError([D,L],waveLen) # calculate error for each point error = func(voltage,130,voltageErr,2) return error