Function Repository Resource:

DisplayPowersTogether

Source Notebook

Display multiplication and/or division of factors with the form x^y as one factor

Contributed by: Ted Ersek

ResourceFunction["DisplayPowersTogether"][expr]

displays the multiplication and/or division of factors with the form xyor Surd[x,n] as one factor.

ResourceFunction["DisplayPowersTogether"][expr,assume]

uses assume as assumptions.

Details and Options

ResourceFunction["DisplayPowersTogether"] automatically combines factors at all levels of an expression.
Powers are displayed as one factor when valid under assuptions given by $Assumptions.
ResourceFunction["DisplayPowersTogether"][expr,assume] combines assume with $Assumptions.
CubeRoot[x] evaluates to Surd[x,3], which is affected by ResourceFunction["DisplayPowersTogether"].
The output of ResourceFunction["DisplayPowersTogether"] is a Defer object, which displays with the powers together. Evaluating the Defer object can result in powers seperating.

Examples

Basic Examples (4) 

Combine the powers in an expression:

In[1]:=
ResourceFunction["DisplayPowersTogether"][
 1 + (x 2^(3/4))/(Sqrt[5] 3^(1/4))]
Out[1]=

Combine powers with multiple terms:

In[2]:=
ResourceFunction["DisplayPowersTogether"][
 1 + 2^(2 + w + 3 z) 3^(1 + 2 w + z) 5^w]
Out[2]=

Combine radicals:

In[3]:=
ResourceFunction["DisplayPowersTogether"][1 + Sqrt[2/3] Sqrt[1/z]]
Out[3]=

DisplayPowersTogether also combines products and quotients that include CubeRoot:

In[4]:=
ResourceFunction["DisplayPowersTogether"][
 2^(-2/3) CubeRoot[x] + 2^(2/3) CubeRoot[x]]
Out[4]=

Scope (9) 

DisplayPowersTogether combines exponents using the default assumptions stored in $Assumptions. The assumptions in this example are sufficient to combine all the exponents:

In[5]:=
$Assumptions = n \[Element] Integers;
ResourceFunction["DisplayPowersTogether"][1 + 2 a^n b^n c^-n d^-n]
Out[6]=

DisplayPowersTogether similarly combines all the exponents when is given as a second argument in DisplayPowersTogether:

In[7]:=
$Assumptions = True;
ResourceFunction["DisplayPowersTogether"][1 + 2 a^n b^n c^-n d^-n, n \[Element] Integers]
Out[8]=

Provide assumptions allowing some but not all exponents to be combined:

In[9]:=
ResourceFunction["DisplayPowersTogether"][1 + 2 a^z b^z c^-z d^-z, a > 0 && d > 0]
Out[9]=

Set $Assumptions as a>0, and specify d>0 as an assumption within DisplayPowersTogether:

In[10]:=
$Assumptions = a > 0;
ResourceFunction["DisplayPowersTogether"][1 + 2 a^z b^z c^-z d^-z, d > 0]
Out[11]=

Only assume d> 0:

In[12]:=
$Assumptions = True;
ResourceFunction["DisplayPowersTogether"][1 + 2 a^z b^z c^-z d^-z, d > 0]
Out[13]=

The following assumptions are sufficient to combine all the exponents even though nothing is assumed about b or z:

In[14]:=
ResourceFunction["DisplayPowersTogether"][1 + 2 a^z b^z c^-z d^-z, a > 0 && c > 0 && d > 0]
Out[14]=

FullSimplify verifies that DisplayPowersTogether performed a valid transformation under the given assumptions:

In[15]:=
FullSimplify[1 + 2 a^z b^z c^-z d^-z == 1 + 2 ((a b)/(c d))^z, a > 0 && c > 0 && d > 0]
Out[15]=

This performs independent verification by searching for a counterexample to the previous example. The identity is True in every case considered:

