| Author |
Comment/Response |
Aleksey Naumov
|
12/21/98 12:53pm
Hi,
I have problems defining very simple functions, like the one below:
sumRowsColumns[Matrix_]:=
Module[{WithRowSums},
(* Add row sums as an extra column *)
WithRowSums=RowJoin[Matrix,Partition[Apply[Plus,Matrix,{1}],1]];
(* Add column sums as an extra row *)
Append[WithRowSums,Plus@@WithRowSums]
]
This is what I get:
Syntax::''sntxf'':
''\''\!\(TraditionalForm\`\(Module[\)\)\'' cannot be followed by \
\''\!\(TraditionalForm\`\(\\[LeftSkeleton] 1 \
\\[RightSkeleton]\)\)\''.\!\(TraditionalForm\`\''\''\)''
sumRowsColumns[Matrix_]:=
Module[{WithRowSums},
WithRowSums=RowJoin[Matrix,Partition[Apply[Plus,Matrix,{1}],1]];
Append[WithRowSums,Plus@@WithRowSums]]
This could be easily fixed by making any change in the definition cell (like deleting a character and typing it back) and reevaluating the cell. But it's extremely inconvenient, since I'd like to make function definitions initialization cells.
I suspect this has to do with some formatting changes I do to make the definition look better. Sometimes when I define a function and use comments within it, Mathematica alligns rows in a strange and inconvenient way. I'd like to have rows alligned (for easier reading), so I sometimes have to add tabs or spaces before rows. Does it affect evaluation? Is there a way to control allignment of lines other than adding spaces/tabs?
Also, again for easier understanding, I'd like to color-code lines, for example, make comments blue. Does that affect evaluation?
Thanks
Aleksey
URL: , |
|