3
$\begingroup$

I want to simplify the following expression:

{1/Sqrt[2], 1/Sqrt[2]}

How can I get the factor 1/Sqrt[2] in front of the parenthesis like:

1/Sqrt[2] {1, 1}

??

$\endgroup$
  • $\begingroup$ It is not possible to put the expression into that form, as the multiplication would evaluate immediately. It may be possible to have 1/Sqrt[2] and {1, 1} as separate results, but in that case it is very important to make it clear what factors should or shouldn't be extracted. What about {Sqrt[2], Sqrt[3], 7, 5/2}? $\endgroup$ – Szabolcs Sep 5 '16 at 9:54
  • $\begingroup$ I get your argument. However, to rapidly grasp the symmetry of a matrix by eye (I'm talking of 3x3 or 4x4 matrix) one would reduce/simplify the matrix. I just wanted to enforce MMA to do that for me... Your example is of course totally asymmetric :D $\endgroup$ – Kay Sep 5 '16 at 10:03
  • $\begingroup$ Maybe just multiply manually with the factor that seems relevant by visual inspection (Sqrt[2] here). Or even use MatrixPlot, which should help in quickly determining a symmetry visually (then verify manually). $\endgroup$ – Szabolcs Sep 5 '16 at 10:05
  • $\begingroup$ Possible duplicate: mathematica.stackexchange.com/questions/70131/… $\endgroup$ – Michael E2 Nov 5 '16 at 0:12
4
$\begingroup$
v = {1/Sqrt[2], 1/Sqrt[2]};

c = PolynomialGCD @@ v;

c*Defer @@ {v/c}
{1, 1}/Sqrt[2]
$\endgroup$
1
$\begingroup$

If you just want to view it you can try this.

Here is a mixed matrix with some parts that have Sqrt[2] in the denominator and some parts that do not.

matrix = {{1/Sqrt[2], 2/Sqrt[2]}, {3, Sqrt[2]}, {4, 3/Sqrt[2]},
          {2./Sqrt[2], a/Sqrt[2]}};

MatrixForm[matrix]

$$\left( \begin{array}{cc} \frac{1}{\sqrt{2}} & \sqrt{2} \\ 3 & \sqrt{2} \\ 4 & \frac{3}{\sqrt{2}} \\ 1.41421 & \frac{a}{\sqrt{2}} \\ \end{array} \right)$$

Now multiply it by the Sqrt[2]

matrix2=Sqrt[2]*matrix;

MatrixForm[matrix2]

$$\left( \begin{array}{cc} 1 & 2 \\ 3 \sqrt{2} & 2 \\ 4 \sqrt{2} & 3 \\ 2. & a \\ \end{array} \right)$$

matrix2 the simplified matrix with 1/Sqrt[2] factored out.

In order to see it with the 1/Sqrt[2] outside try

HoldForm[1/Sqrt[2]] HoldForm[Evaluate[matrix2]]

Mathematica graphics

Now you can get a temporary peek at the matrix with 1/Sqrt[2] moved to the outside.

$\endgroup$
0
$\begingroup$

Given the vector

v = {1/Sqrt[2], 4/Sqrt[2], (x + 3)/Sqrt[2]};

The following code

c = PolynomialGCD @@ v;
Print[c, " ", (v/c) // MatrixForm];

Outputs what you want

$$\frac{1}{\sqrt{2}} \begin{pmatrix} 1\\ 4\\ 3 + x\\ \end{pmatrix}$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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