HP Forums

Full Version: CAS: Matrix Index Display
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Not a big deal, but somewhat annoying - -in CAS, it is possible to directly refer to elements of a matrix by row and column numbers within brackets, e.g.

[[2 3][4 5]][2 1] returns 4.

However, the history screen now shows [[2 3][4 5]]([1 1]); the row number is decreased by 1, but the column number is correct.

Copying this reveals the correct indices again, but the history stays wrong.

Vector indices appear to be displayed correctly.
Yes there is something weird.

Did you also get this message?

“Python compatibility enabled. List index will start at 0, run index:=1 or of:=1 to disable Python compatibility.”

[[11,12],[21,22]][1,1] in command line gives [[11,12],[21,22]]([1,2]) in history.

When index:=1, the previous line in history is displayed as [[...]][2,2] in command line.
And then:

[[11,12],[21,22]][1,1] in command line gives [[11,12],[21,22]]([0,1]) in history.

Ok I did not explain anything and just gave more details, but I don’t find some logic explanations. I am disappointed by this behavior, because:
- Indexes should both be decreased / increased.
- Displays either in history or command line should be the same. (UX rule)
- User inputs should not be changed. (UX rule also)

Off topic: I also notice that history recall of affectation lines also changes command line in CAS, eg: index:=1 becomes 'index':=1 and then "index":=0 and leading to an error.
I did not get the python compatibility enabled message, only if I set index:=0 (which I didn't do in my first post - - I had index set to 1).

But if I set index to 0, the column number increases by 1 (row number stays correct) in the history, which is what you described.

And copying 'index:=0' from history will lead to an error, I can confirm that. But copying 'index:=1' from history will not lead to an error.
Seems to happen in textbook display mode only. I therefore suspect it's not a bug in the CAS code (I checked that the printing code of the [] rootnode correctly increases or decreases all indices by 1).
Anyway, Python compatibility will raise confusion because indices start at 0 and not 1...
Yes, textbook, but also algebraic mode has that display problem.
Good to know the problem doesn't seem to originate in the CAS code proper.
you can do [[1, 2],[3, 4]][1][2] to get 2, matrices in CAS mode are nothing but nested lists.
Reference URL's