31.10.08

沉思录

1.不要将心思花在别人身上,不要探听别人的事情,也不要对别人任意猜度。

2.我们说的话和做的事,大都是没有意义的。如果把这些都取消的话,我们就会有更多的空闲和更少的麻烦。同样,我们也要舍弃那些无用的思想,因为无用的思想会导致无聊的行动。

3.只要做好自己份内的事情,这就足够了,其他的事情无需牵挂。

4.不要像一个摇桨的奴隶那样忙个不停,也不要像苦力一样为了得到人们的怜悯或注意而做事情。

28.10.08

公制英制

• 公制到英制

长度 1 millimetre 毫米= 0.03937 inch英寸
1 centimetre 厘米= 10 mm毫米=0.3937 inch英寸
1 decimetre 分米=10 cm厘米=3.937 inches英寸
1 metre 米=10 dm分米=1.0936 yards码=3.2808 feet英尺
1 kilometre 千米=1000 m米=0.6214 mile英里
1 mile marin 海里=1852 m米=1.1500 miles英里



面积 1 square centimetre平方厘米=0.155 sq.inch 平方英寸
1 square metre平方米=1.196 sq.yards 平方码
1 are 公亩=100 square metres 平方米=119.6 sq.yards 平方码
1 hectare 公顷=100 ares 公亩=2.471 acres 英亩
1 square kilometre 平方公里=0.386 sq.mile 平方英里



体积 1 cubic centimetre 立方厘米=0.061 cu.inch 立方英寸
1 cubic metre 立方米=1.308 cu.yards 立方码




容积 1 millilitre 毫升=0.002 British pint 英制品脱
1 centilitre 厘升=10 ml. 毫升=0.018 pint 品脱
1 decilitre 分升=10 cl. 厘升=0.176 pint 品脱
1 litre 升=10 dl. 分升=1.76 pints 品脱
1 decalitre 十升=10 l. 升=2.20 gallons 加伦
1 hectolitre 百升=100 l. 升=2.75 bushels 蒲式耳
1 kilolitre 千升=1000 l. 升=3.44 quarters 八蒲式耳



重量 1 milligram 毫克=0.015 grain 谷
1 centigram 厘克=10 mg. 毫克=0.154 grain 谷
1 decigram 分克=10 cg. 厘克=1.543 grains 谷
1 gram 克=10 dg. 分克=15.43 grains 谷
1 decagram 十克=10 g. 克=5.64 drams 打兰
1 hectogram 百克=100 g. 克=3.527 ounces 盎司
1 kilogram 千克=1000 g. 克=2.205 pounds 磅
1 ton (metric ton) 吨,公吨=1000 kg. 千克=0.984 (long) ton 长吨,英吨=1.1023 短吨,美吨



• 英制到公制

长度 1 inch 英寸=25.4 millimetres 毫米
1 foot 英尺=12 inches 英寸=0.3048 metre 米
1 yard 码=3 feet 英尺=0.9144 metre 米
1 (statute) mile 英里=1760 yards 码=1.609 kilometres 千米
1 nautical mile 海里=1852 m. 米



面积 1 square inch 平方英寸=6.45 sq.centimetres 平方厘米
1 square foot 平方英尺=144 sq.in.平方英寸=9.29 sq.decimetres 平方分米
1 square yard 平方码=9 sq.ft. 平方英尺=0.836 sq.metre 平方米
1 acre 英亩=4840 sq.yd.平方码=0.405 hectare 公顷
1 square mile 平方英里=640 acres 英亩=259 hectares 公顷




体积 1 cubic inch 立方英寸=16.4 cu.centimetres 立方厘米
1 cubic foot 立方英尺=1728 cu.in. 立方英寸=0.0283 cu.metre 立方米
1 cubic yard 立方码=27 cu.ft. 立方英尺=0.765 cu.metre 立方米



容积(英制) 1 pint 品脱=20 fluid oz. 液量盎司=34.68 cu.in. 立方英寸=0.568 litre 升
1 quart 夸脱=2 pints 品脱=1.136 litres 升
1 gallon 加伦=4 quarts 夸脱=4.546 litres 升
1 peck 配克=2 gallons 加伦=9.092 litres 升
1 bushel 蒲式耳=4 pecks 配克=36.4 litres 升
1 quarter 八蒲式耳=8 bushels 蒲式耳=2.91 hectolitres 百升



体积(美制干量) 1 pint 品脱=33.60 cu.in. 立方英寸=0.550 litre 升
1 quart 夸脱=2 pints 品脱=1.101 litres 升
1 peck 配克=8 quarts 夸脱=8.81 litres 升
1 bushel 蒲式耳=4 pecks 配克=35.3 litres 升



体积(美制液量) 1 pint 品脱=16 fluid oz. 液量盎司=28.88 cu.in. 立方英寸=0.473 litre 升
1 quart 夸脱=2 pints 品脱=0.946 litre 升
1 gallon 加伦=4 quarts 夸脱=3.785 litres 升



常衡 1 grain 格令=0.065 gram 克
1 dram 打兰=1.772 grams 克
1 ounce 盎司=16 drams 打兰=28.35 grams 克
1 pound 磅=16 ounces 盎司=7000 grains 谷=0.4536 kilogram 千克
1 stone 英石=14 pounds 磅=6.35 kilograms 千克
1 hundredweight 英担=4 quarters 四分之一英担=50.80 kilograms 千克
1 short ton 短吨(美吨)=2000 pounds 磅=0.907 tonne 公吨
1 (long) ton 长吨(英吨)=20 hundredweight 英担=1.016 tonnes 公吨

From Wikipdia: http://en.wikipedia.org/wiki/Pound-force
The pound-force is approximately equal to the gravitational force exerted on a mass of one avoirdupois pound on the surface of Earth. Since the 18th century, the unit has been used in low-precision measurements, for which small changes in Earth's gravity (which varies from place to place by up to half a percent) can safely be neglected.[1]

The 20th century, however, brought the need for a more precise definition. A standardized value for acceleration due to gravity was therefore needed. Today, in accordance with the General Conference on Weights and Measures, standard gravity is usually taken to be 9.80665 m/s² (approximately 32.17405 ft/s²)[2][3] but other values have been used, including 32.16 ft/s² (approximately 9.80237 m/s²).[4]

From the acceleration of the standard gravitational field and the international avoirdupois pound, we arrive at the following definition:[5]

1 pound-force ≡ 0.45359237 kg × 9.80665 m/s²
= 4.4482216152605 N (exactly)

Solve nonlinear function with Origin C

this is the code of Origin C solving nonlinear function using Newton-method.
also it shows how to use worksheet, datarange, vector...

#include
void SolveV0()
{
Worksheet wks=Project.ActiveLayer();
double V, H, h0, V0, f;
double beta1=0.562, beta2=0.99;
double beta, dfdV0;

beta = (beta1+beta2)^(beta1+beta2)/beta1^beta1/beta2^beta2;
if(!wks)
{
out_str("error");
return;
}

DataRange drV, drH, drh0, drV0;
Column col(wks,0);
int nrows=col.GetNumRows();

drV.Add("",wks,0,4,nrows,4);
drH.Add("",wks,0,5,nrows,5);
drh0.Add("",wks,0,10,nrows,10);
drV0.Add("",wks,0,11,nrows,11);

vector vV, vH, vh0, vV0;
drV.GetData(&vV,0);
drH.GetData(&vH,0);
drh0.GetData(&vh0,0);
drV.GetData(&vV0,0); //dummy

for(int i=0;i {
V=vV[i];
H=vH[i];
H=abs(H);
// V=abs(V);
h0=vh0[i];
V0=sqrt(H^2+V^2);
if (H==0.0)
vV0[i]=V0;
else
{
f=H/(V0*h0) - beta*(V/V0)^beta1*(1-V/V0)^beta2;
while(abs(f)>=0.0000001)
{
dfdV0 = -H/h0/V0^2 + beta*beta1*V^beta1/V0^(beta1+1)*(1-V/V0)^beta2 - beta*beta2*(V/V0)^beta1*(1-V/V0)^(beta2-1)*V/V0^2;
V0 = V0 - f/dfdV0;
f=H/(V0*h0) - beta*(V/V0)^beta1*(1-V/V0)^beta2;
}
}
}
drV0.SetColumnData(vV0,FALSE,0);
}

Origin(1)

I have just begun using Origin in processing experimental data.
Good software!
Here is the example showing how to smooth the data and reset the origion(zero point) by averageing adjacent points.
acturally this is using the X-function.

ii=1;loop(ii,1,4) { smooth iy:=($(ii)) method:=aav npts:=60 oy:=(,$(ii+4));};a=col(5)[1]; col(5)=-(col(5)-a);a=col(6)[1]; col(6)=(col(6)-a);a=col(7)[1]; col(7)=-(col(7)-a);a=col(8)[1]; col(8)=-(col(8)-a);

牛顿迭代法

用牛顿迭代法求f(x)=0在x0附近的一个实根的方法是:(1) 选一个接近于x的真实根的近似根x1;(2) 通过x1求出f(x1)。在几何上就是作x=x1,交f(x)于f(x1);(3) 过f(x1)作f(x)的切线,交x轴于x2。可以用公式求出x2。由于f'(x1)=f(x1)/(x2-x1),故x2=x1-f(x1)/f'(x1)(4) 通过x2求出f(x2);(5) 再过f(x2)作f(x)的切线交x轴于x2;(6) 再通过x3求出f(x3),…一直求下去,直到接近真正的根。当两次求出的根之差xn+1-xn≤ε就认为 xn+1足够接近于真实根。牛顿迭代公式是:xn+1=xn-f(xn)/f'(xn)牛顿迭代法的关键就是计算这个迭代公式,并在程序中进行迭代运算即可。该问题程序相对简单,就不列举了,控制一下迭代精度,直到达到需要目标即可。有一个问题需要注意的是,该方法能够有效的基本条件是:迭代公式必须是收敛的( 也就是通过迭代运算,每一次的结果必须是更接近真实值的)。