From: Richard F. <fa...@be...> - 2018-04-30 04:44:13
|
A nicer idiomatic way... R[i,j]:= subst(x,y,lein[i,j]); for i:1 thru 4 do for j:1 thru 4 do display(R[i,j]); On 4/29/2018 9:09 PM, Kris Katterjohn wrote: > On Mon, Apr 30, 2018 at 12:57:13PM +0930, Joseph O'Leary wrote: >> I am trying to wrap my head around some intro programming with Maxima. I >> have the following loop >> >> for i: 1 thru 4 do >> for j: 1 thru 4 do R[i,j]: subst(x,y,lein[i,j]), >> R[i,j]; >> >> >> What i am trying to do is to substitute the variable x for u in the R[i,j] >> and then display the R[i,j]. What is the procedure for displaying results >> of this type does any one know? > Your description doesn't quite match your code, but there are functions > like "print" and "display" that can print to the screen. > > And from the looks of what you're trying to do, you need to group > together the expressions in your loop body. You can try something like > this (note the parentheses): > > for i: 1 thru 4 do > for j: 1 thru 4 do > (R[i, j]: subst (x, y, lein[i, j]), > display (R[i, j])); > > Is this the sort of thing you had in mind? > > (I guess lein is used in the tensor stuff, which I'm not familiar with, > so I'm assuming that the subst above is an appropriate thing to do.) > > Cheers, > Kris Katterjohn > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss |