def calculateInverseProblem(self):
        try :
            phi1 = math.radians(ast.literal_eval(self.ui.lineEdit_389.text()) + ast.literal_eval(
            self.ui.lineEdit_390.text()) / 60 + ast.literal_eval(self.ui.lineEdit_387.text()) / 3600)
            lambda1 = math.radians(ast.literal_eval(self.ui.lineEdit_391.text()) + ast.literal_eval(
            self.ui.lineEdit_386.text()) / 60 + ast.literal_eval(self.ui.lineEdit_388.text()) / 3600)
            phi2 = math.radians(ast.literal_eval(self.ui.lineEdit_402.text()) + ast.literal_eval(
            self.ui.lineEdit_400.text()) / 60 + ast.literal_eval(self.ui.lineEdit_403.text()) / 3600)
            lambda2 = math.radians(ast.literal_eval(self.ui.lineEdit_399.text()) + ast.literal_eval(
            self.ui.lineEdit_404.text()) / 60 + ast.literal_eval(self.ui.lineEdit_401.text()) / 3600)

            a = 6378249.2
            b= 6356515
            R = (2*a+b)/3

            deltaLambda = lambda2 - lambda1
            distanceD12 = math.acos( (math.sin(phi1)) * (math.sin(phi2)) + (math.cos(phi1)) * (math.cos(phi2)) * (math.cos(deltaLambda) ) )
            distanceD12 = R * distanceD12
            azimutDepart = math.degrees( mpmath.acot(
                ( ( (math.tan(phi2)) * math.cos(phi1) ) / math.sin(deltaLambda)) -
            ((math.sin(phi1)) * (mpmath.cot(deltaLambda))) ) )
            azimutArrive = math.degrees(  mpmath.acot( - ( ( (math.tan(phi1)) * math.cos(phi2) ) / (math.sin(deltaLambda)) -
            ( (math.sin(phi2)) * (mpmath.cot(deltaLambda) ) ) ) ) )
            azimutDepart = UIFunctions.degdecimal2dms(azimutDepart)
            azimutArrive = UIFunctions.degdecimal2dms(azimutArrive)
            self.ui.lineEdit_393.setText(str("%.4f" % distanceD12))
            self.ui.lineEdit_395.setText(str("%.f" % azimutDepart[0]))
            self.ui.lineEdit_392.setText(str("%.f" % azimutDepart[1]))
            self.ui.lineEdit_394.setText(str("%.4f" % azimutDepart[2]))
            self.ui.lineEdit_398.setText(str("%.f" % azimutArrive[0]))
            self.ui.lineEdit_396.setText(str("%.f" % azimutArrive[1]))
            self.ui.lineEdit_397.setText(str("%.4f" % azimutArrive[2]))
        except Exception :
            UIFunctions.errorMsg(self,"Erreur\nressayer une autre fois ")
Exemple #2
0
def fuckin_freud(l, w, R, beta, dims):

    a, b, c, d = dims

    theta_input = float(atan(l / (R - w / 2)))
    theta_output_ackerman = float(acot(cot(theta_input) + w / l))

    def freudenstein_eq(theta_input):

        theta_input_freud = (pi / 2) - beta - theta_input

        J1 = d / a
        J2 = d / c
        J3 = (a**2 - b**2 + c**2 + d**2) / (2 * a * c)

        A = J3 - J1 + (1 - J2) * cos(theta_input_freud)
        B = -2 * sin(theta_input_freud)
        C = J1 + J3 - (1 + J2) * cos(theta_input_freud)

        theta_output_freud = float(2 * atan(
            (-B - sqrt(B**2 - 4 * A * C)) / (2 * A)))

        return (pi / 2) + beta - theta_output_freud

    theta_output_freud = freudenstein_eq(theta_input)
    error = (theta_output_freud - theta_output_ackerman)

    return error, theta_input, theta_output_ackerman, theta_output_freud
Exemple #3
0
    def __define_simga_rdc(self):
        """ function to define simga_rdc """
        theta_p = mpmath.acot((self.__section.al + self.__z * \
                self.__cot_theta - self.__section.cnom) / (2 * self.__z))
        sin_theta_p = math.sin(theta_p)

        self.sigma_rdc = self.__vedu / (self.__b * self.__section.al * \
                sin_theta_p**2)
Exemple #4
0
 def getswivel(self): 
     if self.proj[0] == 0:
         return 90
     if self.proj[0]!=0 and self.proj[2]<0:
         theta = math.degrees(mpmath.acot(-self.proj[0]/self.proj[2]))
         if theta>=0:
             return theta-90
         else:
             return theta+90
Exemple #5
0
def fpaa_oracle(qc, q, n, clauses, oracle, index):
    theta = math.pi / clauses
    delta = pow(2, -0.5 * pow(n, 2)) / 2
    _lambda = pow(math.sin(theta), 2) / 4 + pow(1 / 2 - math.cos(theta) / 2, 2)
    L = int(math.ceil(2 * math.log(2 / delta) / math.sqrt(_lambda)))
    gamma = mpmath.cos(mpmath.acos(1 / delta) / L)

    qc.barrier()
    A_matrix(qc, q, n, clauses, oracle, theta)
    qc.barrier()

    for k in range(1, L):
        alpha = abs(2 * mpmath.acot(
            mpmath.tan(2 * math.pi *
                       (k) / L) * mpmath.sqrt(1 - 1 / pow(gamma, -2))))
        beta = -abs(2 * mpmath.acot(
            mpmath.tan(2 * math.pi *
                       (L -
                        (k - 1)) / L) * mpmath.sqrt(1 - 1 / pow(gamma, -2))))

        qc.h(q[n])
        U_matrix(qc, q, n, beta)
        qc.h(q[n])

        Adgr_matrix(qc, q, n, clauses, oracle, theta)

        U_matrix(qc, q, n, alpha)

        A_matrix(qc, q, n, clauses, oracle, theta)
        qc.barrier()
    qc.h(q[n])
    qc.barrier()

    qc.x(q[n])
    qc.x(q[n + 1])
    qc.h(q[n + 1])
    qc.cx(q[n], q[n + 1])
    qc.h(q[n + 1])
    qc.x(q[n + 1])
    qc.x(q[n])
	def calculate_dihedral_from_vertices(self,vertices):
		'''
		class method that returns the dihedral angle formed by three co-embarking vectors whose 
		vertices are a,b, c, and d. ab is the edge over which the dehedral of interest is formed.
		'''
		a = np.array(vertices[0])
		b = np.array(vertices[1])
		c = np.array(vertices[2])
		d = np.array(vertices[3])
		u = b-a
		v = c-a
		w = d-a
		u,v,w = self.shift_rays(u,v,w)
		return(float(trig.acot(((np.dot(u,u)**0.5)*np.dot(v,w)-((np.dot(u,v)*np.dot(u,w))/(np.dot(u,u)**0.5)))/(np.dot(u,np.cross(v,w))))))
    def calculateDirecteProblem(self):
        try:
            a = 6378249.2
            b = 6356515
            R = (2 * a + b) / 3

            phi1 = math.radians(ast.literal_eval(self.ui.lineEdit_184.text()) + ast.literal_eval(
                self.ui.lineEdit_185.text()) / 60 + ast.literal_eval(self.ui.lineEdit_182.text()) / 3600)
            lambda1 = math.radians(ast.literal_eval(self.ui.lineEdit_186.text()) + ast.literal_eval(
                self.ui.lineEdit_181.text()) / 60 + ast.literal_eval(self.ui.lineEdit_183.text()) / 3600)
            azimut = math.radians(ast.literal_eval(self.ui.lineEdit_190.text()) + ast.literal_eval(
                self.ui.lineEdit_187.text()) / 60 + ast.literal_eval(self.ui.lineEdit_189.text()) / 3600)
            distanceD12 = (ast.literal_eval(self.ui.lineEdit_188.text()))/R

            phi2 = math.degrees(math.asin(
                (math.sin(phi1)) * (math.cos(distanceD12)) + (math.cos(phi1)) * (math.sin(distanceD12)) * (
                    math.cos(azimut))))
            lambda2 =(math.degrees(lambda1)) + (math.degrees(mpmath.acot(((mpmath.cot(distanceD12)) * math.sin(
                ((math.pi / 2) - phi1)) - (math.cos((math.pi / 2) - phi1)) * math.cos(azimut)) * (1 / (math.sin(azimut))))))
            azimutRetour = math.degrees(mpmath.acot(
                ( (math.cos(distanceD12)) * (math.cos(azimut)) - (math.tan(phi1)) * (math.sin(distanceD12)) ) * (1 / (math.sin(azimut))) ))
            phi2 = UIFunctions.degdecimal2dms(phi2)
            lambda2 = UIFunctions.degdecimal2dms(lambda2)
            azimutRetour = UIFunctions.degdecimal2dms(azimutRetour)
            self.ui.lineEdit_192.setText(str("%.f" % phi2[0]))
            self.ui.lineEdit_198.setText(str("%.f" % phi2[1]))
            self.ui.lineEdit_191.setText(str("%.4f" % phi2[2]))

            self.ui.lineEdit_197.setText(str("%.f" % lambda2[0]))
            self.ui.lineEdit_199.setText(str("%.f" % lambda2[1]))
            self.ui.lineEdit_194.setText(str("%.4f" % lambda2[2]))

            self.ui.lineEdit_195.setText(str("%.f" % azimutRetour[0]))
            self.ui.lineEdit_196.setText(str("%.f" % azimutRetour[1]))
            self.ui.lineEdit_193.setText(str("%.4f" % azimutRetour[2]))
        except Exception :
            UIFunctions.errorMsg(self,"Erreur\nressayer une autre fois ")
Exemple #8
0
    def run(self, context):
        if isinstance(self.body, SinOperation):
            return math.asin(self.body.body.run(context))
        if isinstance(self.body, CosOperation):
            return math.acos(self.body.body.run(context))
        if isinstance(self.body, TanOperation):
            return math.atan(self.body.body.run(context))
        if isinstance(self.body, SecOperation):
            return mpmath.asec(self.body.body.run(context))
        if isinstance(self.body, CscOperation):
            return mpmath.acsc(self.body.body.run(context))
        if isinstance(self.body, CotOperation):
            return mpmath.acot(self.body.body.run(context))

        raise Exception("Unsupported inversion operation.")
Exemple #9
0
 def eval(self, z):
     return mpmath.acot(z)
Exemple #10
0
 def eval(self, z):
     return mpmath.acot(z)
Exemple #11
0
 #
 'sin': ['primitive', [lambda x, y: mp.sin(x), None]],
 'cos': ['primitive', [lambda x, y: mp.cos(x), None]],
 'tan': ['primitive', [lambda x, y: mp.tan(x), None]],
 'sinpi': ['primitive', [lambda x, y: mp.sinpi(x), None]],  #sin(x * pi) 
 'cospi': ['primitive', [lambda x, y: mp.cospi(x), None]],
 'sec': ['primitive', [lambda x, y: mp.sec(x), None]],
 'csc': ['primitive', [lambda x, y: mp.csc(x), None]],
 'cot': ['primitive', [lambda x, y: mp.cot(x), None]],
 'asin': ['primitive', [lambda x, y: mp.asin(x), None]],
 'acos': ['primitive', [lambda x, y: mp.acos(x), None]],
 'atan': ['primitive', [lambda x, y: mp.atan(x), None]],
 'atan2': ['primitive', [lambda x, y: mp.atan2(y[0], x), None]],
 'asec': ['primitive', [lambda x, y: mp.asec(x), None]],
 'acsc': ['primitive', [lambda x, y: mp.acsc(x), None]],
 'acot': ['primitive', [lambda x, y: mp.acot(x), None]],
 'sinc': ['primitive', [lambda x, y: mp.sinc(x), None]],
 'sincpi': ['primitive', [lambda x, y: mp.sincpi(x), None]],
 'degrees': ['primitive', [lambda x, y: mp.degrees(x),
                           None]],  #radian - >degree 
 'radians': ['primitive', [lambda x, y: mp.radians(x),
                           None]],  #degree - >radian 
 #
 'exp': ['primitive', [lambda x, y: mp.exp(x), None]],
 'expj': ['primitive', [lambda x, y: mp.expj(x), None]],  #exp(x*i) 
 'expjpi': ['primitive', [lambda x, y: mp.expjpi(x), None]],  #exp(x*i*pi)
 'expm1': ['primitive', [lambda x, y: mp.expm1(x), None]],  #exp(x)-1
 'power': ['primitive', [lambda x, y: mp.power(x, y[0]), None]],
 'powm1': ['primitive', [lambda x, y: mp.powm1(x, y[0]),
                         None]],  #pow(x, y) - 1 
 'log': [
Exemple #12
0
# -*- coding: utf-8 -*-
"""

Created by libsedmlscript v0.0.1
"""

from sed_roadrunner import model, task, plot

from mpmath import acot
#----------------------------------------------

acot(0.5)