回 帖 发 新 帖 刷新版面

主题:[讨论]积分函数

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dir.h>
#include <io.h>
#include <math.h>
#include <iostream.h>
#include <bcd.h>
#include <complex.h>

complex i;
#define i complex(0.,1.)

#define h 0.001
#define pi 3.1415926

double beta=1.0;

double wc,w1c;
complex x1;
double t;
complex (*f)();

complex lags(x1)
[color=FF0000]{[/color] [color=FF00FF]运行时老是说这边declaration syntax error[/color]
  int k;
  f=x1;
  static double b[5]={0.26355990, 1.41340290, 3.59642600, 7.08580990, 12.64080000};
  static double c[5]={0.6790941054, 1.638487956, 2.769426772, 4.315944000, 7.104896230};
    complex g=0.0;
    for( k=0;k<=4;k++)
    {
        xx=b[k];
        g=g+c[k]*(*f)(xx);
    }
    return (g);
}

// -----------------------------------------------

void main()
{
    //参数设置--------------
    wc=100.0*beta;
    w1c=0.0*beta;
    //----------------------

    FILE *fp1;
    if((fp1=fopen("entropy.dat","wt"))==NULL)
    {
        printf("can not open file\n");
        exit(0);
    }

   complex lagsf(double);
   for(t=0.0000001;t<=50.0;)
    {
        complex At;     //////////////////
        At=exp(i*beta*(4.330959e+01)*t)/(1.0+pow(beta,1.5)/2.0/pow((sqrt(wc)+pow(-i*(i*beta*(4.330959e+01))-w1c,0.5)),2.0)/pow(-i*(i*beta*(4.330959e+01))-w1c,0.5))+[color=FF00FF]exp(i*w1c*t)/pi*lags(lagsf);[/color] [color=FF0000]此外调用积分函数[/color]
        double Pu;  // the upper-level population
        Pu=norm(At);

        //entropy------------------------------------------------------------

        //-------------------------------------------------------------------
        fprintf(fp1,"%e\t%e\n",t,Pu);
        t=t+h;
    }
}

complex lagsf(x)       //被积函数f1(x)

{   double x;

    complex y;
    y=pow(i*x*beta*beta*beta,0.5)*(wc-i*x)*exp(-x*t)/(pow((i*w1c-x)*(wc-i*x)-i*pow(beta*beta*beta*wc,0.5),2.0)+i*beta*beta*beta*x);
    return y;
}
请各位大侠帮忙看一下,主要是那边调用积分函数有问题,望高手指点下,看我编的求积分函数是否有问题,谢谢

回复列表 (共1个回复)

沙发

你好.我是全职网赚工作者.
如果你有时间有电脑.会打字.
想在网络上创业.请联系我..
项目绝对真实.详情QQ空间资料
加盟请联系 QQ909065437

我来回复

您尚未登录,请登录后再回复。点此登录或注册