下面求的是f(x)=e^x*cosx的定积分,求帮忙改成求 f(x) = x * x - 5 * x + 1的;其他不要

下面求的是f(x)=e^x*cosx的定积分,求帮忙改成求 f(x) = x * x - 5 * x + 1的;其他不要改,
辛普森(Simpson)法求f(x)=e^x*cosx的定积分,只需把原函数替换为 f(x) = x * x - 5 * x + 1的;其他不要改,请帮忙运行下 没错的话一定采纳,
#include
#include
double Simpson(double(*fun)(double),
double a,double b,double n)
{
double k,simp,s1,s2=0.0;
double h=(b-a)/n;
s1=fun(b+h/2);
for(k=1;k>b>>n;
simp=Simpson(fun,a,b,n);
cout
yingjichangkong 1年前 已收到1个回答 举报

pinghe123 花朵

共回答了17个问题采纳率:94.1% 举报

#include
#include
double Simpson(double(*fun)(double),double a,double b,double n)
{
x05double k,simp,s1,s2=0.0;
x05double h=(b-a)/n;
x05s1=fun(b+h/2);
x05for(k=1;k>b>>n;
x05simp=Simpson(fun,a,b,n);
x05cout

1年前

1
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.013 s. - webmaster@yulucn.com