4
$\begingroup$

Example: we have the following expansions:

 Table[Expand[(1 + Sqrt[2])^k], {k, 1, 6}]

 (* {1 + Sqrt[2], 3 + 2 Sqrt[2], 7 + 5 Sqrt[2], 17 + 12 Sqrt[2], 41 + 29 Sqrt[2], 99 + 70 Sqrt[2]} *)

Or, the powers of GoldenRatio:

  Table[Expand[((1 + Sqrt[5])/2)^k], {k, 1, 6}]

  (* {1/2 + Sqrt[5]/2, 3/2 + Sqrt[5]/2, 2 + Sqrt[5], 7/2 + (3 Sqrt[5])/2, 11/2 + (5 Sqrt[5])/2, 9 + 4 Sqrt[5]} *)

My questions are:

How to convert an expression 99 + 70 Sqrt[2] back to (1 + Sqrt[2])^6 ?

How to convert (11 + 5*Sqrt[5])/2 back to GoldenRatio^5 ?

In general, how to factor a + b*Sqrt[c] to a power format (if it exists) ?


UPDATE: Thanks to all for the inspiration!

My problem is to solve

  a + b*Sqrt[c] == (r + s*Sqrt[c])^k

where r, s and k are unknown and all variables are integer.

Unfortunately I get from

  Solve[(99 + 70 Sqrt[2]) == Expand[(r + s*Sqrt[2])^k] && k > 0, {r, s, k}, Integers]

an error message: "This system cannot be solved with the methods available to Solve."

Of course, brute force method over integers is possible, but has anybody an idea, how to solve this equation in integers, for example some additional options in the "Solve[]" statement ?

However, brute force is not good method for simplification of

  11880235445948416 + 2206039924408320*Sqrt[29]
$\endgroup$

2 Answers 2

5
$\begingroup$

Here's an approach that works when the field norm is not $\pm 1$. Unfortunately both of your examples have norm $-1$, but maybe the following approach can be extended to this case.

AlgebraicNumberNorm /@ {1 + Sqrt[2], (1 + Sqrt[5])/2}

(* {-1, -1} *)

When an algebraic number is a power of $k$, the absolute value of its norm is also a power of $k$.

So, we can factor the norm over the integers. If it's not a perfect power, we know the algebraic number is not a perfect power. Otherwise, we can test the divisors of the exponent. Since $1$ is a perfect power for any exponent, this approach won't work.

Consider the example:

η = 1472 - 640 I Sqrt[2];

Here's its norm:

norm = AlgebraicNumberNorm[η]

(* 2985984 *)

FactorInteger[Abs[norm]]

(* {{2, 12}, {3, 6}} *)

We see norm is a power of $6$, so $\eta$ could be a power of $6$, $3$, $2$, or $1$.

cands = Reverse[Divisors[6]];

Now we select the largest $k$ such that a Galois conjugate of $\eta^{1/k}$ has degree $2$:

algebraicDegree[η_] := Exponent[MinimalPolynomial[η, x], x]

kthPowerQ[η_][k_] :=
  Min[algebraicDegree[# η^(1/k)]& /@ Exp[2Range[k]π I/k]] == 2

k = SelectFirst[cands, kthPowerQ[η]]

(* 6 *)

Factor to see $1472 - 640i\sqrt{2} = (2 + 2i\sqrt{2}\,)^6$:

base = SelectFirst[Exp[2Range[k]π I/k] η^(1/k), algebraicDegree[#] == 2&];

RootReduce[base]^k

(* (2 + 2 I Sqrt[2])^6 *)
$\endgroup$
2
  • 1
    $\begingroup$ This solution is best! We have 11880235445948416 + 2206039924408320*Sqrt[29] = (7 + 3*Sqrt[29])^12 $\endgroup$ Commented Nov 28, 2017 at 18:14
  • $\begingroup$ Can you please explain how your method work. Can it be used to simplify expressions with cubic roots? $\endgroup$
    – yarchik
    Commented Nov 29, 2017 at 7:32
4
$\begingroup$
expr = Table[(1 + Sqrt[2])^k, {k, 1, 6}];

LeafCount /@ expr

(* {7, 9, 9, 9, 9, 9} *)

expr2 = Table[Expand[(1 + Sqrt[2])^k], {k, 1, 6}];

LeafCount /@ expr2

(* {7, 9, 9, 9, 9, 9} *)

Since the LeafCount is the same for the expressions, you would need to use a custom ComplexityFunction to favor the desired form with Simplify or FullSimplify. However, if you know the desired form

expr3 = (99 + 70 Sqrt[2]);

expr3a = (a + Sqrt[2])^n /. NMinimize[{Abs[expr3 - (a + Sqrt[2])^n],
      Element[{a, n}, Integers], n > 1}, {a, n}][[2]] // Quiet

(* (1 + Sqrt[2])^6 *)

expr3b = (a + b Sqrt[2])^n /. NMinimize[{Abs[expr3 - (a + b Sqrt[2])^n],
      Element[{a, b, n}, Integers], n > 1}, {a, b, n}][[2]] // Quiet

(* (3 + 2*Sqrt[2])^3 *)

Verifying

expr3 == expr3a == expr3b // Simplify

(* True *)

expr4 = (11 + 5*Sqrt[5])/2;

expr4a = a*GoldenRatio^n /. NMinimize[{Abs[expr4 - (a*GoldenRatio^n)],
      Element[{a, n}, Integers], n > 1}, {a, n}][[2]] // Quiet

(* GoldenRatio^5 *)

expr4b = (a + b*GoldenRatio)^n /. 
   NMinimize[{Abs[expr4 - (a + b*GoldenRatio)^n],
      Element[{a, b, n}, Integers], n > 1}, {a, b, n}][[2]] // Quiet

(* GoldenRatio^5 *)

Verifying

expr4 == expr4a == expr4b // Simplify

(* True *)
$\endgroup$
1
  • $\begingroup$ This method is possible, but verification is necessary, because from 98 + 70 Sqrt[2] I get same result, which is incorrect. $\endgroup$ Commented Nov 28, 2017 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.