MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
MGBisection クラスabstract

A virtual super class to solve non-linear equations by the bicection method. [詳解]

公開メンバ関数

 MGBisection (double ts, double te)
 
virtual ~MGBisection ()
 
virtual void set_initial_t (double t)=0
 Prepare by setting the initial value. [詳解]
 
virtual double compare_replace (double t, bool &replaced)=0
 
double solve (double t, double span_initial, double tolerance, int &nrepition)
 Solve the equation with bisection method. [詳解]
 

詳解

A virtual super class to solve non-linear equations by the bicection method.

Let f(t) be a function of one double parameter, and a solution of f(t) is known to exist between [ts,te]. Then MGBisect::solve() gets the solution, given the initial candidate t, the initial span, and the tolerance to halt the iteration. To use MGBisection, define a subclass of MGBisection, and prepare member functions set_initial_t() and compare_replace(), and use solve() method to get the solution.

構築子と解体子

MGBisection::MGBisection ( double  ts,
double  te 
)
引数
tsparameter range from ts
teto te.
virtual MGBisection::~MGBisection ( )
inlinevirtual

関数詳解

virtual double MGBisection::compare_replace ( double  t,
bool &  replaced 
)
pure virtual

compare with the previous function value(the initial value is set by set_initial_t) and replace t with the previous one if necessary. The function's return value is the new parameter value.

引数
tparameter value to compare at.
replacedtrue will be returned if the t is the new solution candidate value.
virtual void MGBisection::set_initial_t ( double  t)
pure virtual

Prepare by setting the initial value.

double MGBisection::solve ( double  t,
double  span_initial,
double  tolerance,
int &  nrepition 
)

Solve the equation with bisection method.

引数
tThe initial parameter value.
span_initialThe initial parameter span length to increment or decrement, span*.5 will be the 1st try of the iteration.
toleranceThe tolerance to halt the bisection iteration.
nrepitioniterated number will be returned.

このクラス詳解は次のファイルから抽出されました: