プログラム倉庫

「JAVA TAX 05」の編集履歴(バックアップ)一覧はこちら

JAVA TAX 05」の最新版変更点

追加された行はこの色になります。

削除された行はこの色になります。

+class tax{ 
+public static void main(String args[]){ 
+double th[]= new double[101]; 
+int s; 
+double tl; 
+double tr; 
+double ls; 
+double w; 
+double cs; 
+double ys; 
+double b1; 
+double b2; 
+double tr1; 
+double tr2; 
+double tr3; 
+double wel; 
+double maxwel; 
+double maxtl; 
+int t; 
+int n; 
+for (s=1;s<101;s++){ 
+th[s]=0.02*s; 
+} 
+maxtl=0; 
+maxwel=-999; 
+for (n=20;n<45;n++){ 
+tl=0.01*n; 
+tr1=0.01; 
+tr2=0.02; 
+tr=tr1; 
+b1=bud(tl,tr1); 
 
+t=0; 
+while (t<100) { 
+b2=bud(tl,tr2); 
+tr3=tr2-b2*(tr2-tr1)/(b2-b1); 
+tr1=tr2; 
+tr2=tr3; 
+b1=b2; 
+if (b2*b2<0.00001){ 
+t=1000; 
+} 
+t=t+1; 
+} 
+tr=tr2; 
+wel=seekwel(tl,tr);
+if (wel>maxwel){ 
+maxtl=tl; 
+} 
+if (wel>maxwel){ 
+maxwel=wel; 
+} 
+} 
+System.out.println(maxtl); 
+} 
+static double ux(double c1,double l1){
+double u1;
+u1=Math.log(c1)+Math.log(1-l1);
+return u1;
+}
+static double bud(double tl,double tr){
+double bx;
+int s;
+double w;
+double y1;
+double c1;
+double l1;
+double th[]=new double[101];
+for (s=1;s<101;s++){ 
+th[s]=0.02*s; 
+} 
+bx=0; 
+for (s=1;s<101;s++){ 
+w=(1-tl)*th[s]; 
+l1=(w-tr)/(2*w); 
+if (l1<0)l1=0; 
+y1=th[s]*l1; 
+c1=w*l1+tr; 
+bx=bx+y1-c1; 
+} 
+return bx;
+}
+static double seekwel(double tl,double tr){
+double sw;
+int s;
+double w;
+double l1;
+double c1;
+double th[]=new double[101];
+for (s=1;s<101;s++){ 
+th[s]=0.02*s; 
+} 
+sw=0; 
+for (s=1;s<101;s++){ 
+w=(1-tl)*th[s]; 
+l1=(w-tr)/(2*w); 
+if (l1<0)l1=0;  
+c1=w*l1+tr;
+sw=sw+ux(c1,l1);
+}
+return sw;
+}
+
+}