Basic question from a beginner. Problem with definitions in a bucle. Maple





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Let's suppose we are in this case (I'm using Maple)



add:=function()
e1:=0;
e2:=1;
for j in [1..2]do
ej:=ej+1
od;
return e1,e2;
end;


This program gives me a global variable error. I understand why that happens -- because ej is not defined as local -- but if you define it then the program just doesn't do anything. ) I don't know how to solve it. My objective (in a bigger program) is to call e1,e2 in a for loop.



Maybe I didn't express myself correctly simplifying my problem, there is my Program, it is made with program GAP but it works similar to Maple:



G12Decode:=function(c)
localx,G,C,sG,sH,a,u,b1,e1,b2,e2,b3,e3,b4,e4,b5,e5,b6,e6,h1,h2,i,j;
x:=Codeword(c,GF(3));
G:=[[1,0,0,0,0,0,0,1,1,1,1,1],[0,1,0,0,0,0,1,0,1,2,2,1],
[0,0,1,0,0,0,1,1,0,1,2,2],[0,0,0,1,0,0,1,2,1,0,1,2],
[0,0,0,0,1,0,1,2,2,1,0,1],[0,0,0,0,0,1,1,1,2,2,1,0]];
C:=GeneratorMatCode(G,GF(3));
sG:=x*TransposedMat(GeneratorMat(C));
sH:=x*TransposedMat(CheckMat(C));
a:=[0,0,0,0,0,0];
b1:=Codeword([0,1,1,1,1,1],GF(3));
e1:=Codeword([1,0,0,0,0,0],GF(3));
b2:=Codeword([1,0,1,2,2,1],GF(3));
e2:=Codeword([0,1,0,0,0,0],GF(3));
b3:=Codeword([1,1,0,1,2,2],GF(3));
e3:=Codeword([0,0,1,0,0,0],GF(3));
b4:=Codeword([1,2,1,0,1,2],GF(3));
e4:=Codeword([0,0,0,1,0,0],GF(3));
b5:=Codeword([1,2,2,1,0,1],GF(3));
e5:=Codeword([0,0,0,0,1,0],GF(3));
b6:=Codeword([1,1,2,2,1,0],GF(3));
e6:=Codeword([0,0,0,0,0,1],GF(3));

if Weight(sH)<=2 then
sH:=ShallowCopy(VectorCodeword(sH));
Append(a,sH);
a:=Codeword(a,GF(3));
u:=x-a;
return u;
elif Weight(sG)<=2 then
sG:=ShallowCopy(VectorCodeword(sG));
Append(sG,a);
sG:=Codeword(sG,GF(3));
u:=x-sG;
return u;
else
for i in [1..6] do
for j in [1..6] do
if sG-bi=ej or sG-bi=2*ej then
h1:=sG-bi;
h2:=ei;
h1:=ShallowCopy(VectorCodeword(h1));
h2:=ShallowCopy(VectorCodeword(h2));
Append(h1,h2);
h1:=Codeword(h1,GF(3));
u:=x-h1;
return u;
elif sG-2*bi=ej or sG-2*bi=2*ej then
h1:=sG-2*bi;
h2:=ei;
h1:=ShallowCopy(VectorCodeword(h1));
h2:=ShallowCopy(VectorCodeword(h2));
Append(h1,h2);
h1:=Codeword(h1,GF(3));
u:=x-h1;
return u;
fi;
od;
od;
fi;
end;


The program dont send me an error but i know it don't work because of the ej,bi and ei. I want to do what it says after the last "else" but i don't know how to solve it to make it work.










share|improve this question




















  • 1





    Thanks for wasting my time by tagging this maple when in fact it's all about a GAP program. No, they do not work the same. There are some similarities in language syntax, but nobody with Maple only could run this. Anyway, is it really true that in GAP you can reference bi or ej and magically get values for b3 and e4 if i=3 and j=4 as values for the loop index?!? It sounds doubtful. Perhaps GAP allows you to concatenate names. Or perhaps you could instead declare b and e as arrays (similar to a above?), and then store/reference in b[i], e[j], etc.

    – acer
    Nov 22 '18 at 22:33











  • @acer Sorry about that. But your answer about Maple also was necessary because I'm also working on it. Anyways, I tried what u said and it worked, thank you. And sorry again about that.

    – Lecter
    Nov 23 '18 at 8:53


















