球体不显示|数学

时间:2017-05-06 18:47:46

标签: function plot jquery-animate wolfram-mathematica graphics3d

您好我正在3D表面上创建Brown运动的模拟,所以我尝试链接3dplot和animate功能。 一切都在编译而没有任何错误,但我的问题是我想在表面上随机移动的球体不显示(当然也不是动画)。 可能是什么问题呢?这是代码:

Z[x_, y_] :=  4 x + 3 y - 2         
r = 0.05
Bok = 100
X[1] = RandomReal[{0, Bok}]
Y[1] = RandomReal[{0, Bok}]
Z[1] := Z[X1, Y1]
P[1] = Point[{X1, Y1, Z1}]

For[i = 1, i < 1000, i++, X[i + 1] = X[i] + RandomChoice[{0.1, -0.1}];
Y[i + 1] = Y[i] + RandomChoice[{0.1, -0.1}];
Z[i + 1] = Z[X[i + 1], Y[i + 1]];
P[i + 1] := Table[ Point[{X[i + 1], Y[i + 1], Z[i + 1]}], {i, 1000}];
(*Print[P[i+1]]*)
]

Animate[
Show[
Plot3D[Z[x, y], {x, 0, Bok}, {y, 0, Bok}, 
ColorFunction -> "DarkRainbow", Mesh -> None],
Graphics3D[
Black, Sphere[P[i], r]
]
],
{i, 1, 1000}
]

1 个答案:

答案 0 :(得分:1)

一个开始......

public class Temp {
private String [] months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

public Temp (){
    double array[],avg = 0, max = 0, min = 0;
    String maxMonth= null, minMonth = null;
    }
public double convertToFah(double array[]){
    for(int index = 0; index < array.length; index++){

    }
}
public double calAvg(double avg, double array[]){
     double sum = 0.0;

     for(int index = 0; index < array.length; index++){
              sum = sum + array[index];
     }

     return avg = sum /array.length;

}
public double findMin(double array[], double min, String minMonth){
    for (int index = 0; index < array.length; index++) {
        if (array[index] < min){
            min = array[index];
        }
    }

    return min;
}
public double findMax(double array[], double max, String maxMonth){
    for (int index = 0; index < array.length; index++) {
        if (array[index] > max){
            max = array[index];
            return max;
        }
    }

    return max;

}

enter image description here