make a slider for a list of matrices

The name of the pictureThe name of the pictureThe name of the pictureClash 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.










share|improve this question

















  • 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






  • 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














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.










share|improve this question

















  • 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






  • 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












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.










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 1 hour ago









Tebernus

747




747







  • 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






  • 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




    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




    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










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]





share|improve this answer




















  • Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
    – Tebernus
    4 mins ago

















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
]





share|improve this answer




















  • it works perfect. You and kglr saved my day...
    – Tebernus
    13 mins ago










  • Always at your service. =)
    – Henrik Schumacher
    9 mins ago











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























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]





share|improve this answer




















  • Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
    – Tebernus
    4 mins ago














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]





share|improve this answer




















  • Your answer is yet another very good answer, formatting the output in MatrixForm for better visual effect.
    – Tebernus
    4 mins ago












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]





share|improve this answer












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]






share|improve this answer












share|improve this answer



share|improve this answer










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
















  • 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










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
]





share|improve this answer




















  • it works perfect. You and kglr saved my day...
    – Tebernus
    13 mins ago










  • Always at your service. =)
    – Henrik Schumacher
    9 mins ago















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
]





share|improve this answer




















  • it works perfect. You and kglr saved my day...
    – Tebernus
    13 mins ago










  • Always at your service. =)
    – Henrik Schumacher
    9 mins ago













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
]





share|improve this answer












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
]






share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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


















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

List of Gilmore Girls characters

What does second last employer means? [closed]

One-line joke