0















Let's suppose we are in this case (I'm using Maple)



add:=function()
e1:=0;
e2:=1;
for j in [1..2]do
ej:=ej+1
od;
return e1,e2;
end;


This program gives me a global variable error. I understand why that happens -- because ej is not defined as local -- but if you define it then the program just doesn't do anything. ) I don't know how to solve it. My objective (in a bigger program) is to call e1,e2 in a for loop.



Maybe I didn't express myself correctly simplifying my problem, there is my Program, it is made with program GAP but it works similar to Maple:



G12Decode:=function(c)
localx,G,C,sG,sH,a,u,b1,e1,b2,e2,b3,e3,b4,e4,b5,e5,b6,e6,h1,h2,i,j;
x:=Codeword(c,GF(3));
G:=[[1,0,0,0,0,0,0,1,1,1,1,1],[0,1,0,0,0,0,1,0,1,2,2,1],
[0,0,1,0,0,0,1,1,0,1,2,2],[0,0,0,1,0,0,1,2,1,0,1,2],
[0,0,0,0,1,0,1,2,2,1,0,1],[0,0,0,0,0,1,1,1,2,2,1,0]];
C:=GeneratorMatCode(G,GF(3));
sG:=x*TransposedMat(GeneratorMat(C));
sH:=x*TransposedMat(CheckMat(C));
a:=[0,0,0,0,0,0];
b1:=Codeword([0,1,1,1,1,1],GF(3));
e1:=Codeword([1,0,0,0,0,0],GF(3));
b2:=Codeword([1,0,1,2,2,1],GF(3));
e2:=Codeword([0,1,0,0,0,0],GF(3));
b3:=Codeword([1,1,0,1,2,2],GF(3));
e3:=Codeword([0,0,1,0,0,0],GF(3));
b4:=Codeword([1,2,1,0,1,2],GF(3));
e4:=Codeword([0,0,0,1,0,0],GF(3));
b5:=Codeword([1,2,2,1,0,1],GF(3));
e5:=Codeword([0,0,0,0,1,0],GF(3));
b6:=Codeword([1,1,2,2,1,0],GF(3));
e6:=Codeword([0,0,0,0,0,1],GF(3));

if Weight(sH)<=2 then
sH:=ShallowCopy(VectorCodeword(sH));
Append(a,sH);
a:=Codeword(a,GF(3));
u:=x-a;
return u;
elif Weight(sG)<=2 then
sG:=ShallowCopy(VectorCodeword(sG));
Append(sG,a);
sG:=Codeword(sG,GF(3));
u:=x-sG;
return u;
else
for i in [1..6] do
for j in [1..6] do
if sG-bi=ej or sG-bi=2*ej then
h1:=sG-bi;
h2:=ei;
h1:=ShallowCopy(VectorCodeword(h1));
h2:=ShallowCopy(VectorCodeword(h2));
Append(h1,h2);
h1:=Codeword(h1,GF(3));
u:=x-h1;
return u;
elif sG-2*bi=ej or sG-2*bi=2*ej then
h1:=sG-2*bi;
h2:=ei;
h1:=ShallowCopy(VectorCodeword(h1));
h2:=ShallowCopy(VectorCodeword(h2));
Append(h1,h2);
h1:=Codeword(h1,GF(3));
u:=x-h1;
return u;
fi;
od;
od;
fi;
end;


The program dont send me an error but i know it don't work because of the ej,bi and ei. I want to do what it says after the last "else" but i don't know how to solve it to make it work.










share|improve this question




















  • 1





    Thanks for wasting my time by tagging this maple when in fact it's all about a GAP program. No, they do not work the same. There are some similarities in language syntax, but nobody with Maple only could run this. Anyway, is it really true that in GAP you can reference bi or ej and magically get values for b3 and e4 if i=3 and j=4 as values for the loop index?!? It sounds doubtful. Perhaps GAP allows you to concatenate names. Or perhaps you could instead declare b and e as arrays (similar to a above?), and then store/reference in b[i], e[j], etc.

    – acer
    Nov 22 '18 at 22:33











  • @acer Sorry about that. But your answer about Maple also was necessary because I'm also working on it. Anyways, I tried what u said and it worked, thank you. And sorry again about that.

    – Lecter
    Nov 23 '18 at 8:53














0












0








0








Let's suppose we are in this case (I'm using Maple)



add:=function()
e1:=0;
e2:=1;
for j in [1..2]do
ej:=ej+1
od;
return e1,e2;
end;


This program gives me a global variable error. I understand why that happens -- because ej is not defined as local -- but if you define it then the program just doesn't do anything. ) I don't know how to solve it. My objective (in a bigger program) is to call e1,e2 in a for loop.



Maybe I didn't express myself correctly simplifying my problem, there is my Program, it is made with program GAP but it works similar to Maple:



G12Decode:=function(c)
localx,G,C,sG,sH,a,u,b1,e1,b2,e2,b3,e3,b4,e4,b5,e5,b6,e6,h1,h2,i,j;
x:=Codeword(c,GF(3));
G:=[[1,0,0,0,0,0,0,1,1,1,1,1],[0,1,0,0,0,0,1,0,1,2,2,1],
[0,0,1,0,0,0,1,1,0,1,2,2],[0,0,0,1,0,0,1,2,1,0,1,2],
[0,0,0,0,1,0,1,2,2,1,0,1],[0,0,0,0,0,1,1,1,2,2,1,0]];
C:=GeneratorMatCode(G,GF(3));
sG:=x*TransposedMat(GeneratorMat(C));
sH:=x*TransposedMat(CheckMat(C));
a:=[0,0,0,0,0,0];
b1:=Codeword([0,1,1,1,1,1],GF(3));
e1:=Codeword([1,0,0,0,0,0],GF(3));
b2:=Codeword([1,0,1,2,2,1],GF(3));
e2:=Codeword([0,1,0,0,0,0],GF(3));
b3:=Codeword([1,1,0,1,2,2],GF(3));
e3:=Codeword([0,0,1,0,0,0],GF(3));
b4:=Codeword([1,2,1,0,1,2],GF(3));
e4:=Codeword([0,0,0,1,0,0],GF(3));
b5:=Codeword([1,2,2,1,0,1],GF(3));
e5:=Codeword([0,0,0,0,1,0],GF(3));
b6:=Codeword([1,1,2,2,1,0],GF(3));
e6:=Codeword([0,0,0,0,0,1],GF(3));

if Weight(sH)<=2 then
sH:=ShallowCopy(VectorCodeword(sH));
Append(a,sH);
a:=Codeword(a,GF(3));
u:=x-a;
return u;
elif Weight(sG)<=2 then
sG:=ShallowCopy(VectorCodeword(sG));
Append(sG,a);
sG:=Codeword(sG,GF(3));
u:=x-sG;
return u;
else
for i in [1..6] do
for j in [1..6] do
if sG-bi=ej or sG-bi=2*ej then
h1:=sG-bi;
h2:=ei;
h1:=ShallowCopy(VectorCodeword(h1));
h2:=ShallowCopy(VectorCodeword(h2));
Append(h1,h2);
h1:=Codeword(h1,GF(3));
u:=x-h1;
return u;
elif sG-2*bi=ej or sG-2*bi=2*ej then
h1:=sG-2*bi;
h2:=ei;
h1:=ShallowCopy(VectorCodeword(h1));
h2:=ShallowCopy(VectorCodeword(h2));
Append(h1,h2);
h1:=Codeword(h1,GF(3));
u:=x-h1;
return u;
fi;
od;
od;
fi;
end;


The program dont send me an error but i know it don't work because of the ej,bi and ei. I want to do what it says after the last "else" but i don't know how to solve it to make it work.










share|improve this question
















Let's suppose we are in this case (I'm using Maple)



add:=function()
e1:=0;
e2:=1;
for j in [1..2]do
ej:=ej+1
od;
return e1,e2;
end;


This program gives me a global variable error. I understand why that happens -- because ej is not defined as local -- but if you define it then the program just doesn't do anything. ) I don't know how to solve it. My objective (in a bigger program) is to call e1,e2 in a for loop.



Maybe I didn't express myself correctly simplifying my problem, there is my Program, it is made with program GAP but it works similar to Maple:



G12Decode:=function(c)
localx,G,C,sG,sH,a,u,b1,e1,b2,e2,b3,e3,b4,e4,b5,e5,b6,e6,h1,h2,i,j;
x:=Codeword(c,GF(3));
G:=[[1,0,0,0,0,0,0,1,1,1,1,1],[0,1,0,0,0,0,1,0,1,2,2,1],
[0,0,1,0,0,0,1,1,0,1,2,2],[0,0,0,1,0,0,1,2,1,0,1,2],
[0,0,0,0,1,0,1,2,2,1,0,1],[0,0,0,0,0,1,1,1,2,2,1,0]];
C:=GeneratorMatCode(G,GF(3));
sG:=x*TransposedMat(GeneratorMat(C));
sH:=x*TransposedMat(CheckMat(C));
a:=[0,0,0,0,0,0];
b1:=Codeword([0,1,1,1,1,1],GF(3));
e1:=Codeword([1,0,0,0,0,0],GF(3));
b2:=Codeword([1,0,1,2,2,1],GF(3));
e2:=Codeword([0,1,0,0,0,0],GF(3));
b3:=Codeword([1,1,0,1,2,2],GF(3));
e3:=Codeword([0,0,1,0,0,0],GF(3));
b4:=Codeword([1,2,1,0,1,2],GF(3));
e4:=Codeword([0,0,0,1,0,0],GF(3));
b5:=Codeword([1,2,2,1,0,1],GF(3));
e5:=Codeword([0,0,0,0,1,0],GF(3));
b6:=Codeword([1,1,2,2,1,0],GF(3));
e6:=Codeword([0,0,0,0,0,1],GF(3));

if Weight(sH)<=2 then
sH:=ShallowCopy(VectorCodeword(sH));
Append(a,sH);
a:=Codeword(a,GF(3));
u:=x-a;
return u;
elif Weight(sG)<=2 then
sG:=ShallowCopy(VectorCodeword(sG));
Append(sG,a);
sG:=Codeword(sG,GF(3));
u:=x-sG;
return u;
else
for i in [1..6] do
for j in [1..6] do
if sG-bi=ej or sG-bi=2*ej then
h1:=sG-bi;
h2:=ei;
h1:=ShallowCopy(VectorCodeword(h1));
h2:=ShallowCopy(VectorCodeword(h2));
Append(h1,h2);
h1:=Codeword(h1,GF(3));
u:=x-h1;
return u;
elif sG-2*bi=ej or sG-2*bi=2*ej then
h1:=sG-2*bi;
h2:=ei;
h1:=ShallowCopy(VectorCodeword(h1));
h2:=ShallowCopy(VectorCodeword(h2));
Append(h1,h2);
h1:=Codeword(h1,GF(3));
u:=x-h1;
return u;
fi;
od;
od;
fi;
end;


The program dont send me an error but i know it don't work because of the ej,bi and ei. I want to do what it says after the last "else" but i don't know how to solve it to make it work.







for-loop maple






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 22:07







Lecter

















asked Nov 22 '18 at 18:06









LecterLecter

83




