Post Reply 
CAS: Matrix Index Display
08-31-2020, 09:29 PM
Post: #1
CAS: Matrix Index Display
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.
Find all posts by this user
Quote this message in a reply
09-01-2020, 09:33 AM (This post was last modified: 09-01-2020 09:34 AM by pinkman.)
Post: #2
RE: CAS: Matrix Index Display
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.

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
09-01-2020, 03:21 PM
Post: #3
RE: CAS: Matrix Index Display
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.
Find all posts by this user
Quote this message in a reply
09-01-2020, 04:07 PM
Post: #4
RE: CAS: Matrix Index Display
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...
Find all posts by this user
Quote this message in a reply
09-01-2020, 04:32 PM (This post was last modified: 09-01-2020 04:34 PM by Helge Gabert.)
Post: #5
RE: CAS: Matrix Index Display
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.
Find all posts by this user
Quote this message in a reply
10-03-2020, 01:37 AM
Post: #6
RE: CAS: Matrix Index Display
you can do [[1, 2],[3, 4]][1][2] to get 2, matrices in CAS mode are nothing but nested lists.
Find all posts by this user
Quote this message in a reply
Post Reply 




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