I have a list of lists (matrix) in mathematica. I want to print it out nicely, with the max in every row in bold. How to do this?
Or maybe even further, with a circle outside such max, is this possible?
Select Insert ▶ Table/Matrix ▶ New: In the window that appears, select Matrix (List of lists), enter the number of rows and columns for your matrix, and click OK: Your matrix is inserted into your notebook: Copy to clipboard.
Writing Matrices in Mathematica (Wolfram Alpha)Matrices are written with braces, {}. Within the braces we list the rows with more braces. So a matrix with four rows is written {{Row1},{Row2},{Row3},{Row4}}. Each row is separated by a comma and each entry is separated by a comma.
You can use MatrixForm
to print out matrices nicely:
data = RandomInteger[100, {5, 5}];
data // MatrixForm
yields
You can draw a circle around the maximum in each row as follows:
Map[# /. m : Max[#] :> Framed[m, RoundingRadius -> 1000] &, data] //
MatrixForm
yielding
RoundingRadius -> 1000
uses a ridiculously large parameter to get circles. You may need to adjust the constant depending upon the scale of your display.
You can change Framed[m...]
with Style[m, Bold]
if you prefer bolding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With