真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

c語(yǔ)言求定積分三角函數(shù),用C語(yǔ)言求定積分

c語(yǔ)言編寫(xiě)三角函數(shù)

求sin的:參考下 #includestdio.h void main() { double x,a,b,sum=0; printf("請(qǐng)輸入x的弧度值:\n"); scanf("%lf",x); int i,j,count=0; for(i=1;;i+=2) { count++; a=b=1; for(j=1;j=i;j++) { a*=x; b*=(double)j; } if(a/b0.0000001) break; else { if(count%2==0) sum-=a/b; else sum+=a/b; } } printf("%lf\n",sum); }

成都創(chuàng)新互聯(lián)公司 - 成都服務(wù)器托管,四川服務(wù)器租用,成都服務(wù)器租用,四川網(wǎng)通托管,綿陽(yáng)服務(wù)器托管,德陽(yáng)服務(wù)器托管,遂寧服務(wù)器托管,綿陽(yáng)服務(wù)器托管,四川云主機(jī),成都云主機(jī),西南云主機(jī),成都服務(wù)器托管,西南服務(wù)器托管,四川/成都大帶寬,機(jī)柜大帶寬,四川老牌IDC服務(wù)商

用C語(yǔ)言編寫(xiě)一個(gè)求定積分的程序

這是辛普森積分法。

給你寫(xiě)了fun_1( ),fun_2(),請(qǐng)自己添加另外幾個(gè)被積函數(shù)。

調(diào)用方法 t=fsimp(a,b,eps,fun_i);

a,b --上下限,eps -- 迭代精度要求。

#includestdio.h

#includestdlib.h

#include math.h

double fun_1(double x)

{

return 1.0 + x ;

}

double fun_2(double x)

{

return 2.0 * x + 3.0 ;

}

double fsimp(double a,double b,double eps, double (*P)(double))

{

int n,k;

double h,t1,t2,s1,s2,ep,p,x;

n=1; h=b-a;

t1=h*(P(a)+P(b))/2.0;

s1=t1;

ep=eps+1.0;

while (ep=eps)

{

p=0.0;

for (k=0;k=n-1;k++)

{

x=a+(k+0.5)*h;

p=p+P(x);

}

t2=(t1+h*p)/2.0;

s2=(4.0*t2-t1)/3.0;

ep=fabs(s2-s1);

t1=t2; s1=s2; n=n+n; h=h/2.0;

}

return(s2);

}

void main()

{

double a,b,eps,t;

a=0.0; b=3.141592653589793238; eps=0.0000001;

// a definite integral by Simpson Method.

t=fsimp(a,b,eps,fun_1);

printf("%g\n",t);

t=fsimp(a,b,eps,fun_2);

printf("%g\n",t);

// ...

printf("\n Press any key to quit...");

getch();

}

用c語(yǔ)言求定積分

#include

#include

double integral(double(*fun)(double x),double a,double b,int,n){

double s,h,y;

int i;

s=(fun(a)+fun(b))/2;

h=(b-a)/n; /*積分步長(zhǎng)*/

for(i=1;in;i++)

s=s+fun(a+i*h);

y=s*h;

return y;/*返回積分值*/

}

double f(double x){

return(x*sinx) /*修改此處可以改變被積函數(shù)*/

}

int main(){

double y;

y=integral(f,1.0,2.0,150);/*修改此處可以改變積分上下限和步數(shù),步長(zhǎng)=(上限-下限)/步數(shù)*/

printf("y=%f\n",y);

return 0;

}

int main()

求解含有三角函數(shù)的定積分c語(yǔ)言程序∫(1+cosπx)dx

#include?stdio.h

#include?math.h

#define?PI?(acos(-1))

#define?STEP?(1e-6)

double?func(double?x);

double?inte(double?up,double?down,double?func(double));

int?main(void)?

{

double?up,down;

printf("%lf%lf",up,down);

printf("%lf\n",inte(1,0,func));

return?0;

}

double?func(double?x)

{

return?1+cos(PI*x);

}

double?inte(double?up,double?down,double?func(double))

{

double?sum;

for(sum=0;down=up;down+=STEP)

{

sum+=func(down)*STEP;

}

return?sum;

}

求解含有三角函數(shù)的定積分c語(yǔ)言程序

求解含有三角函數(shù)的定積分c語(yǔ)言程序∫(1+cosπx)dx

#include?stdio.h?

#include?math.h?

#define?PI?(acos(-1))?

#define?STEP?(1e-6)?

double?func(double?x);?

double?inte(double?up,double?down,double?func(double));?

int?main(void)??

{?

double?up,down;?

printf("%lf%lf",up,down);?

printf("%lf\n",inte(1,0,func));?

return?0;?

}?

double?func(double?x)?

{?

return?1+cos(PI*x);?

}?

double?inte(double?up,double?down,double?func(double))?

{?

double?sum;?

for(sum=0;down=up;down+=STEP)?

{?

sum+=func(down)*STEP;?

}?

return?sum;?

}


當(dāng)前名稱(chēng):c語(yǔ)言求定積分三角函數(shù),用C語(yǔ)言求定積分
網(wǎng)址分享:http://weahome.cn/article/hddsdg.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部