MAKEMAT
07-16-2014, 10:42 PM (This post was last modified: 07-17-2014 01:35 PM by Alberto Candel.)
Post: #1
 Alberto Candel Member Posts: 169 Joined: Dec 2013
MAKEMAT
Does it work in CAS? it seems so according to Help. But MAKEMAT(I+J,2,2) returns [[0,0],[0,0]], while MAKEMAT(i^2+j,2,2) returns [[j-1,j-1],[j-1,j-1]]. This is so because upper case letters are initialized to 0, lower case are not initialized, and lowercase i is sqrt(-1).

Any help? I cannot find any relevant documentation for this behavior in the user manual. Thanks.
07-17-2014, 10:06 AM
Post: #2
 Joe Horn Senior Member Posts: 2,002 Joined: Dec 2013
RE: MAKEMAT
(07-16-2014 10:42 PM)Alberto Candel Wrote:  Does it work in CAS? it seems so according to Help. But MAKEMAT(I+J,2,2) returns [[0,0],[0,0]], while MAKEMAT(i^2+j,2,2) returns [[j-1,j-1],[j-1,j-1]]. This is so because upper case letters are initialized to 0, lower case are not initilized, and lowercase i is sqrt(-1).

Any help? I cannot find any relevant documentation for this behavior in the user manual. Thanks.

MAKEMAT (must be spelled with uppercase letters in CAS) only works with the built-in real variables I and J, not with lowercase user variable j (or any other variables). So when using MAKEMAT in CAS, be sure to spell both its name and its I and J variables in uppercase, or it won't work as expected.

HOWEVER... Please note that makemat (spelled in lowercase) is a CAS-only function that uses a different syntax than MAKEMAT. In Home, makemat uses MAKEMAT's syntax (and is displayed in Home's history as MAKEMAT), but they are different in CAS:

Home: MAKEMAT(I^2+J,3,5) --> [[2,3,4,5,6],[5,6,7,8,9],[10,11,12,13,14]]
Home: makemat(I^2+J,3,5) --> [[2,3,4,5,6],[5,6,7,8,9],[10,11,12,13,14]]

CAS: MAKEMAT(I^2+J,3,5) --> [[2,3,4,5,6],[5,6,7,8,9],[10,11,12,13,14]]
CAS: makemat(I^2+J,3,5) --> [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]
CAS: makemat((x,y)->x^2+y,3,5) --> [[2,3,4,5,6],[5,6,7,8,9],[10,11,12,13,14]]

<0|ΙΈ|0>
-Joe-
07-17-2014, 10:55 AM
Post: #3
 Angus Member Posts: 212 Joined: Feb 2014
RE: MAKEMAT
Do we have the request for cleaning up the whole spelling/auto-correction topics in the bug/wishlist?
That seems to be urgent ;-)
07-17-2014, 01:31 PM
Post: #4
 Alberto Candel Member Posts: 169 Joined: Dec 2013
RE: MAKEMAT
(07-17-2014 10:06 AM)Joe Horn Wrote:  CAS: makemat((x,y)->x^2+y,3,5) --> [[2,3,4,5,6],[5,6,7,8,9],[10,11,12,13,14]]

Thanks, this is what I needed.

BTW, the Prime rewrites "makemat" as "MAKEMAT" in textbook display. That was confusing.
 « Next Oldest | Next Newest »

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