83








  • 1





    Thanks for wasting my time by tagging this maple when in fact it's all about a GAP program. No, they do not work the same. There are some similarities in language syntax, but nobody with Maple only could run this. Anyway, is it really true that in GAP you can reference bi or ej and magically get values for b3 and e4 if i=3 and j=4 as values for the loop index?!? It sounds doubtful. Perhaps GAP allows you to concatenate names. Or perhaps you could instead declare b and e as arrays (similar to a above?), and then store/reference in b[i], e[j], etc.

    – acer
    Nov 22 '18 at 22:33











  • @acer Sorry about that. But your answer about Maple also was necessary because I'm also working on it. Anyways, I tried what u said and it worked, thank you. And sorry again about that.

    – Lecter
    Nov 23 '18 at 8:53














  • 1





    Thanks for wasting my time by tagging this maple when in fact it's all about a GAP program. No, they do not work the same. There are some similarities in language syntax, but nobody with Maple only could run this. Anyway, is it really true that in GAP you can reference bi or ej and magically get values for b3 and e4 if i=3 and j=4 as values for the loop index?!? It sounds doubtful. Perhaps GAP allows you to concatenate names. Or perhaps you could instead declare b and e as arrays (similar to a above?), and then store/reference in b[i], e[j], etc.

    – acer
    Nov 22 '18 at 22:33











  • @acer Sorry about that. But your answer about Maple also was necessary because I'm also working on it. Anyways, I tried what u said and it worked, thank you. And sorry again about that.

    – Lecter
    Nov 23 '18 at 8:53








1




1





Thanks for wasting my time by tagging this maple when in fact it's all about a GAP program. No, they do not work the same. There are some similarities in language syntax, but nobody with Maple only could run this. Anyway, is it really true that in GAP you can reference bi or ej and magically get values for b3 and e4 if i=3 and j=4 as values for the loop index?!? It sounds doubtful. Perhaps GAP allows you to concatenate names. Or perhaps you could instead declare b and e as arrays (similar to a above?), and then store/reference in b[i], e[j], etc.

– acer
Nov 22 '18 at 22:33





Thanks for wasting my time by tagging this maple when in fact it's all about a GAP program. No, they do not work the same. There are some similarities in language syntax, but nobody with Maple only could run this. Anyway, is it really true that in GAP you can reference bi or ej and magically get values for b3 and e4 if i=3 and j=4 as values for the loop index?!? It sounds doubtful. Perhaps GAP allows you to concatenate names. Or perhaps you could instead declare b and e as arrays (similar to a above?), and then store/reference in b[i], e[j], etc.

– acer
Nov 22 '18 at 22:33













@acer Sorry about that. But your answer about Maple also was necessary because I'm also working on it. Anyways, I tried what u said and it worked, thank you. And sorry again about that.

– Lecter
Nov 23 '18 at 8:53





@acer Sorry about that. But your answer about Maple also was necessary because I'm also working on it. Anyways, I tried what u said and it worked, thank you. And sorry again about that.

– Lecter
Nov 23 '18 at 8:53












1 Answer
1






active

oldest

votes


















1














Your syntax is invalid. It is proc, not function.



And add is already a Maple command, so it's a protected name and cannot be assigned to. You have to use another name.



And your syntax for the do-loop is likely not what you want. You probably want for j from 1 to 2 do .



And you really should initialize ej with a value before doing the recursive assignment ej:=ej+1 .



And you might as well declare the procedure's local variables.



Personally, I favour using end do instead of od , and end proc instead of just end , in modern Maple. It makes it easier to tell what's being terminated.



For example,



restart;

my_add:=proc()
local e1,e2,ej,j;
e1:=0;
e2:=1;
ej:=0;
for j from 1 to 5 do
ej:=ej+1
end do;
return ej,e1,e2;
end proc:

my_add();

5, 0, 1


There is a Maple Programming Guide, which you can read online or inside Maple's own Help system. It has a nice introduction to writing procedures. And there is a more detailed Help page for the proc command.






share|improve this answer
























  • I added things in the question. Sorry for not explaine it properly before.

    – Lecter
    Nov 22 '18 at 22:08












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53436252%2fbasic-question-from-a-beginner-problem-with-definitions-in-a-bucle-maple%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









1














Your syntax is invalid. It is proc, not function.



And add is already a Maple command, so it's a protected name and cannot be assigned to. You have to use another name.



And your syntax for the do-loop is likely not what you want. You probably want for j from 1 to 2 do .



And you really should initialize ej with a value before doing the recursive assignment ej:=ej+1 .



And you might as well declare the procedure's local variables.



Personally, I favour using end do instead of od , and end proc instead of just end , in modern Maple. It makes it easier to tell what's being terminated.



