# HP Forums

Full Version: MAKEMAT
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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-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]]
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 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.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :