中文国产日韩欧美视频,午夜精品999,色综合天天综合网国产成人网,色综合视频一区二区观看,国产高清在线精品,伊人色播,色综合久久天天综合观看

用矩形法求定積分的通用函數(shù)

時(shí)間:2024-07-27 04:37:14 資料大全 我要投稿
  • 相關(guān)推薦

用矩形法求定積分的通用函數(shù)

  解: #include

  main()

  { float integral(float(8p)(float),float a,float b,int n);

  float a1,b1,a2,b2,a3,b3,c,(*p)(float);

  float fsin(float);

  float fcos(float);

  float fexp(float);

  int n=20;

  printf(“Input a1,b1:”);

  scanf(“%f,%f”,&a1,&b2);

  printf(“Input a2,b2:”);

  scanf(“%f,%f”,&a2,&b2);

  printf(“Input a3,b3:”);

  scanf(“%f,%f”,&a3,b3);

  p=fsin;

  c=integral(p,a1,b1,n);

  printf(“The integral of sin(x) is:%f\n”,c);

  p=fcos;

  c=integral(p,a2,b2,n);

  printf(“The integral of cos(x) is :%f\n”,c);

  c=integral(p,a3,b3,n);

  printf(“The integral of sin(x) is :%f\n”,c);

  }

  float integral(float (*p)(float),float a,float b,int n)

  {

  int i;

  floatx,h,s;

  h=(b-a)/n;

  x=a;

  s=0;

  for(i=1;i<=n;i++)

  {x=x+h;

  s=s+(*p)(x)*h;

  }

  return(s);

  }

  float fsin(float x)

  {return sin(x);}

  float fcos(float x)

  {return cos(x);}

  float fexp(float x)

  {return exp(x);}

【用矩形法求定積分的通用函數(shù)】相關(guān)文章:

學(xué)習(xí)高數(shù)定積分計(jì)算常用技巧07-08

什么是積分入學(xué)10-04

怎樣定總結(jié)?07-30

《函數(shù)的概念》說(shuō)課稿08-15

廣州積分入學(xué)條件06-23

求唯美悲傷的句子06-21

求上進(jìn)勵(lì)志名言07-08

廣州積分入戶申請(qǐng)資格09-15

東莞積分入學(xué)時(shí)間10-26

求世上最難的繞口令10-18