cvl-robot's diary

研究ノート メモメモ https://github.com/dotchang/

2015-03-03から1日間の記事一覧

C言語で微分の数値計算

もっといい方法ありそう。 #include #include float func(float x) { return x*x; // どんな関数でもいい }int main(int argc, char* argv[]) { float x, df_dx; x = 0.5; // 適当 df_dx = (fx(x+FLT_EPSILON)-fx(x-FLT_EPSILON))/(2*FLT_EPSILON); std::cou…