For example,



restart;

my_add:=proc()
local e1,e2,ej,j;
e1:=0;
e2:=1;
ej:=0;
for j from 1 to 5 do
ej:=ej+1
end do;
return ej,e1,e2;
end proc:

my_add();

5, 0, 1


There is a Maple Programming Guide, which you can read online or inside Maple's own Help system. It has a nice introduction to writing procedures. And there is a more detailed Help page for the proc command.






share|improve this answer
























  • I added things in the question. Sorry for not explaine it properly before.

    – Lecter
    Nov 22 '18 at 22:08
















1














Your syntax is invalid. It is proc, not function.



And add is already a Maple command, so it's a protected name and cannot be assigned to. You have to use another name.



And your syntax for the do-loop is likely not what you want. You probably want for j from 1 to 2 do .



And you really should initialize ej with a value before doing the recursive assignment ej:=ej+1 .



And you might as well declare the procedure's local variables.



Personally, I favour using end do instead of od , and end proc instead of just end , in modern Maple. It makes it easier to tell what's being terminated.



For example,



restart;

my_add:=proc()
local e1,e2,ej,j;
e1:=0;
e2:=1;
ej:=0;
for j from 1 to 5 do
ej:=ej+1
end do;
return ej,e1,e2;
end proc:

my_add();

5, 0, 1


There is a Maple Programming Guide, which you can read online or inside Maple's own Help system. It has a nice introduction to writing procedures. And there is a more detailed Help page for the proc command.






share|improve this answer
























  • I added things in the question. Sorry for not explaine it properly before.

    – Lecter
    Nov 22 '18 at 22:08














1












1








1







Your syntax is invalid. It is proc, not function.



And add is already a Maple command, so it's a protected name and cannot be assigned to. You have to use another name.



And your syntax for the do-loop is likely not what you want. You probably want for j from 1 to 2 do .



And you really should initialize ej with a value before doing the recursive assignment ej:=ej+1 .



And you might as well declare the procedure's local variables.



Personally, I favour using end do instead of od , and end proc instead of just end , in modern Maple. It makes it easier to tell what's being terminated.



For example,



restart;

my_add:=proc()
local e1,e2,ej,j;
e1:=0;
e2:=1;
ej:=0;
for j from 1 to 5 do
ej:=ej+1
end do;
return ej,e1,e2;
end proc:

my_add();

5, 0, 1


There is a Maple Programming Guide, which you can read online or inside Maple's own Help system. It has a nice introduction to writing procedures. And there is a more detailed Help page for the proc command.






share|improve this answer













Your syntax is invalid. It is proc, not function.



And add is already a Maple command, so it's a protected name and cannot be assigned to. You have to use another name.



And your syntax for the do-loop is likely not what you want. You probably want for j from 1 to 2 do .



And you really should initialize ej with a value before doing the recursive assignment ej:=ej+1 .



And you might as well declare the procedure's local variables.



Personally, I favour using end do instead of od , and end proc instead of just end , in modern Maple. It makes it easier to tell what's being terminated.



For example,



restart;

my_add:=proc()
local e1,e2,ej,j;
e1:=0;
e2:=1;
ej:=0;
for j from 1 to 5 do
ej:=ej+1
end do;
return ej,e1,e2;
end proc:

my_add();

5, 0, 1


There is a Maple Programming Guide, which you can read online or inside Maple's own Help system. It has a nice introduction to writing procedures. And there is a more detailed Help page for the proc command.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 21:12









aceracer

5,0071015




5,0071015













  • I added things in the question. Sorry for not explaine it properly before.

    – Lecter
    Nov 22 '18 at 22:08



















  • I added things in the question. Sorry for not explaine it properly before.

    – Lecter
    Nov 22 '18 at 22:08

















I added things in the question. Sorry for not explaine it properly before.

– Lecter
Nov 22 '18 at 22:08





I added things in the question. Sorry for not explaine it properly before.

– Lecter
Nov 22 '18 at 22:08




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53436252%2fbasic-question-from-a-beginner-problem-with-definitions-in-a-bucle-maple%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?