C语言如何实现微积分运算

Python013

C语言如何实现微积分运算,第1张

计算微积分有很多数值逼近的算法,任何可以计算微积分的语言都是用这种方法比如插值多项式,构造数值积分来计算的。只有近似值,没有准确值。你需要自己编程,编运算方法来计算。具体的lz去参看相关的书籍,比如计算方法

typedef double(*FUN_TYPE)(double)

double derive(double x0, double h, FUN_TYPE fun)

    return (fun(x0 + h) - fun(x0 - h)) / 2.0 / h

}

int main()

{

    double d = 1.15

    double dd = derive(d, 0.01, exp)

    cout << dd << endl

}