In[16]:=
And @@ With[{b = Rationalize[RandomComplex[{-2 - 2 I, 2 + 2 I}], 0.001], z = Rationalize[RandomComplex[{-2 - 2 I, 2 + 2 I}], 0.001]},
  Flatten@
   Table[PossibleZeroQ[(1 + 2 a^z b^z c^-z d^-z) - (1 + 2 ((a b)/(c d))^z)], {a, 1/3, 2, 1/3}, {c, 1/3, 2, 1/3}, {d, 1/3, 2, 1/3}]
  ]
Out[16]=

In this case, nothing is assumed and none of the exponents can be combined:

In[17]:=
$Assumptions = True;
ResourceFunction["DisplayPowersTogether"][1 + 2 a^n b^n c^-n d^-n]
Out[17]=

DisplayPowersTogether determines this can be done with a single Sqrt:

In[18]:=
ResourceFunction["DisplayPowersTogether"][
 1 + (Sqrt[x - 2] Sqrt[3 - z])/Sqrt[y - 2], x > 4 && y > 4]
Out[18]=

Surd is a generalization of CubeRoot. DisplayPowersTogether combines expressions involving Surd when appropriate:

In[19]:=
ResourceFunction["DisplayPowersTogether"][
 x^(1/5) Surd[y, 5] + Surd[y, 5]/x^(1/5), (0 < y) && (0 < x)]
Out[19]=
In[20]:=
ResourceFunction["DisplayPowersTogether"][
 Surd[x, 5] Surd[y, 5] + Surd[y, 5]/Surd[x, 5], (0 < x) && (0 < y)]
Out[20]=

Properties and Relations (2) 

Rather than use $Assumptions or DisplayPowersTogether[expr,assum], assumptions can be provided using Assuming:

In[21]:=
$Assumptions = True;
Assuming[a > 0 && c > 0 && d > 0, ResourceFunction["DisplayPowersTogether"][1 + 2 a^z b^z c^-z d^-z]]
Out[21]=

Two examples are given here where Simplify can combine a sum of terms:

In[22]:=
Simplify[1/Sqrt[4 x] - Sqrt[1/(4 x)], x < 0]
Out[22]=
In[23]:=
Simplify[(a^b)^c + a^(b c), -1 < b < 1]
Out[23]=

DisplayPowersTogether does not handle sums or differences:

In[24]:=
ResourceFunction["DisplayPowersTogether"][1/Sqrt[4 x] - Sqrt[1/(4 x)],
  x < 0]
Out[24]=
In[25]:=
ResourceFunction[
 "DisplayPowersTogether"][(a^b)^c + a^(b c), -1 < b < 1]
Out[25]=

Possible Issues (2) 

The result of DisplayPowersTogether has a Head of Defer:

In[26]:=
result = ResourceFunction["DisplayPowersTogether"][1 + Sqrt[2/3] Sqrt[1/z]]
Out[26]=
In[27]:=
InputForm[result]
Out[27]=

It is not a readily-computable expression:

In[28]:=
6 + result
Out[28]=

First can be used to compute on the results:

In[29]:=
6 + First[result]
Out[29]=

Alternatively, copy the output shown previously and evaluate it to perform the computation:

In[30]:=
6 + (1 + Sqrt[2/(3 z)])
Out[30]=

DisplayPowersTogether can be used again to ensure the square roots are combined again:

In[31]:=
ResourceFunction["DisplayPowersTogether"][8 + First[result]]
Out[31]=

The next example is not in a form that allows DisplayPowersTogether to combine factors:

In[32]:=
ResourceFunction[
 "DisplayPowersTogether"][(2^(2/3) + 5^(2/3))*CubeRoot[x]]
Out[32]=

When the cube root above is distributed across the sum, DisplayPowersTogether can combine factors:

In[33]:=
ResourceFunction["DisplayPowersTogether"][
 2^(2/3) CubeRoot[x] + 5^(2/3) CubeRoot[x]]
Out[33]=

Publisher

Ted Ersek

Version History

  • 1.0.0 – 02 October 2020

Related Resources

License Information