def UHPSidePairingsOfSpecificIdealPolygon(self, genus, numberOfPunctures):
     g, p = genus, numberOfPunctures
     if g == 0 and p < 3:
         pass
     elif g == 1 and p == 0:
         pass
     else:
         f = self.UHPSpecificCombinatorialSidePairing(g, p)
         NumOfSides = (4 * g) + (2 * (p - 1))
         SidePairings = {}
         for k in range(NumOfSides):
             if k == f(NumOfSides - 1):
                 SidePairings[k] = numpy.matrix(
                     [[NumOfSides - 1, (NumOfSides - 1) * (-k)], [0, 1]]
                 )  #numpy.matrix([[NumOfSides-1,0],[0,1]])*numpy.matrix([[1,-k],[0,1]])
             elif k == NumOfSides - 1:
                 SidePairings[k] = (SidePairings[f(k)])**(-1)
             else:
                 #TranslationMatrix = numpy.matrix([[1,f(k)-k],[0,1]])
                 #Elliptic180 = Mobius_CP.MobiusTransitivity().MobiusMatrixz1z2z3Tow1w2w3(f(k)+(1/2)+1j,f(k),f(k)+1,f(k)+(1/2)+1j,f(k)+1,f(k))#Mobius_CP.MobiusFromParameters().MobMatrixFromParams([f(k)+(1/2)+1j,f(k)+(1/2)-1j],-1)
                 SidePairings[k] = Mobius_CP.MobiusTransitivity(
                 ).MobiusMatrixz1z2z3Tow1w2w3(
                     k + (1 / 2) + 1j, k, k + 1,
                     f(k) + (1 / 2) + 1j,
                     f(k) + 1, f(k))  #Elliptic180*TranslationMatrix
         return SidePairings
Beispiel #2
0
    def effectOf_pushButtonCPMTOrbitsRandomCircle(self):
        MobiusTrans = Mobius_CP.MobiusAssocToMatrix(
            self.lineEditCPMTOrbitsComplexNumberalpha.text(),
            self.lineEditCPMTOrbitsComplexNumberbeta.text(),
            self.lineEditCPMTOrbitsComplexNumbergamma.text(),
            self.lineEditCPMTOrbitsComplexNumberdelta.text())
        P = numpy.complex(numpy.random.random(), numpy.random.random())
        Q = numpy.complex(numpy.random.random(), numpy.random.random())
        R = numpy.complex(numpy.random.random(), numpy.random.random())
        numberOfPointsInOrbit = int(self.spinBoxCPMTOrbits.cleanText())
        OrbitP = MobiusTrans.Mob_trans_iterable(P, numberOfPointsInOrbit)
        OrbitQ = MobiusTrans.Mob_trans_iterable(Q, numberOfPointsInOrbit)
        OrbitR = MobiusTrans.Mob_trans_iterable(R, numberOfPointsInOrbit)

        pointsForPlotP = Steiner_grids_CP.coordsOfComplex().coords(OrbitP)
        pointsForPlotQ = Steiner_grids_CP.coordsOfComplex().coords(OrbitQ)
        pointsForPlotR = Steiner_grids_CP.coordsOfComplex().coords(OrbitR)

        centersAndRadii = [
            (Steiner_grids_CP.commonCircles().commonCirclesFunction(
                OrbitP[k], OrbitQ[k]))(OrbitR[k])
            for k in range(0, numberOfPointsInOrbit, 1)
        ]

        t = numpy.linspace(0, 2 * numpy.pi, 500)

        for k in range(0, numberOfPointsInOrbit, 1):
            self.mplWidgetIn_pageCP.canvas.axis.plot(
                ((centersAndRadii[k])[0])[0] +
                (centersAndRadii[k])[1] * numpy.cos(t),
                ((centersAndRadii[k])[0])[1] +
                (centersAndRadii[k])[1] * numpy.sin(t), 'b-')

        line, = self.mplWidgetIn_pageCP.canvas.axis.plot(
            ((centersAndRadii[0])[0])[0] +
            (centersAndRadii[0])[1] * numpy.cos(t),
            ((centersAndRadii[0])[0])[1] +
            (centersAndRadii[0])[1] * numpy.sin(t),
            'r-',
            linewidth=3)

        def update(k):
            # Update the line and the axes (with a new xlabel). Return a tuple of
            # "artists" that have to be redrawn for this frame.
            line.set_xdata(((centersAndRadii[k])[0])[0] +
                           (centersAndRadii[k])[1] * numpy.cos(t))
            line.set_ydata(((centersAndRadii[k])[0])[1] +
                           (centersAndRadii[k])[1] * numpy.sin(t))
            return line,

        anim = FuncAnimation(
            self.mplWidgetIn_pageCP.canvas.fig,
            update,
            #init_func=init,
            frames=numberOfPointsInOrbit,
            interval=250,
            blit=True)
        self.mplWidgetIn_pageCP.canvas.draw()
