![]() |
HP-Prime/Xcas: vector/list indexing - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: HP-Prime/Xcas: vector/list indexing (/thread-254034.html) |
HP-Prime/Xcas: vector/list indexing - fhub - 10-27-2013 I don't know if this has already been addressed here, but I just found this issue when I experimented a bit with ODEs in Xcas and the HP-Prime.
There's an inconsistency between the 'Home' and CAS mode:
Argh, that's really terrible and absolutely unusual (and unacceptable) in mathematics. I know that starting array indexing with 0 is usual practice in some programming languages, but NOT in math, and I can't believe that someone could come up with this idea. Franz
Edited: 27 Oct 2013, 2:56 p.m.
Re: HP-Prime/Xcas: vector/list indexing - Les Koller - 10-27-2013 I agree. I can understand (but loathe) the need to start at 0 in a programming language, but I always write my code around this to make element 1, element 1. True, in math, this should be totally unacceptable.
Re: HP-Prime/Xcas: vector/list indexing - fhub - 10-27-2013 Yes, just think of a program you wrote in CAS mode which uses vector elements, and now you call this program in Home mode - you'll get a complete nonsense.
Example: define v:=[a,b,c] in CAS mode
Franz
Re: HP-Prime/Xcas: vector/list indexing - Les Koller - 10-27-2013 Hear this HP? This HAS to be fixed. Preferably starting with ONE instead of ZERO. I can work around starting with ZERO, but it HAS to be consistent between modes on a single calculator.
Re: HP-Prime/Xcas: vector/list indexing - parisse - 10-27-2013 Inside the CAS (and Xcas) you have two choices for array indices: start at 0 using [] delimiters or start at 1 using (). You just need to take care inside loop for () notation that f(j):=j+1 is ambiguous (function definition or assignation). In Xcas, you can use [[]] instead of ().
Re: HP-Prime/Xcas: vector/list indexing - Les Koller - 10-27-2013 Thanks for that information. Making a note now..
Re: HP-Prime/Xcas: vector/list indexing - fhub - 10-27-2013 Quote:Thanks for the info, I didn't know that () could be used for indexing. I've just tried it and this also works in Prime's Home mode, i.e. with () the results for Home and CAS mode are the same. So unless this issue with [] has been solved, it's definitely better to only use () for list or vector indices in the Prime. Franz
Edited: 27 Oct 2013, 4:53 p.m.
|