0
$\begingroup$

I'm a complete beginner at Mathematica, I'm trying to find a matrix A which when squared gives a specific solution. The elements of matrix A are k-th roots of unity (which I will specify), or if there is no solution, their absolute value should be 1.

Below is my attemp at the problem:

c = IdentityMatrix[10]*10 - Reverse[IdentityMatrix[10]*6];
A = Array[x, {10, 10}];
FindInstance[A^2 == c && Abs[x] == 1, x];

This does not work with the error indInstance::exvar: "The system contains a nonconstant expression x[1,1] independent of variables {x}. 1. How should I specify a dictionary, i.e. the k-th roots of unity? 2. How to fix the error?

$\endgroup$
4
  • $\begingroup$ your c is just IdentityMatrix[10]*16, so the answer is (IdentityMatrix[10]*4) $\endgroup$
    – Feyre
    Dec 6, 2016 at 12:43
  • $\begingroup$ It's actually in a X shape, non-zero elements on the diagonal and flipped diagonal. Sorry for the trouble, I've corrected the code $\endgroup$
    – gypsyzz
    Dec 6, 2016 at 14:57
  • $\begingroup$ 1. Avoid capitalized variables, as these may conflict with builtins. 2. m^2 is elementwise square. m.m is matrix square. 3. If you use x[1,1] as a symbolic variable, you can't also use x. You probably wanted to specify Abs[...]==1 for each x[i,j] separately, and then again specify them separately in FindInstance. That's 100 symbolic variables. That's too many and you won't get a solution in a reasonable time. $\endgroup$
    – Szabolcs
    Dec 6, 2016 at 15:03
  • $\begingroup$ But I don't know how to solve this problem. $\endgroup$
    – Szabolcs
    Dec 6, 2016 at 15:03

1 Answer 1

1
$\begingroup$

There's no answer:

Set up, and define all variables used:

c = IdentityMatrix[10]*10 - Reverse[IdentityMatrix[10]*6];
A = Array[x, {10, 10}];
eqs = Thread[Map[Abs, vars = Variables[A]] == 1];

This works, as can be seen here:

s = FindInstance[A^2 == c, vars][[1]];
Simplify[(A^2 /. s) == c]

True

However, with the additional stipulation that the absolute values of all elements are 1, no solution presents itself:

s = FindInstance[Join[{A^2 == c}, eqs], vars]

{}

$\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.