can anyone help me out of this problem: I need to integrate x^n e^[-x] for 0the error tolerence can be as large as 0.01, but I need a really fast method. thanks
g*i
2 楼
hehe, i just heard of this problem too. also interested
【在 j*c 的大作中提到】 : can anyone help me out of this problem: I need to integrate x^n e^[-x] : for 0: the error tolerence can be as large as 0.01, but I need a really fast : method. : thanks
h*o
3 楼
oh yeah, 想出个好办法 分步积分,每分步一次x^n降一次方,既然n < 5, 顶多4次,就可以让 x^n的n > 0 and < 1,这个时候的积分值一定是在积分x*exp[-x]和积分exp[-x] 之间,linear interpolate(normal scale or log scale)一下,应该差不 多了吧
【在 j*c 的大作中提到】 : can anyone help me out of this problem: I need to integrate x^n e^[-x] : for 0: the error tolerence can be as large as 0.01, but I need a really fast : method. : thanks
c*e
4 楼
对n积分还是对x积分? 对x积分的话是不是(a,b) 0.05<=a 【在 j*c 的大作中提到】 : can anyone help me out of this problem: I need to integrate x^n e^[-x] : for 0: the error tolerence can be as large as 0.01, but I need a really fast : method. : thanks
you will failed if you try. That's what I'm doing now. for x~0.1, the error will be about 10%(signle precision), and for x<0.1 single precision will fail. I can't use double precision for executing time requirement. btw: the job is pretty simple: n is integer and 0actually I use table interpolation for n=-1 in a x=i^2 x0 scale
【在 j*c 的大作中提到】 : I didn't try this method, but I think it will take as much time as Simpson : does for that error tolerance. : : correct, this is exactly what I mean. typically b/a<1.2
h*o
9 楼
what? n is an integer? if it's not a typo...you can get the exact result without much computing
【在 j*c 的大作中提到】 : you will failed if you try. That's what I'm doing now. for x~0.1, the error : will be about 10%(signle precision), and for x<0.1 single precision will fail. : I can't use double precision for executing time requirement. : btw: the job is pretty simple: n is integer and 0: actually I use table interpolation for n=-1 in a x=i^2 x0 scale
c*e
10 楼
n is a integer and 0then n=1,2,3,4 then you should be able to do it analytically yah for n=1: -x*exp(-x)-exp(-x) n=2: -x^2*exp(-x)-2*x*exp(-x)-2*exp(-x) n=3: -x^3*exp(-x)-3*x^2*exp(-x)-6*x*exp(-x)-6*exp(-x) n=4: -x^4*exp(-x)-4*x^3*exp(-x)-12*x^2*exp(-x)-24*x*exp(-x)-24*exp(-x)
【在 j*c 的大作中提到】 : you will failed if you try. That's what I'm doing now. for x~0.1, the error : will be about 10%(signle precision), and for x<0.1 single precision will fail. : I can't use double precision for executing time requirement. : btw: the job is pretty simple: n is integer and 0: actually I use table interpolation for n=-1 in a x=i^2 x0 scale
c*e
11 楼
even not, here is the solution given by maple: 1/(1+n)*x^(1/2*n)*exp(-1/2*x)*WhittakerM(1/2*n,1/2*n+1/2,x) WhittakerM() is a whatever function, you should be able to find tables to evaluate, hehe
【在 h***o 的大作中提到】 : what? n is an integer? : if it's not a typo...you can get the exact result without much : computing
h*o
12 楼
it could be a huge table...hiahia
【在 c*******e 的大作中提到】 : even not, here is the solution given by maple: : 1/(1+n)*x^(1/2*n)*exp(-1/2*x)*WhittakerM(1/2*n,1/2*n+1/2,x) : WhittakerM() is a whatever function, you should : be able to find tables to evaluate, hehe
c*e
13 楼
呵呵,这种东西我估计计算软件里面肯定都有了 找个现成的用上就可以了
【在 h***o 的大作中提到】 : it could be a huge table...hiahia
j*c
14 楼
this is the best method, but , my integration interval is very small, hence a^n e^(-a)-b^n e(-b) will get large error. so it's not useful for me.
【在 c*******e 的大作中提到】 : n is a integer and 0: then n=1,2,3,4 : then you should be able to do it analytically yah : for n=1: -x*exp(-x)-exp(-x) : n=2: -x^2*exp(-x)-2*x*exp(-x)-2*exp(-x) : n=3: -x^3*exp(-x)-3*x^2*exp(-x)-6*x*exp(-x)-6*exp(-x) : n=4: -x^4*exp(-x)-4*x^3*exp(-x)-12*x^2*exp(-x)-24*x*exp(-x)-24*exp(-x)
j*c
15 楼
that's a part of a big simulation code.
【在 h***o 的大作中提到】 : what? n is an integer? : if it's not a typo...you can get the exact result without much : computing
h*o
16 楼
ffdt...can't understand you le that's the analytical result of your integration, it's exact solution, no error at all ya
【在 j*c 的大作中提到】 : this is the best method, but , my integration interval is very small, hence : a^n e^(-a)-b^n e(-b) will get large error. so it's not useful for me.
【在 j*c 的大作中提到】 : this is the best method, but , my integration interval is very small, hence : a^n e^(-a)-b^n e(-b) will get large error. so it's not useful for me.
j*c
18 楼
if you do that there will be no error, but I need computer to do that :)
【在 h***o 的大作中提到】 : ffdt...can't understand you le : that's the analytical result of your integration, : it's exact solution, no error at all ya
j*c
19 楼
the error is from trancate error, it ocurs when need to compute 1.000000001-1.0 , I need a 1e-9 here, but computer gives 0. Actually I can get about 0.1 precision for x~0.1, but that's too bad for our purpose.
see cheungche's post....he gave the results of n = 1, 2, 3, 4 anyway, it's not hard at all to work out a general analytical formula parameterized by n.
【在 j*c 的大作中提到】 : if you do that there will be no error, but I need computer to do that :)
h*o
21 楼
then double precision
【在 j*c 的大作中提到】 : the error is from trancate error, it ocurs when need to compute 1.000000001-1.0 : , I need a 1e-9 here, but computer gives 0. Actually I can get about 0.1 : precision for x~0.1, but that's too bad for our purpose.
j*c
22 楼
computing time has the first prority :) double precision will take four times more time :( anyway, thanks all for your help
【在 j*c 的大作中提到】 : the error is from trancate error, it ocurs when need to compute 1.000000001-1.0 : , I need a 1e-9 here, but computer gives 0. Actually I can get about 0.1 : precision for x~0.1, but that's too bad for our purpose.
j*c
24 楼
I'm not simply deny your idea. What you said is exactly what I have done, so I know it can't meet my needs :( Thanks anyway
【在 j*c 的大作中提到】 : I'm not simply deny your idea. What you said is exactly what I have done, : so I know it can't meet my needs :( : Thanks anyway
h*o
26 楼
you are free, huh?
【在 c*******e 的大作中提到】 : 泥再把问题说具体一点,我来试试看怎么样?
j*c
27 楼
integration of x^n exp[-x] (actually my problem is to integration x^n exp[-(x-x0)/a],however, it can be rewrite as the sum of several x^n exp[-x]).0<=n<=4, x is any region (xi,xf) between 1e-6 and 1e8, with xf/xi~1.2. Since we have large error tolerance (0.01), we can use approximations for x<0.05 and x>20. The remain problem is for 0.05The most important issue here is that we can't use double precision for the executing time limitation. So the problem is: to find a fast method to solve t
【在 j*c 的大作中提到】 : I'm not simply deny your idea. What you said is exactly what I have done, : so I know it can't meet my needs :( : Thanks anyway
j*c
28 楼
~~~~~~~~~~~~~~~~~~~~~~ just thought that the large (0.1) error of the final results may occur when sum these integrations together. this implies a more accuracy integration of x^n exp[-x], maybe 0.001 or 0.0001
【在 j*c 的大作中提到】 : integration of x^n exp[-x] (actually my problem is to integration : x^n exp[-(x-x0)/a],however, it can be rewrite as the sum of several : x^n exp[-x]).0<=n<=4, x is any region (xi,xf) between 1e-6 and 1e8, with : xf/xi~1.2. Since we have large error tolerance (0.01), we can use : approximations for x<0.05 and x>20. The remain problem is for 0.05: The most important issue here is that we can't use double precision for : the executing time limitation. : So the problem is: to find a fast method to solve t