make a slider for a list of matrices
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have a list of matrices, called $matList$, which are sequentially multiplied by another matrix $G$. I created a slider for $matList$, but the slider does not work. Here is the Code
.
Clear[a, t, matList, G, solG, solGTr, mat];
Manipulate[
SeedRandom[2];
a = RandomReal[0, 1, 3, 5];
t = RandomReal[0, 1, 3, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[
KroneckerProduct[a[[i]], t[[i]]]], i, 1, 3];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
0, 1, 0, 0, 1, 0;
solG = G*mat;
solGTr = Transpose[solG];
Grid[
Text["matrix solG"], Text["transpose of solG"], solG, solGTr
],
Row[Control[mat, matList, Animator, AnimationRunning -> False]]
]
The problem in the above Code
lies in Row[{control[mat,matList,...]
. A similar construct for a slider of a list of numbers works, though.
manipulate slider
add a comment |Â
up vote
1
down vote
favorite
I have a list of matrices, called $matList$, which are sequentially multiplied by another matrix $G$. I created a slider for $matList$, but the slider does not work. Here is the Code
.
Clear[a, t, matList, G, solG, solGTr, mat];
Manipulate[
SeedRandom[2];
a = RandomReal[0, 1, 3, 5];
t = RandomReal[0, 1, 3, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[
KroneckerProduct[a[[i]], t[[i]]]], i, 1, 3];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
0, 1, 0, 0, 1, 0;
solG = G*mat;
solGTr = Transpose[solG];
Grid[
Text["matrix solG"], Text["transpose of solG"], solG, solGTr
],
Row[Control[mat, matList, Animator, AnimationRunning -> False]]
]
The problem in the above Code
lies in Row[{control[mat,matList,...]
. A similar construct for a slider of a list of numbers works, though.
manipulate slider
1
ReplacesolG = G*mat
withsolG = G*matList[[k]]
, andRow[...]
withk, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
.
– kglr
56 mins ago
1
Related/duplicate: mathematica.stackexchange.com/questions/123152/…
– Michael E2
15 mins ago
@kglr: Thank you very much for saving my day....
– Tebernus
12 mins ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a list of matrices, called $matList$, which are sequentially multiplied by another matrix $G$. I created a slider for $matList$, but the slider does not work. Here is the Code
.
Clear[a, t, matList, G, solG, solGTr, mat];
Manipulate[
SeedRandom[2];
a = RandomReal[0, 1, 3, 5];
t = RandomReal[0, 1, 3, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[
KroneckerProduct[a[[i]], t[[i]]]], i, 1, 3];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
0, 1, 0, 0, 1, 0;
solG = G*mat;
solGTr = Transpose[solG];
Grid[
Text["matrix solG"], Text["transpose of solG"], solG, solGTr
],
Row[Control[mat, matList, Animator, AnimationRunning -> False]]
]
The problem in the above Code
lies in Row[{control[mat,matList,...]
. A similar construct for a slider of a list of numbers works, though.
manipulate slider
I have a list of matrices, called $matList$, which are sequentially multiplied by another matrix $G$. I created a slider for $matList$, but the slider does not work. Here is the Code
.
Clear[a, t, matList, G, solG, solGTr, mat];
Manipulate[
SeedRandom[2];
a = RandomReal[0, 1, 3, 5];
t = RandomReal[0, 1, 3, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[
KroneckerProduct[a[[i]], t[[i]]]], i, 1, 3];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
0, 1, 0, 0, 1, 0;
solG = G*mat;
solGTr = Transpose[solG];
Grid[
Text["matrix solG"], Text["transpose of solG"], solG, solGTr
],
Row[Control[mat, matList, Animator, AnimationRunning -> False]]
]
The problem in the above Code
lies in Row[{control[mat,matList,...]
. A similar construct for a slider of a list of numbers works, though.
manipulate slider
manipulate slider
asked 1 hour ago


Tebernus
747
747
1
ReplacesolG = G*mat
withsolG = G*matList[[k]]
, andRow[...]
withk, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
.
– kglr
56 mins ago
1
Related/duplicate: mathematica.stackexchange.com/questions/123152/…
– Michael E2
15 mins ago
@kglr: Thank you very much for saving my day....
– Tebernus
12 mins ago
add a comment |Â
1
ReplacesolG = G*mat
withsolG = G*matList[[k]]
, andRow[...]
withk, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
.
– kglr
56 mins ago
1
Related/duplicate: mathematica.stackexchange.com/questions/123152/…
– Michael E2
15 mins ago
@kglr: Thank you very much for saving my day....
– Tebernus
12 mins ago
1
1
Replace
solG = G*mat
withsolG = G*matList[[k]]
, and Row[...]
with k, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
.– kglr
56 mins ago
Replace
solG = G*mat
withsolG = G*matList[[k]]
, and Row[...]
with k, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
.– kglr
56 mins ago
1
1
Related/duplicate: mathematica.stackexchange.com/questions/123152/…
– Michael E2
15 mins ago
Related/duplicate: mathematica.stackexchange.com/questions/123152/…
– Michael E2
15 mins ago
@kglr: Thank you very much for saving my day....
– Tebernus
12 mins ago
@kglr: Thank you very much for saving my day....
– Tebernus
12 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
Maybe if you want a slider, use Slider
:
SeedRandom[2];
a = RandomReal[0, 1, 3, 5];
t = RandomReal[0, 1, 3, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[
KroneckerProduct[a[[i]], t[[i]]]], i, 1, 3];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
0, 1, 0, 0, 1, 0;
Manipulate[
With[solG = G*mat, solGTr = Transpose[solG],
Grid[Text["matrix solG"], Text["transpose of solG"],
MatrixForm /@ solG, solGTr]
],
mat, matList, Slider]
Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
– Tebernus
4 mins ago
add a comment |Â
up vote
1
down vote
More an extended comment than an answer.
In addition to what kglr has said, you might have much more fun with this if you move the random matrix generation and the preliminary calculations out of the Manipulate
environment:
Clear[a, t, matList, G, solG, solGTr, mat];
SeedRandom[2];
n = 30;
a = RandomReal[0, 1, n, 5];
t = RandomReal[0, 1, n, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[KroneckerProduct[a[[i]], t[[i]]]],
i, 1, n];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,0, 1, 0, 0, 1, 0;
Manipulate[
solG = G*matList[[k]];
solGTr = Transpose[solG];
Grid[Text["matrix solG"], Text["transpose of solG"], solG,solGTr],
k, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
]
it works perfect. You and kglr saved my day...
– Tebernus
13 mins ago
Always at your service. =)
– Henrik Schumacher
9 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Maybe if you want a slider, use Slider
:
SeedRandom[2];
a = RandomReal[0, 1, 3, 5];
t = RandomReal[0, 1, 3, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[
KroneckerProduct[a[[i]], t[[i]]]], i, 1, 3];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
0, 1, 0, 0, 1, 0;
Manipulate[
With[solG = G*mat, solGTr = Transpose[solG],
Grid[Text["matrix solG"], Text["transpose of solG"],
MatrixForm /@ solG, solGTr]
],
mat, matList, Slider]
Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
– Tebernus
4 mins ago
add a comment |Â
up vote
2
down vote
accepted
Maybe if you want a slider, use Slider
:
SeedRandom[2];
a = RandomReal[0, 1, 3, 5];
t = RandomReal[0, 1, 3, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[
KroneckerProduct[a[[i]], t[[i]]]], i, 1, 3];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
0, 1, 0, 0, 1, 0;
Manipulate[
With[solG = G*mat, solGTr = Transpose[solG],
Grid[Text["matrix solG"], Text["transpose of solG"],
MatrixForm /@ solG, solGTr]
],
mat, matList, Slider]
Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
– Tebernus
4 mins ago
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Maybe if you want a slider, use Slider
:
SeedRandom[2];
a = RandomReal[0, 1, 3, 5];
t = RandomReal[0, 1, 3, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[
KroneckerProduct[a[[i]], t[[i]]]], i, 1, 3];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
0, 1, 0, 0, 1, 0;
Manipulate[
With[solG = G*mat, solGTr = Transpose[solG],
Grid[Text["matrix solG"], Text["transpose of solG"],
MatrixForm /@ solG, solGTr]
],
mat, matList, Slider]
Maybe if you want a slider, use Slider
:
SeedRandom[2];
a = RandomReal[0, 1, 3, 5];
t = RandomReal[0, 1, 3, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[
KroneckerProduct[a[[i]], t[[i]]]], i, 1, 3];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
0, 1, 0, 0, 1, 0;
Manipulate[
With[solG = G*mat, solGTr = Transpose[solG],
Grid[Text["matrix solG"], Text["transpose of solG"],
MatrixForm /@ solG, solGTr]
],
mat, matList, Slider]
answered 16 mins ago
Michael E2
141k11191457
141k11191457
Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
– Tebernus
4 mins ago
add a comment |Â
Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
– Tebernus
4 mins ago
Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
– Tebernus
4 mins ago
Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
– Tebernus
4 mins ago
add a comment |Â
up vote
1
down vote
More an extended comment than an answer.
In addition to what kglr has said, you might have much more fun with this if you move the random matrix generation and the preliminary calculations out of the Manipulate
environment:
Clear[a, t, matList, G, solG, solGTr, mat];
SeedRandom[2];
n = 30;
a = RandomReal[0, 1, n, 5];
t = RandomReal[0, 1, n, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[KroneckerProduct[a[[i]], t[[i]]]],
i, 1, n];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,0, 1, 0, 0, 1, 0;
Manipulate[
solG = G*matList[[k]];
solGTr = Transpose[solG];
Grid[Text["matrix solG"], Text["transpose of solG"], solG,solGTr],
k, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
]
it works perfect. You and kglr saved my day...
– Tebernus
13 mins ago
Always at your service. =)
– Henrik Schumacher
9 mins ago
add a comment |Â
up vote
1
down vote
More an extended comment than an answer.
In addition to what kglr has said, you might have much more fun with this if you move the random matrix generation and the preliminary calculations out of the Manipulate
environment:
Clear[a, t, matList, G, solG, solGTr, mat];
SeedRandom[2];
n = 30;
a = RandomReal[0, 1, n, 5];
t = RandomReal[0, 1, n, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[KroneckerProduct[a[[i]], t[[i]]]],
i, 1, n];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,0, 1, 0, 0, 1, 0;
Manipulate[
solG = G*matList[[k]];
solGTr = Transpose[solG];
Grid[Text["matrix solG"], Text["transpose of solG"], solG,solGTr],
k, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
]
it works perfect. You and kglr saved my day...
– Tebernus
13 mins ago
Always at your service. =)
– Henrik Schumacher
9 mins ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
More an extended comment than an answer.
In addition to what kglr has said, you might have much more fun with this if you move the random matrix generation and the preliminary calculations out of the Manipulate
environment:
Clear[a, t, matList, G, solG, solGTr, mat];
SeedRandom[2];
n = 30;
a = RandomReal[0, 1, n, 5];
t = RandomReal[0, 1, n, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[KroneckerProduct[a[[i]], t[[i]]]],
i, 1, n];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,0, 1, 0, 0, 1, 0;
Manipulate[
solG = G*matList[[k]];
solGTr = Transpose[solG];
Grid[Text["matrix solG"], Text["transpose of solG"], solG,solGTr],
k, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
]
More an extended comment than an answer.
In addition to what kglr has said, you might have much more fun with this if you move the random matrix generation and the preliminary calculations out of the Manipulate
environment:
Clear[a, t, matList, G, solG, solGTr, mat];
SeedRandom[2];
n = 30;
a = RandomReal[0, 1, n, 5];
t = RandomReal[0, 1, n, 5];
matList =
Table[(# - DiagonalMatrix[Diagonal[#]]) &[KroneckerProduct[a[[i]], t[[i]]]],
i, 1, n];
G = 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,0, 1, 0, 0, 1, 0;
Manipulate[
solG = G*matList[[k]];
solGTr = Transpose[solG];
Grid[Text["matrix solG"], Text["transpose of solG"], solG,solGTr],
k, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
]
answered 33 mins ago


Henrik Schumacher
40.5k256121
40.5k256121
it works perfect. You and kglr saved my day...
– Tebernus
13 mins ago
Always at your service. =)
– Henrik Schumacher
9 mins ago
add a comment |Â
it works perfect. You and kglr saved my day...
– Tebernus
13 mins ago
Always at your service. =)
– Henrik Schumacher
9 mins ago
it works perfect. You and kglr saved my day...
– Tebernus
13 mins ago
it works perfect. You and kglr saved my day...
– Tebernus
13 mins ago
Always at your service. =)
– Henrik Schumacher
9 mins ago
Always at your service. =)
– Henrik Schumacher
9 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f183023%2fmake-a-slider-for-a-list-of-matrices%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Replace
solG = G*mat
withsolG = G*matList[[k]]
, andRow[...]
withk, 1, 1, Length@matList, 1, Animator, AnimationRunning -> False
.– kglr
56 mins ago
1
Related/duplicate: mathematica.stackexchange.com/questions/123152/…
– Michael E2
15 mins ago
@kglr: Thank you very much for saving my day....
– Tebernus
12 mins ago