平方根を使わずに距離を求める の履歴(No.1)
更新平面状の2点間の距離を平方根を使わずに計算する†
http://d.hatena.ne.jp/nowokay/20120604
twitter にてこちらの記事を知り、少し調べてみました。
Mathematica で確かめる†
正確な距離関数はこう:
LANG:Mathematica distance[x_, y_] := Sqrt[x^2 + y^2] Plot3D[distance[x, y], {x, -1, 1}, {y, -1, 1}, ImageSize -> Large]
最大値、最小値を利用した近似はこう :
LANG:Mathematica distance2[x_, y_, a_, b_] := a Max[Abs[x], Abs[y]] + b Min[Abs[x], Abs[y]] Plot3D[distance2[x, y, 1007/1024, 441/1024], {x, -1, 1}, {y, -1, 1}, ImageSize -> Large]
Counter: 16962 (from 2010/06/03),
today: 1,
yesterday: 4