def test__get_solution_set__1(self):
     ls = LinearSeries(
         ['x*z^13', 'x*z^13', 'x^9*y^5', 'x^8*y^6', 'x*y*z^12+2*y*z^13'],
         PolyRing('x,y,z', True))
     zls = ls.copy().chart(['z'])
     print(zls)
     sol_lst = zls.get_solution_set()
     print(sol_lst)
     assert sol_lst == [(0, 0)]
Example #2
0
    def test__diff( self ):

        ring = PolyRing( 'x,y,z', True )
        ring.ext_num_field( 't^2 + 1' )
        ring.ext_num_field( 't^3 + a0' )

        ls = LinearSeries( ['a0*x^2+y^3*z^3', 'x+z+z^3*y^4'], ring )
        xls = ls.copy().chart( ['x'] )

        assert str( xls.diff( 3, 2 ).pol_lst ) == '[36*z, 144*y*z]'
Example #3
0
    def test__chart( self ):

        ring = PolyRing( 'x,y,z', True )
        ring.ext_num_field( 't^2 + 1' )
        ring.ext_num_field( 't^3 + a0' )


        ls = LinearSeries( ['x^2+a0*y*z', 'x+y+a1*z '], ring )
        xls = ls.copy().chart( ['x'] )

        assert str( xls.pol_lst ) == '[a0*y*z + 1, y + a1*z + 1]'
Example #4
0
    def test__blow_up_origin( self ):

        ring = PolyRing( 'x,y,z', True )
        ring.ext_num_field( 't^2 + 1' )
        ring.ext_num_field( 't^3 + a0' )

        ls = LinearSeries( ['x^2', 'x*z + y^2'], ring )
        zls = ls.copy().chart( ['z'] )

        zls, m = zls.blow_up_origin( 's' )
        assert str( zls ) == '{ 2, <<x, x*y^2 + 1>>, QQ( <a0|t^2 + 1>, <a1|t^2 + a0*t - 1> )[x, y] }'
        assert m == 1
Example #5
0
    def test__translate_to_origin( self ):

        ring = PolyRing( 'x,y,z', True )
        ring.ext_num_field( 't^2 + 1' )
        ring.ext_num_field( 't^3 + a0' )

        ls = LinearSeries( ['y^2', 'y*x'], ring )
        xls = ls.copy().chart( ['x'] )

        a0, a1 = ring.coerce( 'a0,a1' )

        xls.translate_to_origin( ( a0 + 1, a1 + a0 ) )
        assert str( xls ) == '{ 2, <<y^2 + (2*a0 + 2)*y + 2*a0, y + a0 + 1>>, QQ( <a0|t^2 + 1>, <a1|t^2 + a0*t - 1> )[y, z] }'
    def test__get_solution_set__2(self):

        ls = LinearSeries(['x^2*z+y^2*z', 'y^3+z^3'], PolyRing('x,y,z', True))
        xls = ls.copy().chart(['x'])

        sol_lst = xls.get_solution_set()

        assert str(
            xls
        ) == '{ 2, <<y^2*z + z, y^3 + z^3>>, QQ( <a0|t^2 + 1>, <a1|t^2 + a0*t - 1> )[y, z] }'

        assert str(
            sol_lst
        ) == '[(-a0, a0), (a0, -a1), (0, 0), (a0, -a0), (a0, a1 + a0), (-a0, a1), (-a0, -a1 - a0)]'