LoginSignup
0
0

More than 5 years have passed since last update.

[PSP演習] 5A 数値積分

Posted at

次のような形式で、シンプソン則で積分する関数を作成せよ。

public delegate double CalcFunc(double x);
public static double Simpson(CalcFunc f, double lower, double upper);

シンプソン則は、n 分割した n+1 個の位置での値に 1,4,2,4,2,...,1 を掛けて和をとり、 (upper-lower) を掛けて 3*n で割ったものが積分値となる。分割数は偶数でなければいけない。 無限ループにならないようにチェックせよ。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0