Beispiel #3
0
    def effectOf_pushButtonCPMTOrbitsSinglePoint(self):
        MobiusTrans = Mobius_CP.MobiusAssocToMatrix(
            self.lineEditCPMTOrbitsComplexNumberalpha.text(),
            self.lineEditCPMTOrbitsComplexNumberbeta.text(),
            self.lineEditCPMTOrbitsComplexNumbergamma.text(),
            self.lineEditCPMTOrbitsComplexNumberdelta.text())
        z_0 = numpy.complex(self.lineEditCPMTOrbitsComplexNumberz_0.text())
        numberOfPointsInOrbit = int(self.spinBoxCPMTOrbits.cleanText())
        Orbit = MobiusTrans.Mob_trans_iterable(z_0, numberOfPointsInOrbit)
        pointsForPlot = Steiner_grids_CP.coordsOfComplex().coords(Orbit)

        for k in range(0, numberOfPointsInOrbit, 1):
            self.mplWidgetIn_pageCP.canvas.axis.plot(
                (pointsForPlot[0])[k], (pointsForPlot[1])[k], 'ob')
        line, = self.mplWidgetIn_pageCP.canvas.axis.plot((pointsForPlot[0])[0],
                                                         (pointsForPlot[1])[0],
                                                         marker='o',
                                                         color='r')

        def update(i):
            # Update the line and the axes (with a new xlabel). Return a tuple of
            # "artists" that have to be redrawn for this frame.
            line.set_xdata((pointsForPlot[0])[i])
            line.set_ydata((pointsForPlot[1])[i])
            return line,
#        x = numpy.arange(0, 20, 0.1)
#        self.mplWidgetIn_pageCP.canvas.axis.scatter(x, x + numpy.random.normal(0, 3.0, len(x)))
#        line, = self.mplWidgetIn_pageCP.canvas.axis.plot(x, x - 5, 'r-', linewidth=2)
#
#        def update(i):
#            # Update the line and the axes (with a new xlabel). Return a tuple of
#            # "artists" that have to be redrawn for this frame.
#            line.set_ydata(x - 5 + i)
#            return line,

#        initialPlot, = self.mplWidgetIn_pageCP.canvas.axis.plot((pointsForPlot[0])[0],(pointsForPlot[1])[0],'or', animated = True)
#
##        def init():
##            initialPlot.set_data([],[])
##            return initialPlot,
#
#        def animate(k):
#            x = (pointsForPlot[0])[k]
#            y = (pointsForPlot[1])[k]
#            print(x,y)
#            initialPlot.set_data(x,y)
#            return initialPlot,
#

        anim = FuncAnimation(
            self.mplWidgetIn_pageCP.canvas.fig,
            update,
            #init_func=init,
            frames=numberOfPointsInOrbit,
            interval=500,
            blit=True)
        self.mplWidgetIn_pageCP.canvas.draw()
 def UHPCheckIfTheGroupIsFuchsianForSpecificSidePairing(
         self, genus, numberOfPunctures):
     g, p = genus, numberOfPunctures
     if g == 0 and p < 3:
         pass
     elif g == 1 and p == 0:
         pass
     else:
         sidePairings = self.UHPSidePairingsOfSpecificIdealPolygon(g, p)
         orbits = self.UHPVertexOrbitsUnderSpecificCombinatorialSidePairing(
             g, p)
         for orbit in orbits:
             transformation = sidePairings[orbit[0]]
             j = 1
             while j < len(orbit):
                 transformation = sidePairings[orbit[j]] * transformation
                 j = j + 1
             print(Mobius_CP.MobiusAssocToMatrix().isParEllHypLox(
                 transformation[0, 0], transformation[0, 1],
                 transformation[1, 0], transformation[1, 1]))
