HP Forums
CAS: Matrix Index Display - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: CAS: Matrix Index Display (/thread-15520.html)



CAS: Matrix Index Display - Helge Gabert - 08-31-2020 09:29 PM

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.


RE: CAS: Matrix Index Display - pinkman - 09-01-2020 09:33 AM

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.


RE: CAS: Matrix Index Display - Helge Gabert - 09-01-2020 03:21 PM

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.


RE: CAS: Matrix Index Display - parisse - 09-01-2020 04:07 PM

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...


RE: CAS: Matrix Index Display - Helge Gabert - 09-01-2020 04:32 PM

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.


RE: CAS: Matrix Index Display - fakuivan - 10-03-2020 01:37 AM

you can do [[1, 2],[3, 4]][1][2] to get 2, matrices in CAS mode are nothing but nested lists.