Access to an element
-
How get I access to an element of a list? Below you see the code for evaluating a plane. The last element is the solution I am looking for. But, how can a separate this solution?
$TA=maple("
geom3d[point](P1,[5,2,1]),
geom3d[point](P2,[4,0,-4]),
geom3d[point](P3,[1,1,1]),
geom3d[plane](E1,[P1,P2,P3]),
geom3d[Equation](E1,[x,y,z]);");
$LE=maple("$TA[5]"); #no access to element 5 why???
-
You would need to construct a list/array to pull from... Although I would recommend accomplishing what you are attempting using a single maple call (why have 2???).
To fix what you have:
$selector=range(1,5,1);
$TA=maple("
option1:=geom3d[point](P1,[5,2,1]):
option2:=geom3d[point](P2,[4,0,-4]):
option3:=geom3d[point](P3,[1,1,1]):
option4:=geom3d[plane](E1,[P1,P2,P3]):
option5:=geom3d[Equation](E1,[x,y,z]):
[option1,option2,option3,option4,option5];
");$LE=maple("$TA[$selector]");
A BETTER WAY that is more efficient (single maple call)....
$selector=range(1,5,1);
$TA=maple("
option1:=geom3d[point](P1,[5,2,1]):
option2:=geom3d[point](P2,[4,0,-4]):
option3:=geom3d[point](P3,[1,1,1]):
option4:=geom3d[plane](E1,[P1,P2,P3]):
option5:=geom3d[Equation](E1,[x,y,z]):
listOfAll:=[option1,option2,option3,option4,option5];
selected:=listOfAll[$selector];
[convert(selected,string),convert(listOfAll,string)]
");$theChosenOne=switch(0,$TA);
$theRest=switch(1,$TA);