Post Reply 
index and find cmd
12-16-2018, 11:38 PM (This post was last modified: 12-16-2018 11:53 PM by compsystems.)
Post: #3
RE: index and find cmd
on XCAS PC, Help Button.

Quote:Index of the first position of an object in a list, a string or a set or return an error message.
index(Vect,Expr)

index -> 0
index( [ 3, x, 1, 2, 1, 3 ],1) [↵] 2
index( [ 0, 1, 3, 2,4,2,5 ],2) [↵] 3
index( %{4, 3, 1, 2 %}, 1 ) [↵] 2
index("abracadabrant","c") [↵] 4



Index acts as a system variable and as a functional command,

For functional command:
Index() returns the first position of an object in a list, a string or a set, if it does not find the object returns an error message. "Error: Bad Argument Value[/code]"

index(List/String/Set,Object)

LIST:
index:=0:; index([9,8,-1,8,9,8,7],8) [↵] returns "Done",1
index:=1:; index([9,8,-1,8,9,8,7],8) [↵] returns "Done",2

SET:
index:=0:; F_ := set[ H_,E_,L_,L_,O_];
F_ => set[ H_,E_,L_,O_]; // the multiplicity of L_ is eliminated
index(F_,O_) [↵] returns 3
index(F_,L_) [↵] returns 2

Table with string as index
https://www-fourier.ujf-grenoble.fr/~par...de407.html

T_:= table( 3=-10, "a"=10, "b"=20, "c"=30, "d"=40 ) [↵]
T_["b"] [↵] 20, Why it changes to T_("b1") on history view, I think the history view engine has to be improved.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
index and find cmd - compsystems - 12-16-2018, 06:31 PM
RE: index and find cmd - cdmackay - 12-16-2018, 07:34 PM
RE: index and find cmd - compsystems - 12-16-2018 11:38 PM
RE: index and find cmd - cdmackay - 12-17-2018, 12:02 AM
RE: index and find cmd - rprosperi - 12-17-2018, 12:25 AM
RE: index and find cmd - cdmackay - 12-17-2018, 01:04 AM
RE: index and find cmd - compsystems - 12-17-2018, 02:35 AM



User(s) browsing this thread: 1 Guest(s)