Beispiel #5
0
 def PDSidePairingsOfSpecificIdealPolygon(
         self, genus, numberOfPunctures,
         orders):  #orders is supposed to be the list of orders of orb pts
     g, p = genus, numberOfPunctures
     o = len(orders)
     if g == 0 and p < 3:
         pass
     elif g == 1 and p == 0:
         pass
     else:
         f = self.PDSpecificCombinatorialSidePairing(g, p, o)
         midpoints = self.PDSidesOfSpecificIdealPolygon(g, p,
                                                        orders)["midpoints"]
         NumOfSides = (4 * g) + (2 * (p - 1)) + (2 * o)
         SidePairings = {}
         for k in range((4 * g) + (2 * (p - 1))):
             SidePairings[k] = [
                 Mobius_CP.MobiusTransitivity().MobiusMatrixz1z2z3Tow1w2w3(
                     numpy.cos(2 * (
                         (f(k) + 1) % NumOfSides) * numpy.pi / NumOfSides) +
                     numpy.sin(2 * (
                         (f(k) + 1) % NumOfSides) * numpy.pi / NumOfSides) *
                     (1j),
                     numpy.cos(2 * (
                         (f(k)) % NumOfSides) * numpy.pi / NumOfSides) +
                     numpy.sin(2 * (
                         (f(k)) % NumOfSides) * numpy.pi / NumOfSides) *
                     (1j), midpoints[f(k)],
                     numpy.cos(2 * k * numpy.pi / NumOfSides) +
                     numpy.sin(2 * k * numpy.pi / NumOfSides) * (1j),
                     numpy.cos(2 * (k + 1) * numpy.pi / NumOfSides) +
                     numpy.sin(2 * (k + 1) * numpy.pi / NumOfSides) * (1j),
                     midpoints[k])
             ]
             #print(Mobius_CP.MobiusAssocToMatrix().isParEllHypLox(SidePairings[k][0,0],SidePairings[k][0,1],SidePairings[k][1,0],SidePairings[k][1,1]))
         MobTransUHPtoPD = {}
         for l in range((4 * g) + (2 * (p - 1)), NumOfSides, 2):
             a = numpy.cos(2 * l * numpy.pi / NumOfSides) + numpy.sin(
                 2 * l * numpy.pi / NumOfSides) * (1j)
             b = numpy.cos(2 * (l + 1) * numpy.pi / NumOfSides) + numpy.sin(
                 2 * (l + 1) * numpy.pi / NumOfSides) * (1j)
             c = numpy.cos(2 * (l + 2) * numpy.pi / NumOfSides) + numpy.sin(
                 2 * (l + 2) * numpy.pi / NumOfSides) * (1j)
             MobTransUHPtoPD[l] = Mobius_CP.MobiusTransitivity(
             ).MobiusTransz1z2z3Tow1w2w3(-1, 0, 1, a, b, c)
         for k in range((4 * g) + (2 * (p - 1)), NumOfSides):
             if k % 2 == 0:
                 order = orders[int((k - ((4 * g) + (2 * (p - 1)))) / 2)]
                 theta = (2 * numpy.pi) / order
                 w = numpy.cos(2 * k * numpy.pi / NumOfSides) + numpy.sin(
                     2 * k * numpy.pi / NumOfSides) * (1j)
                 z = MobTransUHPtoPD[k](-numpy.tan(numpy.pi - (theta / 4)) *
                                        (1j))
                 x = numpy.cos(2 *
                               (k + 2) * numpy.pi / NumOfSides) + numpy.sin(
                                   2 *
                                   (k + 2) * numpy.pi / NumOfSides) * (1j)
                 SidePairings[k] = [
                     Mobius_CP.MobiusTransitivity().
                     MobiusMatrixz1z2z3Tow1w2w3(x, midpoints[f(k)], z, w,
                                                midpoints[k], z)
                 ]
             if k % 2 == 1:
                 order = orders[int(
                     (k - 1 - ((4 * g) + (2 * (p - 1)))) / 2)]
                 theta = (2 * numpy.pi) / order
                 x = numpy.cos(2 *
                               (k - 1) * numpy.pi / NumOfSides) + numpy.sin(
                                   2 *
                                   (k - 1) * numpy.pi / NumOfSides) * (1j)
                 w = MobTransUHPtoPD[k - 1](-numpy.tan(numpy.pi -
                                                       (theta / 4)) * (1j))
                 z = numpy.cos(2 *
                               (k + 1) * numpy.pi / NumOfSides) + numpy.sin(
                                   2 *
                                   (k + 1) * numpy.pi / NumOfSides) * (1j)
                 SidePairings[k] = [
                     Mobius_CP.MobiusTransitivity().
                     MobiusMatrixz1z2z3Tow1w2w3(w, midpoints[f(k)], x, w,
                                                midpoints[k], z)
                 ]
         return SidePairings
Beispiel #6
0
    def PDSidesOfSpecificIdealPolygon(
            self, genus, numberOfPunctures,
            orders):  #orders is supposed to be the list of orders of orb pts
        # NOTE: TRY TO IMPROVE THE WAY THE SIDES ARE COLORED
        g, p = genus, numberOfPunctures
        o = len(orders)
        #print(orders)
        if g == 0 and p < 3:
            pass
        elif g == 1 and p == 0:
            pass
        else:
            NumOfSides = (4 * g) + (2 * (p - 1)) + (2 * o)
            midpoints = {}
            triplesOfPtsOnCurves = {}
            for k in range((4 * g) + (2 * (p - 1))):
                w = numpy.cos(2 * k * numpy.pi / NumOfSides) + numpy.sin(
                    2 * k * numpy.pi / NumOfSides) * (1j)
                z = numpy.cos(2 * (k + 1) * numpy.pi / NumOfSides) + numpy.sin(
                    2 * (k + 1) * numpy.pi / NumOfSides) * (1j)
                eCenter = w * (1 + (z - w) / (z + w))
                thetaw = myarg0To2Pi(
                    w - eCenter)  #numpy.angle(-(w-eCenter))+numpy.pi
                thetaz = myarg0To2Pi(
                    z - eCenter)  #numpy.angle(-(z-eCenter))+numpy.pi

                def parametrized_curve(t):
                    parametrization = eCenter + (z - eCenter) * (numpy.cos(t) +
                                                                 numpy.sin(t) *
                                                                 (1j))
                    return parametrization

                midpoints[k] = parametrized_curve(
                    (min(numpy.abs(thetaz - thetaw),
                         (2 * numpy.pi) - numpy.abs(thetaz - thetaw))) / 2)
                triplesOfPtsOnCurves[k] = [[
                    z,
                    parametrized_curve(
                        (min(numpy.abs(thetaz - thetaw),
                             (2 * numpy.pi) - numpy.abs(thetaz - thetaw))) /
                        2), w
                ]]
            MobTransUHPtoPD = {}
            for l in range((4 * g) + (2 * (p - 1)), NumOfSides, 2):
                a = numpy.cos(2 * l * numpy.pi / NumOfSides) + numpy.sin(
                    2 * l * numpy.pi / NumOfSides) * (1j)
                b = numpy.cos(2 * (l + 1) * numpy.pi / NumOfSides) + numpy.sin(
                    2 * (l + 1) * numpy.pi / NumOfSides) * (1j)
                c = numpy.cos(2 * (l + 2) * numpy.pi / NumOfSides) + numpy.sin(
                    2 * (l + 2) * numpy.pi / NumOfSides) * (1j)
                MobTransUHPtoPD[l] = Mobius_CP.MobiusTransitivity(
                ).MobiusTransz1z2z3Tow1w2w3(-1, 0, 1, a, b, c)
            for k in range((4 * g) + (2 * (p - 1)), NumOfSides):
                if k % 2 == 0:
                    order = orders[int((k - ((4 * g) + (2 * (p - 1)))) / 2)]
                    theta = (2 * numpy.pi) / order
                    w = numpy.cos(2 * k * numpy.pi / NumOfSides) + numpy.sin(
                        2 * k * numpy.pi / NumOfSides) * (1j)
                    z = MobTransUHPtoPD[k](-numpy.tan(numpy.pi - (theta / 4)) *
                                           (1j))
                    inv = z / (z.real**2 + z.imag**2)
                if k % 2 == 1:
                    order = orders[int(
                        (k - 1 - ((4 * g) + (2 * (p - 1)))) / 2)]
                    theta = (2 * numpy.pi) / order
                    w = MobTransUHPtoPD[k - 1](-numpy.tan(numpy.pi -
                                                          (theta / 4)) * (1j))
                    z = numpy.cos(2 *
                                  (k + 1) * numpy.pi / NumOfSides) + numpy.sin(
                                      2 *
                                      (k + 1) * numpy.pi / NumOfSides) * (1j)
                    inv = w / (w.real**2 + w.imag**2)
                eCenter = e_circumcenter_and_radius(
                    w, z, inv)[0][0] + e_circumcenter_and_radius(
                        w, z, inv)[0][1] * (1j)
                thetaw = myarg0To2Pi(
                    w - eCenter)  #numpy.angle(-(w-eCenter))+numpy.pi
                thetaz = myarg0To2Pi(
                    z - eCenter)  #numpy.angle(-(z-eCenter))+numpy.pi

                def parametrized_curve(t):
                    parametrization = eCenter + (z - eCenter) * (numpy.cos(t) +
                                                                 numpy.sin(t) *
                                                                 (1j))
                    return parametrization

                midpoints[k] = parametrized_curve(
                    (min(numpy.abs(thetaz - thetaw),
                         (2 * numpy.pi) - numpy.abs(thetaz - thetaw))) / 2)
                triplesOfPtsOnCurves[k] = [[
                    z,
                    parametrized_curve(
                        (min(numpy.abs(thetaz - thetaw),
                             (2 * numpy.pi) - numpy.abs(thetaz - thetaw))) /
                        2), w
                ]]
            #basicColors = [(200, 200, 255)]#["m", "c", "r", "k", "g", "y", "b"]#["m", "c", "r", "k", "g", "y", "b", "w"]
            basicColors = [(255, 0, 0),
                           (0, 230, 0), (0, 0, 255), (255, 153, 0),
                           (204, 0, 204), "m", "b", "k", "g", "r"]
            curvesColors = {}
            #            l = len(basicColors)
            #            for k in range(4*(g-1)-2):
            #                if k % l == 0 or k % l == 4  :
            #                    curvesColors[k] = basicColors[int(k/2)%len(basicColors)]
            #                    curvesColors[k+2] = basicColors[int(k/2)%len(basicColors)]
            #                if  k % l == 3 or k % l == 7 :
            #                    curvesColors[k] = basicColors[int((k-1)/2)%len(basicColors)]
            #                    curvesColors[k+2] = basicColors[int((k-1)/2)%len(basicColors)]
            f = self.PDSpecificCombinatorialSidePairing(g, p, o)
            for k in range(NumOfSides):  #range(4*(g-1)+1,4*(g-1)+1+p):
                curvesColors[k] = basicColors[k % len(basicColors)]
                curvesColors[f(k)] = basicColors[k % len(basicColors)]
            result = {
                "triplesOfPtsOnCurves": triplesOfPtsOnCurves,
                "midpoints": midpoints,
                "curvesColors": curvesColors
            }
            #print(curves)
            return result