import java.awt.*;
import java.awt.event.*;
class apple0805 extends Frame {
public static void main(String [] args) {
Frame f=new apple0805();
f.setTitle("apple0805");
f.setSize(600,600);
f.setBackground(Color.yellow);
f.setVisible(true);
}
apple0805(){addWindowListener(new stopwin());}
class stopwin extends WindowAdapter{
public void windowClosing(WindowEvent we){System.exit(0);}
}
public void paint(Graphics g){
double a;
double beta;
double ks;
double h;
double k[]=new double[101];
double cx[]=new double[101];
double cxs[]=new double[101];
int cp[]=new int[101];
double k1;
double n1;
int n2;
int n3;
int n;
double c1;
double r1;
double ep;
int t;
a=0.33;
beta=0.95;
ks=Math.pow((1 / beta - 1) / a , 1 / (a - 1));
h=2*ks/100;
for (n=1;n<101;n++){
k[n]=n*h;
cx[n]=Math.pow(k[n],a);
}
t=0;
while(t<100){
for (n=10;n<91;n++){
k1=k[n]+Math.pow(k[n],a)-cx[n];
n1=k1/h;
n2=(int)n1;
n3=n2+1;
c1=cx[n2]+(n1-n2)*(cx[n3]-cx[n2]);
r1=a*Math.pow(k1,a-1);
cxs[n]=c1/(beta*(1+r1));
}
ep=0;
for (n=10;n<91;n++){
ep=ep+Math.pow(cx[n]-cxs[n],2);
}
for (n=10;n<91;n++){
cx[n]=cxs[n];
}
if (ep<0.0001){
t=1000;
}
t=t+1;
}
for (n=10;n<91;n++){
cp[n]=(int)(100*cx[n]);
}
g.setColor(Color.blue);
for (n=10;n<90;n++){
g.drawLine(n,cp[n],n+1,cp[n+1]);
}
}
}
最終更新:2010年09月14日 00:22