How to make a list of variables in Magma(computer algebra system)?
In sagemath, for making a list of variables like $ Z=[z00,z01,z02, ... ,z97,z98,z99] $ we can use this code: sage: Z = list(var('z%i%i' % (i,j)) for i in range(10) for j in range(10))
In Magam, it is easy to make a list like $Z=[[0,0],[0,1],[0,2],...,[9,7],[9,8],[9,9]] $ with this code: > Z := [[i,j]: j in [0..9], i in [0..9]];
, but now I try to make a list in Magma that its elemnts are variables such as $z00$ ,not lists like $[0,0]$. How can I make a list of variables in Magma?
In this regard, I found this useful appendix The Magma Language.
It introduced this code:> printf"z%o%o" , 0, 0;
for printing $z00$
, but "z%o%o" , 0, 0;
is not work in a list or in a loop such as for
.
('z%i%i' % (i,j)
is a code that used in each part of sagemath such as a list, but in Magma “z%o%o ”, 0, 0;
works only with printf
and we cannot use it for making a list in Magma )
math-software sagemath magma-cas
add a comment |
In sagemath, for making a list of variables like $ Z=[z00,z01,z02, ... ,z97,z98,z99] $ we can use this code: sage: Z = list(var('z%i%i' % (i,j)) for i in range(10) for j in range(10))
In Magam, it is easy to make a list like $Z=[[0,0],[0,1],[0,2],...,[9,7],[9,8],[9,9]] $ with this code: > Z := [[i,j]: j in [0..9], i in [0..9]];
, but now I try to make a list in Magma that its elemnts are variables such as $z00$ ,not lists like $[0,0]$. How can I make a list of variables in Magma?
In this regard, I found this useful appendix The Magma Language.
It introduced this code:> printf"z%o%o" , 0, 0;
for printing $z00$
, but "z%o%o" , 0, 0;
is not work in a list or in a loop such as for
.
('z%i%i' % (i,j)
is a code that used in each part of sagemath such as a list, but in Magma “z%o%o ”, 0, 0;
works only with printf
and we cannot use it for making a list in Magma )
math-software sagemath magma-cas
1
What do you want to do with the generated variables?
– Somos
Nov 21 '18 at 13:09
l := [ ]; for i in [1..10] do l[i] := i; end for; l;
– reuns
Nov 21 '18 at 13:32
Thank you so much @Somos, your previous answer was correct. But now I want to make PolynomialRing with this list. For example in sagemath we can use this code:P = PolynomialRing(GF(2), [str(i) for i in Z], order='lex')
for making this PolynomialRing with a list like Z. In Magma, how can I make this PolynomialRing with this list?
– s.m.h
Nov 21 '18 at 13:51
1
....R := PolynomialRing(Integers(), #l);
then the variables areR.i
– reuns
Nov 21 '18 at 14:45
add a comment |
In sagemath, for making a list of variables like $ Z=[z00,z01,z02, ... ,z97,z98,z99] $ we can use this code: sage: Z = list(var('z%i%i' % (i,j)) for i in range(10) for j in range(10))
In Magam, it is easy to make a list like $Z=[[0,0],[0,1],[0,2],...,[9,7],[9,8],[9,9]] $ with this code: > Z := [[i,j]: j in [0..9], i in [0..9]];
, but now I try to make a list in Magma that its elemnts are variables such as $z00$ ,not lists like $[0,0]$. How can I make a list of variables in Magma?
In this regard, I found this useful appendix The Magma Language.
It introduced this code:> printf"z%o%o" , 0, 0;
for printing $z00$
, but "z%o%o" , 0, 0;
is not work in a list or in a loop such as for
.
('z%i%i' % (i,j)
is a code that used in each part of sagemath such as a list, but in Magma “z%o%o ”, 0, 0;
works only with printf
and we cannot use it for making a list in Magma )
math-software sagemath magma-cas
In sagemath, for making a list of variables like $ Z=[z00,z01,z02, ... ,z97,z98,z99] $ we can use this code: sage: Z = list(var('z%i%i' % (i,j)) for i in range(10) for j in range(10))
In Magam, it is easy to make a list like $Z=[[0,0],[0,1],[0,2],...,[9,7],[9,8],[9,9]] $ with this code: > Z := [[i,j]: j in [0..9], i in [0..9]];
, but now I try to make a list in Magma that its elemnts are variables such as $z00$ ,not lists like $[0,0]$. How can I make a list of variables in Magma?
In this regard, I found this useful appendix The Magma Language.
It introduced this code:> printf"z%o%o" , 0, 0;
for printing $z00$
, but "z%o%o" , 0, 0;
is not work in a list or in a loop such as for
.
('z%i%i' % (i,j)
is a code that used in each part of sagemath such as a list, but in Magma “z%o%o ”, 0, 0;
works only with printf
and we cannot use it for making a list in Magma )
math-software sagemath magma-cas
math-software sagemath magma-cas
edited Nov 21 '18 at 14:33
Arnaud D.
15.7k52443
15.7k52443
asked Nov 21 '18 at 10:35
s.m.h
102
102
1
What do you want to do with the generated variables?
– Somos
Nov 21 '18 at 13:09
l := [ ]; for i in [1..10] do l[i] := i; end for; l;
– reuns
Nov 21 '18 at 13:32
Thank you so much @Somos, your previous answer was correct. But now I want to make PolynomialRing with this list. For example in sagemath we can use this code:P = PolynomialRing(GF(2), [str(i) for i in Z], order='lex')
for making this PolynomialRing with a list like Z. In Magma, how can I make this PolynomialRing with this list?
– s.m.h
Nov 21 '18 at 13:51
1
....R := PolynomialRing(Integers(), #l);
then the variables areR.i
– reuns
Nov 21 '18 at 14:45
add a comment |
1
What do you want to do with the generated variables?
– Somos
Nov 21 '18 at 13:09
l := [ ]; for i in [1..10] do l[i] := i; end for; l;
– reuns
Nov 21 '18 at 13:32
Thank you so much @Somos, your previous answer was correct. But now I want to make PolynomialRing with this list. For example in sagemath we can use this code:P = PolynomialRing(GF(2), [str(i) for i in Z], order='lex')
for making this PolynomialRing with a list like Z. In Magma, how can I make this PolynomialRing with this list?
– s.m.h
Nov 21 '18 at 13:51
1
....R := PolynomialRing(Integers(), #l);
then the variables areR.i
– reuns
Nov 21 '18 at 14:45
1
1
What do you want to do with the generated variables?
– Somos
Nov 21 '18 at 13:09
What do you want to do with the generated variables?
– Somos
Nov 21 '18 at 13:09
l := [ ]; for i in [1..10] do l[i] := i; end for; l;
– reuns
Nov 21 '18 at 13:32
l := [ ]; for i in [1..10] do l[i] := i; end for; l;
– reuns
Nov 21 '18 at 13:32
Thank you so much @Somos, your previous answer was correct. But now I want to make PolynomialRing with this list. For example in sagemath we can use this code:
P = PolynomialRing(GF(2), [str(i) for i in Z], order='lex')
for making this PolynomialRing with a list like Z. In Magma, how can I make this PolynomialRing with this list?– s.m.h
Nov 21 '18 at 13:51
Thank you so much @Somos, your previous answer was correct. But now I want to make PolynomialRing with this list. For example in sagemath we can use this code:
P = PolynomialRing(GF(2), [str(i) for i in Z], order='lex')
for making this PolynomialRing with a list like Z. In Magma, how can I make this PolynomialRing with this list?– s.m.h
Nov 21 '18 at 13:51
1
1
....
R := PolynomialRing(Integers(), #l);
then the variables are R.i
– reuns
Nov 21 '18 at 14:45
....
R := PolynomialRing(Integers(), #l);
then the variables are R.i
– reuns
Nov 21 '18 at 14:45
add a comment |
1 Answer
1
active
oldest
votes
Try this as an example of what can be done.
v := ["z" * IntegerToString(i) : i in [0..3] ];
Z := IntegerRing();
S := PolynomialRing(Z, 4);
AssignNames(~S, v);
p := S.1 + 2*S.2^2 + 3*S.3^3 + 4*S.4^4;
p;
add a comment |
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: "69"
};
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',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3007544%2fhow-to-make-a-list-of-variables-in-magmacomputer-algebra-system%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this as an example of what can be done.
v := ["z" * IntegerToString(i) : i in [0..3] ];
Z := IntegerRing();
S := PolynomialRing(Z, 4);
AssignNames(~S, v);
p := S.1 + 2*S.2^2 + 3*S.3^3 + 4*S.4^4;
p;
add a comment |
Try this as an example of what can be done.
v := ["z" * IntegerToString(i) : i in [0..3] ];
Z := IntegerRing();
S := PolynomialRing(Z, 4);
AssignNames(~S, v);
p := S.1 + 2*S.2^2 + 3*S.3^3 + 4*S.4^4;
p;
add a comment |
Try this as an example of what can be done.
v := ["z" * IntegerToString(i) : i in [0..3] ];
Z := IntegerRing();
S := PolynomialRing(Z, 4);
AssignNames(~S, v);
p := S.1 + 2*S.2^2 + 3*S.3^3 + 4*S.4^4;
p;
Try this as an example of what can be done.
v := ["z" * IntegerToString(i) : i in [0..3] ];
Z := IntegerRing();
S := PolynomialRing(Z, 4);
AssignNames(~S, v);
p := S.1 + 2*S.2^2 + 3*S.3^3 + 4*S.4^4;
p;
edited Nov 21 '18 at 15:33
answered Nov 21 '18 at 12:27
Somos
13k11034
13k11034
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3007544%2fhow-to-make-a-list-of-variables-in-magmacomputer-algebra-system%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What do you want to do with the generated variables?
– Somos
Nov 21 '18 at 13:09
l := [ ]; for i in [1..10] do l[i] := i; end for; l;
– reuns
Nov 21 '18 at 13:32
Thank you so much @Somos, your previous answer was correct. But now I want to make PolynomialRing with this list. For example in sagemath we can use this code:
P = PolynomialRing(GF(2), [str(i) for i in Z], order='lex')
for making this PolynomialRing with a list like Z. In Magma, how can I make this PolynomialRing with this list?– s.m.h
Nov 21 '18 at 13:51
1
....
R := PolynomialRing(Integers(), #l);
then the variables areR.i
– reuns
Nov 21 '18 at 14:45