Ask Your Question

Revision history [back]

Hint: work over AA or QQbar.

Ideally, define the matrix over AA or QQbar from the start.

Or use AA or QQbar at the time of checking the equality.

sage: bool(AA(N) == -(1 - QQbar(M).abs()^2)^2)

Hint: work over AA or QQbar.

Ideally, define the matrix over compute in AA or QQbar (or in an appropriate number field if you know which one to use) from the start.

Or start and avoid ending up with such complicated expressions.

Some ways to do this:

  • use matrix(QQbar, ...) instead of matrix(...)
  • define r = AA(2).sqrt() and use r instead of sqrt(2)

Having defined M and N as in the question...

Define corresponding elements in QQbar or AA or QQbar at the time of checking the equality.

sage: bool(AA(N) :

sage: m = QQbar(M)
sage: n = AA(N)
sage: p = -(1-m.abs()^2)^2

Check their values:

sage: m
0.0154952449333661? - 0.772904461325769?*I

sage: n
-0.1619085305331?
sage: p
-0.1619085305331120?

So n and p might be equal...

Check their difference:

sage: d = p - n
sage: d
0.?e-13

Looks like it might be zero.

Checking it takes forever:

sage: d.is_zero()  # takes forever
sage: AA(N) == -(1 - QQbar(M).abs()^2)^2)
QQbar(M).abs()^2)^2 # takes forever

Regarding other software, Calcium might help. See

Hint: [Edited 2020-07-26 to turn vague hints into an actual answer].

Here is one way to go, with M and N as in the question.

Our solution uses algebraic numbers in AA and QQbar rather than symbolic expressions in Sage's "symbolic ring".

However we start by computing the square of the modulus of M using the symbolic ring and string manipulations.

Along the way, two of the computations take a few seconds each, but under a minute (on a 2014 MacBook Air).


To define the conjugate of M, we turn M into a string, then replace I by (-I) in that string, then convert back to a symbolic expression:

sage: Mc_str = str(M).replace('I', '(-I)')
sage: Mc = SR(Mc_str)

Compute (abs(M)^2 - 1)^2 using M*Mc for abs(M)^2:

sage: W = (M*Mc - 1)^2

Our goal is to prove that N + W is zero.

See N as a real algebraic number:

sage: N_aa = AA(N)
-0.1619085305331?

See W as an algebraic number (not known to be real yet):

sage: W_qqbar = QQbar(W)
sage: W_qqbar
0.1619085305331120? + 0.?e-16*I

Examine the imaginary part:

sage: W_imag = W_qqbar.imag()
sage: W_imag
0.?e-16

Check whether it is actually zero:

sage: W_imag.is_zero()  # takes a few seconds
True

Since its imaginary part is zero, see W as a real algebraic number:

sage: W_aa = AA(W_qqbar)

sage: W_aa
0.1619085305331121?

Compute the sum of W and N (we hope it is zero):

sage: Z_aa = W_aa + N_aa

Does it look like it might be zero:

sage: Z_aa
0.?e-13

Is it actually zero:

sage: Z_aa.is_zero()  # takes a few seconds
True

Finally:

sage: Z_aa
0

The main take-away hint is to work over AA or QQbar.

Ideally, compute in AA or QQbar (or in an appropriate number field if you know which one to use) from the start and avoid ending up with such complicated expressions.

Some ways to do this:

  • use matrix(QQbar, ...) instead of matrix(...)
  • define r = AA(2).sqrt() and use r instead of sqrt(2)
  • use appropriate tower of quadratic extensions of QQ

Having defined M and N as in the question...

Define corresponding elements in QQbar or AA:

sage: m = QQbar(M)
sage: n = AA(N)
sage: p = -(1-m.abs()^2)^2

Check their values:

sage: m
0.0154952449333661? - 0.772904461325769?*I

sage: n
-0.1619085305331?
sage: p
-0.1619085305331120?

So n and p might be equal...

Check their difference:

sage: d = p - n
sage: d
0.?e-13

Looks like it might be zero.

Checking it takes forever:

sage: d.is_zero()  # takes forever
sage: AA(N) == -(1 - QQbar(M).abs()^2)^2  # takes forever

Regarding other software, Calcium might help. See


My initial approach was somewhat along the same lines but did not quite get us there. I stopped the final computations after several minutes or intense cpu usage.

I still leave it here for comparison.

Having defined M and N as in the question...

Define corresponding elements in QQbar or AA:

sage: m = QQbar(M)
sage: n = AA(N)
sage: p = -(1-m.abs()^2)^2

Check their values:

sage: m
0.0154952449333661? - 0.772904461325769?*I

sage: n
-0.1619085305331?
sage: p
-0.1619085305331120?

So n and p might be equal...

Check their difference:

sage: d = p - n
sage: d
0.?e-13

Looks like it might be zero.

Checking it seems to take forever:

sage: d.is_zero()  # takes too long
sage: AA(N) == -(1 - QQbar(M).abs()^2)^2  # takes too long

[Edited 2020-07-26 to turn vague hints into an actual answer].

Here is one way to go, with M and N as in the question.

Our solution uses algebraic numbers in AA and QQbar rather than symbolic expressions in Sage's "symbolic ring".

However we start by computing the square of the modulus of M using the symbolic ring and string manipulations.

Along the way, two of the computations take a few seconds each, but under a minute (on a 2014 MacBook Air).


To define the conjugate Mc of M, we turn M into a string, string M_str, then replace I by (-I) in that string, string to get Mc_str, then convert back to a symbolic expression:

sage: M_str = str(M)
sage: Mc_str = str(M).replace('I', M_str.replace('I', '(-I)')
sage: Mc = SR(Mc_str)

Compute Call W the quantity (abs(M)^2 - 1)^2 computed using M*Mc for abs(M)^2:

sage: W = (M*Mc - 1)^2

Our goal is to prove that N + W is zero.

See N as a real algebraic number:

sage: N_aa = AA(N)
-0.1619085305331?

See W as an algebraic number (not known to be real yet):

sage: W_qqbar = QQbar(W)
sage: W_qqbar
0.1619085305331120? + 0.?e-16*I

Examine the imaginary part:

sage: W_imag = W_qqbar.imag()
sage: W_imag
0.?e-16

Check whether it is actually zero:

sage: W_imag.is_zero()  # takes a few seconds
True

Since Now that its imaginary part is zero, known to be zero, we can see W as a real algebraic number:

sage: W_aa = AA(W_qqbar)

sage: W_aa
0.1619085305331121?

Compute the sum of W and N (we hope it is zero):

sage: Z_aa = W_aa + N_aa

Does it look like it might be zero:

sage: Z_aa
0.?e-13

Is it actually zero:

sage: Z_aa.is_zero()  # takes a few seconds
True

Finally:

sage: Z_aa
0

The main take-away hint is to work over AA or QQbar.

Ideally, compute in AA or QQbar (or in an appropriate number field if you know which one to use) from the start and avoid ending up with such complicated expressions.

Some ways to do this:

  • use matrix(QQbar, ...) instead of matrix(...)
  • define r = AA(2).sqrt() and use r instead of sqrt(2)
  • use appropriate tower of quadratic extensions of QQ

Regarding other software, Calcium might help. See


My initial approach was somewhat along the same lines but did not quite get us there. I stopped the final computations after several minutes or of intense cpu usage.

I still leave it here for comparison.

Having defined M and N as in the question...

Define corresponding elements in QQbar or AA:

sage: m = QQbar(M)
sage: n = AA(N)
sage: p = -(1-m.abs()^2)^2

Check their values:

sage: m
0.0154952449333661? - 0.772904461325769?*I

sage: n
-0.1619085305331?
sage: p
-0.1619085305331120?

So n and p might be equal...

Check their difference:

sage: d = p - n
sage: d
0.?e-13

Looks like it might be zero.

Checking Trying to check whether it is actually zero seems to take forever:

sage: d.is_zero()  # takes too long
sage: AA(N) == -(1 - QQbar(M).abs()^2)^2  # takes too long