index and find cmd
|
12-16-2018, 06:31 PM
(This post was last modified: 12-17-2018 03:40 AM by compsystems.)
Post: #1
|
|||
|
|||
index and find cmd
Hello
Please try the following instructions on the hp-prime calculator: index:=1:; E_ := [ "H", "E", "L", "L", "O" ]:; find( "L", E_ ); index(E_,"L"); [enter] "Done","Done",[3,4],3 // ok Now index -> 0 index:=0:; E_ := [ "H", "E", "L", "L", "O" ]:; find( "L", E_ ); index(E_,"L"); [enter] "Done","Done",2,2 the output should be "Done","Done",[2,3],2 index:=1:;index("abracadabrant","c") [enter] error // the output should be 5 index:=0:;index("abracadabrant","c") [enter] -1 // the output should be 4 Thanks |
|||
12-16-2018, 07:34 PM
Post: #2
|
|||
|
|||
RE: index and find cmd
Where is the index() function documented?
Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
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 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. |
|||
12-17-2018, 12:02 AM
Post: #4
|
|||
|
|||
RE: index and find cmd
(12-16-2018 11:38 PM)compsystems Wrote: on XCAS PC, Help Button. Ah, I wondered about that. Is the Prime documented as having a complete port of XCas? If not, then things like this are presumably classed as undocumented behaviour, and it may not be reasonable to be documenting them here as bugs. That is, unless we consider it to be a Prime documentation bug that it's not mentioned? But perhaps there's a reason for that. Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
12-17-2018, 12:25 AM
Post: #5
|
|||
|
|||
RE: index and find cmd
(12-17-2018 12:02 AM)cdmackay Wrote: Is the Prime documented as having a complete port of XCas? If not, then things like this are presumably classed as undocumented behaviour, and it may not be reasonable to be documenting them here as bugs. As has been explained many times, many XCas functions are NOT intended to be used in Prime, and therefore have not been documented, may have bugs, etc. Nevertheless, due to the nature of the integrated CAS design/code, some of these are still 'discoverable' in the Prime port as it would be quite some considerable work to to remove them from the code base that is ported. If a function is not documented, it can safely be considered not supported, and hence if it is found and explored, unexpected (possibly even incorrect) behavior should not be considered bugs, since an undocumented feature has no correct or incorrect behaviour. That said, there have been some undocumented features that have been found, and accidentally or otherwise behave as expected and/or correctly. IMHO, these should be considered serendipity, and documented here (once tested and verified by the finder) so other folks can benefit and possibly use that feature. It seems to me that rather than endlessly reporting all the parts of XCas that aren't in the Prime, or present but buggy, it would be much more helpful to explain how such a feature could be useful to a significant number of users, to give HP rationale and motivation to fix the issue and promote it to documented and supported. And while I certainly don't understand many of these at all, I think it's safe to say that features that are only understood by a handful of Mathematics geniuses like Parisse aren't likely candidates for such promotion. With only limited resources to invest into Prime development, it doesn't make sense to squander that on obscure features only a small number of prospective customers would use. All this is simply IMHO, but I think most would agree it makes sense. --Bob Prosperi |
|||
12-17-2018, 01:04 AM
Post: #6
|
|||
|
|||
RE: index and find cmd
thanks Bob, makes sense to me.
Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
12-17-2018, 02:35 AM
(This post was last modified: 12-17-2018 03:38 AM by compsystems.)
Post: #7
|
|||
|
|||
RE: index and find cmd
The functions that I expose if they are important, please verify in link, http://www.hpmuseum.org/forum/thread-8577-page-3.html
For example, it is necessary to detect specific data types, for this the funtion subtype() cmd is required Xcas subtype(set[a,a,b]),subtype(poly1[0,0,3,-1]),subtype(a,a,b) [↵] returns 2,10,1 Other function type commands to incorporate: equal2diff, list2exp Sample c:=circle(0,2); b:=4x^2+3x*y+y^2-8; a:=equal2diff(equation(c)); r:=resultant(a,b,x); sy:=solve(r=0,y,'='); sx:=sy:; list2exp(sy,y); [↵] returns y=(-(sqrt((sqrt(17)+7)/3) or y=(-(sqrt((-(sqrt(17))+7)/3) or y=(sqrt((-(sqrt(17))+7)/3) or (y=(sqrt((sqrt(17)+7)/3) Test on-line, press session Xcas sublink https://xcas.univ-grenoble-alpes.fr/foru...28&p=10708 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)