Formatted screen output

14 views
Skip to first unread message

Sid Andal

unread,
Jan 25, 2025, 1:05:15 PM1/25/25
to FriCAS - computer algebra system
Let

M : Matrix(INT) := [[10, 20], [30, 40]]

I'd like to output to screen a particular entry, e.g. 2nd row, 1st col,
of matrix M which is equivalent to the following C statement:

printf("\n\tM(%d, %d) = [%d]\n\n", 2, 1, M(2, 1));

Thanks,

SWA

Ralf Hemmecke

unread,
Jan 25, 2025, 4:27:19 PM1/25/25
to fricas...@googlegroups.com
Dear Sid,

Maybe I do not fully understand what you want, but maybe the following
is of any help to you...

Ralf

M := matrix([[10, 20], [30, 40]])$Matrix(Integer)OF ==> OutputForm
LOF ==> List OF
disp(x) ==> display((x::OF)::Formatter(Format1D))
o x ==> x :: Symbol :: OF
d l ==> disp hconcat(l)
tab ==> o((char(9)$Character)::String)
pr(i,j,m) ==> d([tab, o "M(", i::OF, o ",", j::OF, o ") = [",
m(i,j)::OF, o "]"]$LOF)
for i in 1..2 repeat for j in 1..2 repeat pr(i,j,M)


Reply all
Reply to author
Forward
0 new messages