Macintosh Classic lll/AV

Processingは簡単に始められます。興味ある方は書庫【Proce55ingで遊ぼ】の最後から逆順で

クラス遊び

[ リスト | 詳細 ]

記事検索
検索

全3ページ

[1] [2] [3]

[ 次のページ ]

Rodとl4p5の完成 テストアプレット

イメージ 1

Rodとl4p5の完成 テストアプレット


前記事「re-chestnut君への謝辞」で妄想した
・三次元空間上の直線のモデルRodとLoc、
・Rodの為のProce55ing描画メソッド+テクスチュアマッピング機能付きの三次元プリミティブ(球、箱、柱、錐 - 環はまだ)描画メソッドのコレクションl4p5
のテストが完了した。
  • 前記事のクラスメソッドの解説は最新版で更新済み

リアル側が急に忙しくなったので、週末になかなかまとまった時間が取れなくて・・・って言い訳。

で、re-chestnut君の回答スケッチをパクってやっと出来たRodテスターを、いつものように ガラクタ置き場に置いた。

ランダムに置かれた一つの点と二本の直線について
・その点から各々の直線に引いた垂線(緑)
・二本の直線の間の最近接線(黄色)
を表示する。
クリックでサイコロを振り直し、マウスを動かすととりあえずグリグリ動いて良さげであることが確認出来る。

これで元塾講師、有志、あるいは私自身への宿題のほとんどが解けるようになったけど、
・妄想中のクラスがもう少しある。(平面のモデルTagと姿勢のモデルShip、確率変数のモデルRndv)
・WiiremoteJ v1.5のテストとバランスボードの組み込み
にも手を出さなきゃ。

ま、ぼちぼち行く所存。


Processing については、
日本語サポートサイトからたどれるP5インフォメーション→言語が参考になる。
(解説してあるのは一昔前の版だから注意が必要だけど、loop()→draw()の読み替えだけで大抵OK)
・山本徹(thoru)さんがFunProce55ingで解説してくれている。(【簡潔】で【わかり易く】、【楽しい】解説)
例題集は習作集と区別するためにこちらに置いている。
・P5のスケッチからアプレットを作り、【ジオシティーズ】にアップする手順をまとめたので、参考に。
WiiRemoteアクセスライブラリWrj4P5はここ

閉じる コメント(22)

閉じる トラックバック(1)

re-chestnut君への謝辞=Rodの妄想

re-chestnut君への謝辞=Rodの妄想


元塾講師、有志、あるいは私自身への宿題でre-chestnut君が解いてくれた【問3】の解法を活用すべく、新しいクラスRodを妄想中。

クラス Rod ー 3次元空間の直線のモデル

位置ベクトルのモデルであるLocに比べると操作のバリエーションは少ないけど、各々の内容は遥かに濃い。とりあえず下記のようなイメージ
stern()=艢(とも)  :基点の位置
fore()=前方(ぜんぽう):長さ1の単位ベクトル
bow() =舳先(へさき) :(直線の)方向ベクトルを現在の長さ(length)だけ延長したところにある点
at(t)=tにある位置  :(直線の)方向ベクトルを長さtだけ延長したところにある点
length()=全長    ;この【線分】の長さ

つぎの三っつのメソッドはre-chestnut君による解の公式の成果。(多謝)
Rod nearest(Rod to) // thisとtoのあいだの最短線分、長さが0なら交差している
float dist(Rod to) // 二つの直線間の距離(3次元空間上での最近接距離)
boolean crossing(Rod to) // 直線toと交差するか?(最近接距離がゼロか?)
で、APIは
* Class Rod, the model of partial line on the 3D space,
 * 			spanned from it's stern to it's bow
 *					created by Classiclll, 6/28/2008
 *  Rod(Loc s, Loc b)			// only constructor you can use
 *  	Loc at(float t)			// location at t, at(0):stern, at(me.length):bow
	Rod move(Loc to)			// move stern to "to"
	Rod shift(Loc diff)		// shift stern by "diff"
	Rod shiftI(Loc diff)		// inverse shift
	Rod scale(float factor)	// scale the size of me by factor
	Rod scaleI(float factor)	// inverse scaling
	Loc intersect2D(Rod to) 	// intersect position on the x-y plane
	float signedDist2D(Rod pt)// distance with sign of left/right side on the x-y plane
	float dist2D(Loc pt)		// distance between "me" and "pt" on the x-y plane
	Rod ortho(Loc pt)		// the shortest rod connecting from "me" to "pt"
	Rod nearest(Rod to)		// the shortest rod connecting from "me" to "to"
	float dist(Loc pt)		// distance between "me" and "pt"
	boolean having(Loc pt)	// is "me" having "pt" on myself ?
	float dist(Rod to)		// least distance between "me" and line "to"
	boolean crossing(Rod to)// are "me" and "to" crossing each other ?
	float length()			// length of me
	Loc stern()				// location of the stern of me
	Loc bow()				// location of the bow of me
	Loc fore()				// foward direction of me, the unit vector
	Boolean equals(Rod to)
	String toString()
ついでに、

静的クラス l4p5 ー Loc, Rod, PImageのための描画ユーティリティ

Processingのsketchでは、例えば
Loc p=new Loc(1,2,3), q=new Loc(4,2,4);
l4p5.line(p, q);
のように使えるはず
* class l4p5, P5 drawing utilities for package Loc 
 *           coded by Classiclll on 08/07/20
[initial setting, always needed]
 *  setL4p5(PApplet parent)
[Processing's primitives]
	lline2D(Loc s, Loc t)
	lline2D(Rod r)
 	lline(Loc s, Loc t)
	lline(Rod r)
	lvertex(Loc l)
	lvertex(Loc l, float u, float v) 
	lvertex2D(Loc l)
 	lvertex2D(Loc l, float u, float v) 
	lbezierVertex(Loc l, Loc m, float x, float y, float z)
	lbezierVertex2D(Loc l, Loc m, float x, float y)
	lellipse(Loc l, float width, float height)
	lellipse(Rod r)
	lrect(Loc l, float width, float height)
	lrect(Rod r)
	lpoint(Loc l)
	lpoint2D(Loc l)
	lbox(Loc l, float width, float height, float depth)
	lbox(Rod r)
	lsphere(Loc l, float radius)
	lsphere(Rod r)
[Extended stufs]
	lpolygon(Loc[] at)
	lpolygon(Loc[] at, PImage img)
[Texture Mapped 3D Primitives.    coded by Classiclll on 5/1/2006]
	"dim" is the degree of detail of each shapes (positive odd number)
	[Capsules]
	void ltmdSphere(float radius, PImage img)
	void ltmdOctahedron(float radius, PImage img)
	void ltmdBarrel(float radius, PImage img)
	void ltmdCapsule(int dim, float radius, PImage img)
	[Tubes]
	void ltmdBox(float len, PImage img)
	void ltmdHexapole(float radius, float len, PImage img)
	void ltmdTube(int dim, float radius, float len, PImage img)
	[Cones]
	void ltmdTetra(float len, PImage img)
	void ltmdCone(float radius, float len, PImage img)
	void ltmdCone(int dim, float radius, float len, PImage img)
	[Torus]
		// To Do

【7月21日修正:最終版】


Processing については、
日本語サポートサイトからたどれるP5インフォメーション→言語が参考になる。
(解説してあるのは一昔前の版だから注意が必要だけど、loop()→draw()の読み替えだけで大抵OK)
・山本徹(thoru)さんがFunProce55ingで解説してくれている。(【簡潔】で【わかり易く】、【楽しい】解説)
例題集は習作集と区別するためにこちらに置いている。
・P5のスケッチからアプレットを作り、【ジオシティーズ】にアップする手順をまとめたので、参考に。
WiiRemoteアクセスライブラリWrj4P5はここ

閉じる コメント(0)

閉じる トラックバック(0)

ロジスティックモデル同定 ベータテスト8の解説と終了宣言



妄想中のVec, MatVfuncEqSysのベータテスト最終ケースにロジスティックモデルの同定を選んだ。

ロジスティックモデルは、基本的な成長モデルであり、例えば人口予測の数学モデル等に応用されている。
  取り上げたモデル式は、y = a / (b + c^x)

【予測】の一般的仮定
 世の中の(数量で捉えられる)気になる事象は、何らかの数式で規定される。しかし、我々がその事象を観測する時、様々な原因から観測誤差が混ざった形でしか計測できない。多くの観測を集めれば、観測誤差をある程度取り除く事が出来るはず。
  y:観測値 = f(x):規定する数式 + ε:観測誤差
   *x:観測値を得たときの前提(説明変量)
   *ε:観測誤差の期待値はゼロ

【ロジスティックモデル】への期待
 個体が少ない社会では生殖の機会が少なく、個体数の増加率は少ない。その後、若い個体の増加に従い生殖の機会が増加し、個体数は急激に増加する。しかし、個体数の急激な増加は居住面積を含めた様々な個体存在に必須なリソースが消費され、生殖は抑制され、個体数の増加が鈍くなり、最後には出生数と死亡数が拮抗し、個体数の増加は止まる。
 このような考察に良く合う曲線がロジスティックなので、もしかして人口増加の推移を良く説明してくれるのではないか?

【観測に基づくパラメータ推定】
 多数の観測値(obs[])と観測したときの説明変量(samples[])が得られているとする。このとき全ての観測誤差の累計を最小とするパラメータ(a,b,c)の組を得たい。
なので、例えば
  ssr(a,b,c) = Σ(obs[i]-f(samples[i])^2 : 残差平方和(SSR)
を最小にする(a,b,c)が所望のものとなる。

。α、β、γが所望のものとすると、下記を満たす。(必要条件)
  {ssr(α,β,γ)}/d(a,b,c)=0 ⇔ Σ2*(f(samples[j])-obs[j])*{f(samples[j])}/d(a,b,c) = 0
クラスVfunは上記の定式化は実装済みなので
  { f(x) ]/da = 0  ⇔  1 / (β+γ^x) = 0
  { f(x) ]/db = 0  ⇔  -α / (β+γ^x)^2 = 0
  { f(x) ]/dc = 0  ⇔  -α*x*γ^(x-1) / (β+γ^x)^2 = 0
を継承クラスModifiedLogisticに実装し、上記非線形連立方程式をVfuncに解かせればOK
ここまでが、ケース8のためのテストドライバと実装クラスの説明

テスト結果を見ると、ちょっと無理っぽい
 ・Simplexは収束しない
 ・Newtonはウソっぽい(実際、上記式では途中でダメになる)

ま、テスト5で例のあれが解ける事が確認できたので、とりあえずここまで。

==== ベータテストドライバ (8)====
//
//  Test for Vfunc, EqSys, Mat, Vec, and their solver methods.
//  Created by Classiclll on 06/03/19.
//

import lll.Loc.*;
public void setup() {
//	 8. estimate multi-variated non-linear regression coeficient, 
//		f8(x) = a / (b + c^x) - modified Logistic curve 
  Vec obs = new Vec(100);
  Mat samples = new Mat(100,2);
  ModifiedLogistic f8 = new ModifiedLogistic(); // f8(x) = a / (b + c^x)
  Vec trueParam = new Vec(new double[]{3,5,1});
  for (int i=0;i<100;i++) { // generate the random samples
	  double[] smpl 
	  	= { (Math.random()-0.5)*5, (Math.random()-0.5)*5};
	  samples.setRowVec(new Vec(smpl),i);
	  obs.arrayRef()[i]
	     = f8.valueAt(samples.rowVec(i), trueParam) + (Math.random()-0.5)*1;
  }
  Vec p0 = new Vec(new double[]{5,5,5});
 
  println("\n[ multi-variated non-linear regression Test ]");
  println(">> f8(1), value of f1 at x=1,y=1,a=3,b=5,c=1 is "
		  + f8.valueAt(new Vec(new double[]{1}), trueParam));
  println(">>true param is" + trueParam);
  println(">>estimated param by Newton "+f8.bestPrmByNewton(p0, obs, samples));
  println(">>estimated param by Simplex "+f8.bestPrmBySimplex(p0, obs, samples, 5000));

テスト結果

[ multi-variated non-linear regression Test ]
>> f8(1), value of f1 at x=1,,a=3,b=5,c=1 is 0.5
>>true param isVec(3.0 ,5.0 ,1.0)
>>estimated param by Newton Vec(3.0337683405566245 ,5.0 ,1.1491032007315607)
>>estimated param by Simplex Vec(NaN)

Vfunc、EqSysのテスト用実装クラス

import lll.Loc.*;

//8. estimate multi-variated non-linear regression coeficient, 
//f8(x) = a / (b + c^x) - modified Logistic curve 

public class ModifiedLogistic extends Vfunc {
  public ModifiedLogistic() {
	super(1,3);// dim of domain is 1, dim of parameters is 3
  }
  public double valueAt(Vec x, Vec p) {	// f(x) = a / (b + c^x) 
	return p.elem(0) / (p.elem(1) + Math.pow(p.elem(2),x.elem(0)) );
  }
  public Vec gradAt(Vec x, Vec p) {	// f'(x) = (-a*ln(c)/(b+c^x)^2)
	return this.diffAt(x, p.mul(.01), p);
  }
  public Vec gradParamAt(Vec x, Vec p) {	
	// fp'(p) = (1,   -1/b^2,   -x*c^(x-1)/c^2x )
	double xx=x.elem(0), b=p.elem(1), c=p.elem(2);
	  return new Vec(
	    new double[]{1,  -1/Math.pow(b, 2),
    			-xx*Math.pow(c, xx-1) / Math.pow(c, 2*xx) } );
  }
/*
  public Vec gradParamAt(Vec x, Vec p) {	
	// f(p) = f(a,b,c,d) = a / (b + c^x)
	// fp'(p) = ( 1/(b+c^x),
	//			-a/(b+c^x)^2,
	//			-a*x*c^(x-1)/(b+c^x+d^y)^2  )
	double xx=x.elem(0), a=p.elem(0), b=p.elem(1), c=p.elem(2);
	double denomi = b + Math.pow(c, xx);
	return new Vec(
		new double[]{1/denomi, -a/denomi/denomi,
		-a*xx/denomi*Math.pow(c, xx-1)/denomi } );
  }
*/
}

閉じる コメント(0)

閉じる トラックバック(0)

ベータテスト終了 VfucとEqSysとMatとVec

ベータテスト終了 VfuncとEqSysMatVec


妄想中のVec, MatVfuncEqSysの実装は済んで、残っていたベータテストも終わった。
  (最新仕様は各ページ更新済み)

アルファテストの対象は
 1.MatのLU分解、2.一元一次方程式、3.一元三次方程式、4.三元一次連立方程式
複数の解法で得られた解の比較でテストした。

で、今回は
 5.三元非線形連立方程式(4.の延長)の求解
   →例のあれが解ける事が確認できた。
 6.線形単回帰関数(y=ax+b)の観測に基づく係数の推定 (省略)
 7.線形重回帰関数(y=ax+by+cz+d)の観測に基づく係数の推定 (省略)

やっぱ、面倒だった。特に8番(結局、完璧じゃあ無い・・・別記事参照)
 8.非線形関数の観測に基づくパラメータ推定(別記事)

とりあえずパッケージlll.Locに含めた形でベータ公開準備中
ただし、使い易さ重視なので、 メモリ使用効率・計算効率・収束性・頑健性・計算精度・デバッグ効率については一切保障はないことに注意
==== ベータテストドライバ (5)====
//
//  Test for Vfunc, EqSys, Mat, Vec, and their solver methods.
//  Created by Classiclll on 06/03/19.
//

import lll.Loc.*;
public void setup() {
// 5. multi-value nonlinear equation test
  //	<Formulation for 3D triangulation with two wiiremotes>
  //		 [Pi]:the i-th reference point
  Loc[] pts
  	= new Loc[]{new Loc(.2f,.5f,.1f), new Loc(.12f,.44f,.2f), new Loc(.6f,.3f,.4f)};
  //		 |[Pj-Pi]|=Lij, (i!=j)
  double[] l2ij
  	= new double[]{pts[0].dist2(pts[1]), pts[0].dist2(pts[2]), pts[1].dist2(pts[2])};
  //		 [di]:the directional vector to [Pi]
  Loc[] dir = new Loc[]{pts[0].unit(), pts[1].unit(), pts[2].unit()};
  //		then each reference point is on the line
  //		     [Pi]=ti*[di]
  //		let cij=([dj]*[di]), then we get the followings
  double[] cij
  	= new double[]{dir[0].dot(dir[1]), dir[0].dot(dir[2]), dir[1].dot(dir[2])};
  //		 tj^2 - 2*cij*tj*ti + ti^2 - Lij^2 = 0
  Triangular trig = new Triangular(l2ij,cij);
  Vec x0 = new Vec(new double[]{1,1,1});
  Vec root;

  println("[ nonlinear equation system Test ]");
  println(">>by Newton\n"+ trig.jacobAt(x0));
  println(">>by Newton\n"+ (root=trig.solveByNewton(x0)));
  println(">>   F(x) = "+ trig.valueAt(root));
  println(">>by Simplex\n"+ (root=trig.solveBySimplex(x0,1000)));
  println(">>   F(x) = "+ trig.valueAt(root));

テスト結果

[ nonlinear equation system Test ]
>>by Newton
Mat{{0.06425809860229492, 0.06425809860229492, 0.0},
    {0.0, 0.5506737232208252, 0.5506737232208252},
    {0.5396480560302734, 0.0, 0.5396480560302734}}
>>by Newton
Vec(0.5579702401804243 ,0.5578155284121784 ,0.02707795585202451)
>>   F(x) = Vec(6.743494651573201E-13 ,3.0631813197068425E-9 ,2.9968867942820054E-9)
>>by Simplex
Vec(0.4979142256587791 ,0.5474806070350684 ,0.7809789539962118)
>>   F(x) = Vec(-2.6521510391508407E-5 ,-2.6521527641598652E-5 ,-2.652153279614211E-5)

Vfunc、EqSysのテスト用実装クラス

import lll.Loc.*;
//model of equation, tj^2 - 2*cij*tj*ti + ti^2 - Lij^2 = 0
public class Triangular extends EqSys {
  private double[] l2ij;
  private double[] cij;
  public Triangular(double[] l2, double[] c) {
	super(3,3);
	l2ij = l2;
	cij = c;
  }
  public Vec valueAt(Vec t) {	// fij(t) = tj^2 - 2*cij*tj*ti + ti^2 - Lij^2
  return new Vec(new double[]{
	t.elem(0) * (t.elem(0)-2*cij[0]*t.elem(1)) + t.elem(1)*t.elem(1) - l2ij[0],
	t.elem(1) * (t.elem(1)-2*cij[1]*t.elem(2)) + t.elem(2)*t.elem(2) - l2ij[1],
	t.elem(2) * (t.elem(2)-2*cij[2]*t.elem(0)) + t.elem(0)*t.elem(0) - l2ij[2]});
  }
  public Mat jacobAt(Vec t) {	// Jacobian of f(X)={f0(X), f1(X), f2(X)}
  double[][] jacobi =	{
// { {		dxf0(X),	dyf0(X),	dzf0(X)}
	{2*t.elem(0)-2*cij[0]*t.elem(1), -2*cij[0]*t.elem(0)+2*t.elem(1), 0 },
//   {		dxf1(X),	dyf1(X),	dzf1(X)}
	{ 0,	2*t.elem(1)-2*cij[1]*t.elem(2),    -2*cij[1]*t.elem(1)+2*t.elem(2)},
//   {		dxf2(X),	dyf2(X), 	dzf2(X)} }
	{ -2*cij[2]*t.elem(2)+2*t.elem(0), 0, 2*t.elem(2)-2*cij[2]*t.elem(0)    } };
	return new Mat(jacobi);
 }
 public Mat gradParamAt(Vec x) {
	return Mat.NaN.copy();
 }
}

閉じる コメント(0)

閉じる トラックバック(0)

アルファテスト終了(1/2) VfuncとEqSysとMatとVec

アルファテスト終了(1/2) VfuncとEqSysMatVec


妄想中のVec, MatVfuncEqSysの実装は済んで、とりあえずアルファテストが終わった。
  (最新仕様は各ページ更新済み)

アルファテストの対象は
 1.MatのLU分解
 2.一元一次方程式(2x-5=0)でのVec、Matの解とVfunc(Newton/Simplex)の解の比較
 3.一元三次方程式(x^3+3x^2+4x+2=0でのVecの解とVfuncの解(Newton/Simplex)の比較
 4.三元一次連立方程式(*下記)でのMatの解とEqSysの解(Newton/Simplex)の比較
   * x+y+z-1=0 & y+z-1=0 & x+z-1=0
このあと実施予定のベータテストは
 5.三元非線形連立方程式(4.の延長)の求解
 6.線形単回帰関数の観測に基づく係数の推定
 7.線形重回帰関数の観測に基づく係数の推定
 8.非線形関数の観測に基づくパラメータ推定
ちょいと面倒
でも、完成すると例のあれに取りかかれる。
 (5のテストケースにしよう)

このライブラリは上記8までテストできたらパッケージlll.Locに含めた形で公開予定
ただし、使い易さ重視なので、 メモリ使用効率・計算効率・収束性・頑健性・計算精度・デバッグ効率については一切保障はないことに注意

アルファテストドライバ

//
//  Test for Vfunc, EqSys, Mat, Vec, and their solver methods.
//  Created by Classiclll on 06/03/19.
//

import lll.Loc.*;
public void setup() {
   // Mat test
	  Mat m = new Mat( new double[][] { {1,1,1}, {0,1,1}, {1,0,1} } );

	  println("[ Mat Test ]\n"+ m);
	  println(">>singularity\n"+ m.isSingular());
	  println(">>LU\n"+ m.luDecompose());
	  println(">>Inverce of m\n"+ m.inverse());
	  println(">>Identity check\n"+ m.inverse().mul(m));
	  println(">>counter Identity\n"+ m.mul(m.inverse()));

   // simple, first order linear equation, 2x-5=0
	  
	  Vec svec = new Vec(new double[]{2});
	  Mat smat = new Mat(new double[][]{{2}});
	  SimpleFunc simple = new SimpleFunc() ;//sample implementation of Vfunc
	  Vec x0 = new Vec(new double[]{3});
	  Vec k = new Vec(new double[]{5});

	  println("\n[ 1st order eq, 2x-5=0 ]");
	  println(">>DKA Method\n"+ svec.solve(5));
	  println(">>LU Method\n"+ smat.solve(k));
	  println(">>Newton Method\n"+ simple.solveByNewton(x0, null));
	  println(">>Simplex Method\n"+ simple.solveBySimplex(x0, null, 1000));
	  
   // Polynomial Equation test, sample implementation of Vfunc
	  
	  PolyFunc poly = new PolyFunc() ;	//sample implementation of Vfunc
	  Vec f = new Vec( new double[] {1,3,4} );

	  println("\n[ Polynomial equation, x^3+3x^2+4x+2=0 ]");
	  println(">>DKA Method of Vec\n"+ f.solve(-2));
	  println(">>Newton Method of Vfunc\n"+poly.solveByNewton(x0,null));
	  println(">>Simplex Method of Vfunc\n"+poly.solveBySimplex(x0,null,1000));

   // Linear Equation System test, sample implementation of EqSys
	  
	  LinearFunc linear = new LinearFunc() ;//sample implementation of EqSys
	  Vec x1 = new Vec(new double[]{0,1,1});
	  Vec b = new Vec(new double[]{1,1,1});

	  println("\n[ linear eqs, x+y+z-1=0 & y+z-1=0 & x+z-1=0 ]");
	  println(">>LU Method of Mat\n"+ m.solve(b));
	  println(">>NewtonMethod of EqSys\n"+linear.solveByNewton(x1));
	  println(">>SimplexMethod of EqSys\n"+linear.solveBySimplex(x1,1000));
   } 
}

テスト結果

[ Mat Test ]
Mat{{1.0, 1.0, 1.0},
    {0.0, 1.0, 1.0},
    {1.0, 0.0, 1.0}}
>>singularity
false
>>LU
Mat{{1.0, 1.0, 1.0},
    {0.0, 1.0, 1.0},
    {1.0, -1.0, 1.0}}
>>Inverce of m
Mat{{1.0, -1.0, 0.0},
    {1.0, 0.0, -1.0},
    {-1.0, 1.0, 1.0}}
>>Identity check
Mat{{1.0, 0.0, 0.0},
    {0.0, 1.0, 0.0},
    {0.0, 0.0, 1.0}}
>>counter Identity
Mat{{1.0, 0.0, 0.0},
    {0.0, 1.0, 0.0},
    {0.0, 0.0, 1.0}}

[ 1st order eq, 2x-5=0 ]
>>DKA Method
Mat{{2.5},
    {0.0}}
>>LU Method
Vec(2.5)
>>Newton Method
Vec(2.5)
>>Simplex Method
Vec(2.499999999994543)

[ Polynomial equation, x^3+3x^2+4x+2=0 ]
>>DKA Method of Vec
Mat{{-1.0, -1.0, -1.0},
    {-1.0000000000000002, 2.350988701644575E-38, 1.0}}
>>Newton Method of Vfunc
Vec(-1.0)
>>Simplex Method of Vfunc
Vec(-1.000000000005457)

[ linear eqs, x+y+z-1=0 & y+z-1=0 & x+z-1=0 ]
>>LU Method of Mat
Vec(0.0 ,0.0 ,1.0)
>>NewtonMethod of EqSys
Vec(0.0 ,0.0 ,1.0)
>>SimplexMethod of EqSys
Vec(1.4803462177757E-9 ,1.4690450453997226E-9 ,0.999999997764883)

Vfunc、EqSysのテスト用実装クラス

5000文字制限を超えたので、別記事にした。

閉じる コメント(0)

閉じる トラックバック(0)

全3ページ

[1] [2] [3]

[ 次のページ ]


.

ブログバナー

検索 検索

Classiclll
人気度

ヘルプ

Yahoo Image

  今日 全体
訪問者 3 71513
ブログリンク 0 37
コメント 0 1869
トラックバック 0 37

開設日: 2005/3/21(月)


プライバシーポリシー -  利用規約 -  ガイドライン -  順守事項 -  ヘルプ・お問い合わせ

Copyright (C) 2012 Yahoo Japan Corporation. All Rights Reserved.