Below is a graph I generated using Sage. The data was generated using the (updated) java script I wrote before. Just as in Mathematica, the graph is interactive and can be rotated with the mouse.
Below is the updated java code that generates a sample dataset for Mathematica and Sage.
import java.util.Random;
public class datamake {
public static void main(String[] args) {
Random gen = new Random();
int rdm = 0;
String mathematica = "";
String sage ="";
mathematica += ("ListSurfacePlot3D[{");
sage += ("list_plot3d([");
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
if(gen.nextInt() %4 == 0){
rdm = gen.nextInt(5);
mathematica += ("{" + i + "," + j + "," + rdm + "},");
sage += "(" + i + "," + j + "," + rdm + "),";
}
}
}
mathematica = mathematica.substring(0,mathematica.length()-1);
mathematica += ("}]");
sage = sage.substring(0, sage.length()-1);
sage += "])";
System.out.println(mathematica);
System.out.println(sage);
}
}
No comments:
Post a Comment