Hi everyone:
I ahve this program to plot a graph using x and y coordinates. I cna plot the graph but I will also like to plot the x and y vlaues and name the xx and y coordinates. Anyone can help me ? Here is my code.
// Bifurcationlo.java
import java.awt.*;
import java.awt.Frame;
import java.awt.event.*;
import java.awt.Graphics;
public class Bifurcationlo extends Frame
{
public Bifurcationlo()
{
setSize(600,500);
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent event)
{ System.exit(0); }}); }
public void paint(Graphics g)
{
int xmax = 600; int ymax = 400;
int j, k, m, n;
double x, xplot, yplot;
double r = 2.0; // bifurcation parameter
while(r <= 4.0)
{
xplot = xmax*(r-2.0)/2.0;
x = 0.5;
for(j=0;j<400;j++) { x = r*x*(1.0-x); }
for(k=0;k<400;k++)
{
x = r*x*(1.0-x);
yplot = ymax*(1.0-x);
m = (int) Math.round(xplot);
n = 50 + (int) Math.round(yplot);
g.drawLine(m,n,m,n);
}
r += 0.0005;
} // end while
}
public static void main(String[] args)
{
Frame f = new Bifurcationlo();
f.setVisible(true);
}
}