- #1

CAF123

Gold Member

- 2,950

- 88

The code is below:

Code:

```
import java.io.Console;
import java.io.*;
import java.lang.Math;
import java.lang.Boolean;
import ptolemy.plot.*;
public class Edipole {
public static void main (String args[]) {
Console myConsole = System.console();
Plot disc = new Plot();
disc.setTitle("Graph of the field component near the conducting plane for all x");
disc.setXLabel("distance along x");
disc.setYLabel("E field");
PlotFrame myFrame = new PlotFrame("E vs x", disc);
myFrame.setSize(10,20);
int dataSet = 0;
double q = 4;
double d = 10;
double h = 1;
double eps = 8.85e-12;
int points = 500;
double E[] = new double[points];
double x[] = new double[points];
for(int i = 0; i < (points-1); i++) {
x[i] = (100*(int)i/points);
double Eqn = (q/(2*(Math.PI)*eps))*(d/Math.pow((Math.sqrt(x[i]*x[i]+d*d)),3) - h/((Math.pow((Math.sqrt(x[i]*x[i]+h*h)),3)));
disc.addPoint(dataSet, x[i], Eqn, true);
}
System.out.println("Graph created");
myFrame.setVisible(true);
//System.exit(0);
}
}
```

After a while, I obtained the same expression over and over again no matter what change I made to it. So, for fun, I deleted the whole eqn and wrote double Eqn = 3x

*in its place. What I got was the exact same graph, which makes absolutely no sense.*

Can anyone explain this bizarre occurrence?

Can anyone explain this bizarre occurrence?