×îС¶þ³Ë·¨JAVA´úÂë
ÔÚÍøÉÏÕÒµ½µÄ´úÂëÊÇ´íµÄ£¬×Ô¼ºÐ´ÁËÒ»¸ö
×îС¶þ³Ë·¨µÄ´úÂ룬¶þ¸ö¹¹Ôì·½·¨£¬Ò»¸öÊDz»´øȨµÄ£¬Ò»¸öÊÇ´øȨµÄ
/**
* ×îС¶þ³Ë·¨¼ÆËãÀà
*
* @author Administrator
*
*/
public class LeastSquareMethod {
private double[] x;
private double[] y;
private double[] weight;
private int m;
private double[] coefficient;
public LeastSquareMethod(double[] x, double[] y, int m) {
if (x == null || y == null || x.length < 2 || x.length != y.length
|| m < 2)
throw new IllegalArgumentException("ÎÞЧµÄ²ÎÊý");
this.x = x;
this.y = y;
this.m = m;
weight = new double[x.length];
for (int i = 0; i < x.length; i++) {
weight[i] = 1;
}
}
public LeastSquareMethod(double[] x, double[] y, double[] weight, int m) {
if (x == null || y == null || weight == null || x.length < 2
|| x.length != y.length || x.length != weight.length || m < 2)
throw new IllegalArgumentException("ÎÞЧµÄ²ÎÊý");
this.x = x;
this.y = y;
this.m = m;
this.weight = weight;
}
public double[] getCoefficient() {
if (coefficient == null)
compute();
return coefficient;
}
public double fit(double v) {
if (coefficient == null)
compute();
if (coefficient == null)
return 0;
double sum = 0;
for (int i = 0; i < coefficient.length; i++) {
sum += Math.pow(v, i) * coefficient[i];
}
return sum;
}
private void compute() {
if (x == null || y == null || x.length <= 1 || x.length != y.length
|| x.length < m || m < 2)
return;
double[] s = new double[(m - 1) * 2 + 1];
for (int i = 0; i < s.length; i++) {
for (int j = 0; j < x.length; j++)
s[i] += Math.pow(x[j], i) * weight[j];
}
double[] f = new double[m];
for (int i = 0; i < f.length; i++) {
for (int j = 0; j < x.length; j++)
f[i] += Math.pow(x[j], i) * y[j] * weight[j];
}
double[][] a = new double[m][m];
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
a[i
Ïà¹ØÎĵµ£º
Ò»¡¢cookie»úÖƺÍsession»úÖƵÄÇø±ð
*****************************************************************
¾ßÌåÀ´Ëµcookie»úÖƲÉÓõÄÊÇÔÚ¿Í»§¶Ë±£³Ö״̬µÄ·½°¸£¬¶øsession»úÖƲÉÓõÄÊÇÔÚ·þÎñÆ÷¶Ë±£³Ö״̬µÄ·½°¸¡£
ͬʱÎÒÃÇÒ²¿´µ½£¬ÓÉÓڲŷþÎñÆ÷¶Ë±£³Ö״̬µÄ·½°¸ÔÚ¿Í»§¶ËÒ²ÐèÒª±£´æÒ»¸ö±êʶ£¬ËùÒÔsession
»úÖÆ¿ÉÄÜÐèÒª½è ......
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr()£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache,SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110:2046/ µÄURL·´Ïò´úÀíΪhttp://www.xxx.com/ µÄURLʱ£¬ÓÃrequest.getRemoteAddr()·½·¨»ñÈ¡ ......
¶¨ÒåÔÚÒ»¸öÀàÄÚ²¿µÄÀà½ÐÄÚ²¿À࣬°üº¬ÄÚ²¿ÀàµÄÀà³ÆΪÍⲿÀà¡£ÄÚ²¿Àà¿ÉÒÔÉùÃ÷public¡¢protected¡¢privateµÈ·ÃÎÊÏÞÖÆ£¬¿ÉÒÔÉùÃ÷ΪabstractµÄ¹©ÆäËûÄÚ²¿Àà»òÍⲿÀà¼Ì³ÐÓëÀ©Õ¹£¬»òÕßÉùÃ÷Ϊstatic¡¢finalµÄ£¬Ò²¿ÉÒÔʵÏÖÌض¨µÄ½Ó¿Ú¡£staticµÄÄÚ²¿ÀàÐÐΪÉÏÏóÒ»¸ö¶ÀÁ¢µÄÀ࣬·ÇstaticÔÚÐÐΪÉÏÀàËÆÀàµÄÊôÐÔ»ò·½·¨ÇÒ½ûÖ¹ÉùÃ÷staticµÄ·½· ......
Ò»¡¢BorderLayoutTest.java
package com.briup.md08;
import java.awt.*;
import javax.swing.*;
/*BorderLayoutÌصã
1¡¢×é¼þµÄ´óСÓÉÈÝÆ÷¾ö¶¨
2¡¢ÈÝÆ÷±»»®·ÖΪ5¸öÇøÓò£¬Ã¿¸öÇøÓòÖ»ÄÜÖ±½Ó¼ÓÈë3¸ö×é¼þ
3¡¢×é¼þ¼ÓÈëµÄλÖÃÐèÒªÖ¸¶¨£¬Ä¬ÈÏΪCENTER
4¡¢×é¼þÖ®¼äĬÈÏûÓмä϶
5¡¢Èç¹û³ýCENTER ÒÔÍâµÄÇøÓòûÓмÓÈë×é¼þ£¬Æ ......
package CH1;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class exercise001 extends JApplet {
// ¶¨Òå±äÁ¿
private JColorChooser chooser = new JColorChooser();
private JButton button = new JButton("Show Color Chooser");
private JDialog dialo ......