Maybe something like this? I've controlled the colors based on the radius r
and am passing in a location loc
so that different disks are produced in the following example.
f[loc_, r_] := Graphics[{If[r > 0, Blue, Red],
EdgeForm[Black], Disk[loc, Abs[r]]}]
Here it is for 100 random locations each with a radius ranging from 0 to 2.
Show[Table[f[i, RandomReal[{-2, 2}]], {i, RandomReal[{-10, 10}, {100, 2}]}]]
Edit: I'm not sure I understand exactly what you are asking for in the edits to the question. Going with the second it seems to me that you want to create a matrix of colored disks that corresponds to your original matrix m? If that is the case, you could do something like the following.
diskMatrix[m_]:=
Block[{r,max = Max[m^2],n=Length[m],p=Length[m[[1]]]},
Graphics[
Table[
r=m[[i,j]]^2;
{EdgeForm[Black],
If[m[[i,j]]>0,Blue,Red],
Tooltip[Disk[{j,-i},
Rescale[r,{0,max},{0,2/n}]],
Row[{"Radius : ",r}]
]}
,{i,n},{j,p}
]
]
]
This code is going to take a matrix m
and effectively produce a grid of disks where the ij
th disk has radius m[[i,j]]^2
and is red if m[[i,j]]
is negative, blue otherwise. In order to prevent overlap in the resulting graphic I've rescaled the radii. A Tooltip
is used to show the value of the radii on mouse-over.
Here is an example using the matrix provided in the simple example.
m1 = {{-1/2, 1/2, 0, -1/Sqrt[2]}, {1/2, 1/2, -1/Sqrt[2], 0}, {-1/2,
1/2, 0, 1/Sqrt[2]}, {1/2, 1/2, 1/Sqrt[2], 0}};
diskMatrix[m1]
Produces the following image...
Edit 2:
One last try in light of the most recent edit and posted comments. The following function will take a matrix of possibly complex values. It assumes there will be 4 columns in this matrix.
For each row m[[i]]
a square is drawn. Proceeding from bottom left and counter-clockwise around the square a disk is rendered at each vertex. The radius of the disk is proportional to Abs[m[[i,j]]]^2
. The color is chosen based on the sign of the real part of m[[i,j]]
.
diskTangle[evect_] :=
Block[{r, max = Max[Abs[Flatten[evect]]^2],
pos = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}},
Table[Show[Graphics[{EdgeForm[Thick], White, Rectangle[]}],
Graphics[
Table[r = Abs[e[[i]]]^2; {EdgeForm[Black],
If[Sign[Re[e[[i]]]] > 0, Blue, Red],
Tooltip[Disk[pos[[i]], Rescale[r, {0, max}, {0, 1/2}]],
Row[{"Radius : ", r}]]}, {i, Length[e]}]]], {e, evect}]]
Using m1 from above...
evects = Eigensystem[m1][[2]]//N;
diskTangle[evects]
M1[[All,1]]+M1[[All,2]]...M1[[All,n]]
: you can doTotal[Transpose[M1]]
instead. What I don't understand is why you suddenly haveV1
as a function oft
; what are you really trying to do? $\endgroup$M1[[All,n]]
, I still have time-dependency in the resulting vector. The time evolution of the electron density on each atom is described by the square of its coefficient, which is a component ofV1
. For example, atom 1 has electron densityAbs[Part[V1,1]]^2
. As I can only plot functions that I have defined explicitly, I am left with one (apparent) choice: define 6 functions of t, which are theAbs[]^2
of each ofV1
's components. $\endgroup$C[k_, t_] := With[{M1 = (* your matrix *)}, Abs[Total[Transpose[M1]][[k]]]]^2
. $\endgroup$