G
George Marsaglia
I have a set of, say, 2000 points in the 8-dimensional simplex
S={(x_1,x_2,...,x_8),x_1+x_2+...+x_8=1, x's>=0}.
To help analyze that 8-dimensional set, I wish to project
the set of points onto each of the 'faces' {x_i+x_j+x_k=1}
for the 56 choices i,j,k, that is, i=1 to 6; j=i+1 to 7; k=j+1 to 8.
Finally, use gnuplot to load and plot each of the 56 files of 3-d points.
I have C code that will, for given i,j,k, find the projection
(x,y,z) of each of the 2000 points. Those 2000 (x,y,z)'s
must be sent to a file identified by the indices i,j,k.
For i=1,j=2,k=3, list the 2000 projected points in file P123,
for i=1,j=2,k=4, list the points in file P124,
for i=1,j=2,k=5, list the points in file P125,
....
for i=6,j=7,k=8, list the points in file P678.
With my limited C experience, I did this by creating
an array
char c[56][5]={"P123","P124","P125", ...,"P678"};
giving the name of each of the 56 files,
then an outline of the code is
jj=0; for(i=1;i<7;i++}{for(j=i+1;j<8;j++}{(for(k=j+1;k<9;k++){
{for n to 2000, project nth point onto face x_i+x_j+x+k=1,
print resulting x,y,z to file C[jj], then increment, jj++}
}}}
Is there a way to avoid creating the character array
of file names, and instead, for given i,j,k, define
and open the file for that specific i,j,k,
write the 2000 (x,y,z)'s to it, then close that file?
Thus for i=2,j=5,k=7, open file P257, write to P257, close P257,
...
for i=3,j=6,k=8, open file P368, write to P368, close P368,
etc.
My current program works, and the resulting 56 files, when
loaded by gnuplot and shown in 1-second intervals,
make a very interesting display, (available on request).
But I hope---through experts here---to learn of ways to
create and write to files "on the fly", for the C part
of the study.
(I learned of gnuplot only a few days ago, when searching for ways
to plot from C, as Maple was rather slow for this problem.
Those not knowing of "gnuplot" may wish to look it up. I use
the version found from a Google search for
gnuplot MS Windows .)
George Marsaglia
S={(x_1,x_2,...,x_8),x_1+x_2+...+x_8=1, x's>=0}.
To help analyze that 8-dimensional set, I wish to project
the set of points onto each of the 'faces' {x_i+x_j+x_k=1}
for the 56 choices i,j,k, that is, i=1 to 6; j=i+1 to 7; k=j+1 to 8.
Finally, use gnuplot to load and plot each of the 56 files of 3-d points.
I have C code that will, for given i,j,k, find the projection
(x,y,z) of each of the 2000 points. Those 2000 (x,y,z)'s
must be sent to a file identified by the indices i,j,k.
For i=1,j=2,k=3, list the 2000 projected points in file P123,
for i=1,j=2,k=4, list the points in file P124,
for i=1,j=2,k=5, list the points in file P125,
....
for i=6,j=7,k=8, list the points in file P678.
With my limited C experience, I did this by creating
an array
char c[56][5]={"P123","P124","P125", ...,"P678"};
giving the name of each of the 56 files,
then an outline of the code is
jj=0; for(i=1;i<7;i++}{for(j=i+1;j<8;j++}{(for(k=j+1;k<9;k++){
{for n to 2000, project nth point onto face x_i+x_j+x+k=1,
print resulting x,y,z to file C[jj], then increment, jj++}
}}}
Is there a way to avoid creating the character array
of file names, and instead, for given i,j,k, define
and open the file for that specific i,j,k,
write the 2000 (x,y,z)'s to it, then close that file?
Thus for i=2,j=5,k=7, open file P257, write to P257, close P257,
...
for i=3,j=6,k=8, open file P368, write to P368, close P368,
etc.
My current program works, and the resulting 56 files, when
loaded by gnuplot and shown in 1-second intervals,
make a very interesting display, (available on request).
But I hope---through experts here---to learn of ways to
create and write to files "on the fly", for the C part
of the study.
(I learned of gnuplot only a few days ago, when searching for ways
to plot from C, as Maple was rather slow for this problem.
Those not knowing of "gnuplot" may wish to look it up. I use
the version found from a Google search for
gnuplot MS Windows .)
George Marsaglia