# Revision history [back]

After the posted question was rewritten, things become clear...

I will use the initial data, now removed.

N2t = 255160190748097728909073992066681481971266763532072843899089448199446167717167960744601102972601602922181202360582451390444069288993036758893159458257631792288806392427511312959701552997863308272649941168050821236125510145636956726776578414214971100481644977543870051557614456524822448281201070029896628771569285982163522457460577547615506364312525396285709733305329300010560421731105246057719068276050848034151179818471271226677961341255951310813543386757373809814453125

tau = 21889076392558760327677659259934609638463313379802582901440283193366831291164819780840018602360527472447127247594678967295892871925139132561808422151579794094385412974746838548046696943871501539283044945256107967558704847080889510560228755842021930819060356896821169145764886710414494318501436969236483033958717524286008339273426400925089525356222254452347532030101233967584203566313861768653268558884527430972086051680415120281152591994818818861033582581858059564186563

M = Matrix( QQ, 2, 2,
[ [ N2t, 0 ] ,
[ tau, 1 ] , ] )

B = M.LLL()
# the two lines that declare M and B are the solution...
# let us put some prints here, to see what happens...

print 'M is a matrix with relatively big coefficients'
print M.change_ring( RR )

print 'B = M.LLL() is a matrix with "half big" coefficients'
print B.change_ring( RR )

print 'The determinants of M and B differ by a unit...'
print 'det(M) = %s' % ( M.det().factor() )
print 'det(B) = %s' % ( B.det().factor() )


Results:

M is a matrix with relatively big coefficients
[2.55160190748098e470    0.000000000000000]
[2.18890763925588e469     1.00000000000000]
B = M.LLL() is a matrix with "half big" coefficients
[-1.02023170379847e235 -8.25694748623678e234]
[-1.02465661838403e235  1.67172644428592e235]
The determinants of M and B differ by a unit...
det(M) = 5^673
det(B) = -1 * 5^673


Note hat B has similar entries to those from the initial post, where magma results were shown:

    sage: print B[0,0]
-10202317037984739003641915820305590772990465825580647714167730574287969828946893597099411030227057452578710890500399597178698718476298665843284580499548238950340493074884696751946997981571943671945095252359926214603290438205260990700057


After the posted question was rewritten, things become clear...

I will use the initial data, now removed.

N2t = 255160190748097728909073992066681481971266763532072843899089448199446167717167960744601102972601602922181202360582451390444069288993036758893159458257631792288806392427511312959701552997863308272649941168050821236125510145636956726776578414214971100481644977543870051557614456524822448281201070029896628771569285982163522457460577547615506364312525396285709733305329300010560421731105246057719068276050848034151179818471271226677961341255951310813543386757373809814453125

tau = 21889076392558760327677659259934609638463313379802582901440283193366831291164819780840018602360527472447127247594678967295892871925139132561808422151579794094385412974746838548046696943871501539283044945256107967558704847080889510560228755842021930819060356896821169145764886710414494318501436969236483033958717524286008339273426400925089525356222254452347532030101233967584203566313861768653268558884527430972086051680415120281152591994818818861033582581858059564186563

M = Matrix( QQ, 2, 2,
[ [ N2t, 0 ] ,
[ tau, 1 ] , ] )

B = M.LLL()
# the two lines that declare M and B are the solution...
# let us put some prints here, to see what happens...

print 'M is a matrix with relatively big coefficients'
print M.change_ring( RR )

print 'B = M.LLL() is a matrix with "half big" coefficients'
print B.change_ring( RR )

print 'The determinants of M and B differ by a unit...'
print 'det(M) = %s' % ( M.det().factor() )
print 'det(B) = %s' % ( B.det().factor() )


Results:

M is a matrix with relatively big coefficients
[2.55160190748098e470    0.000000000000000]
[2.18890763925588e469     1.00000000000000]
B = M.LLL() is a matrix with "half big" coefficients
[-1.02023170379847e235 -8.25694748623678e234]
[-1.02465661838403e235  1.67172644428592e235]
The determinants of M and B differ by a unit...
det(M) = 5^673
det(B) = -1 * 5^673


Note hat B has similar entries to those from the initial post, where magma results were shown:

    sage: print B[0,0]
-10202317037984739003641915820305590772990465825580647714167730574287969828946893597099411030227057452578710890500399597178698718476298665843284580499548238950340493074884696751946997981571943671945095252359926214603290438205260990700057


FURTHER EDIT regarding the declaration of an inner product (diagonal) matrix D in the magma lattice.

Magma seems to accept also a second argument when a lattice is introduced, as in

https://magma.maths.usyd.edu.au/magma/handbook/text/308

so let us give an example of usage for the same data, in parallel in magma and in sage. The link to the magma online calculator was a big help, the following Magma code

d  := 7647976553;
QQ := Rationals();
A := Matrix( QQ, 2, 2, [2^83-1, 3^47+17, 5^35-2, 7^27-66] );
X := Matrix( QQ, 2, 2, [1,0,0,d] );

L := Lattice( A, X^2 );
"\n LLLBasisMatrix(L):\n", LLLBasisMatrix(L);


was executed, and gave rise to

 LLLBasisMatrix(L):

[   1469426521149510852500378801             -481347751540973298]
[1000322738339202822446199266478            52159285068221467403]


and some further output that i could not figure out using the strict magma documentation in a world without examples.

Let us recover the above in sage. Code:

d = 7647976553;

A = matrix( QQ, 2, [2^83-1, 3^47+17, 5^35-2, 7^27-66] )
X = matrix( QQ, 2, [1,0, 0,d] )
M = A * X
M.LLL() * X^(-1)


Results:

[   1469426521149510852500378801             -481347751540973298]
[1000322738339202822446199266478            52159285068221467403]


So the difference is recovered by a twist with X.