Integration of Error function and Sum to infinity including cosine function


tome
11-02-2002, 03:14 PM
Hello,

I looked at the NR book, but i have a certain problem.

If i'm trying to take the integral from zero to anypoint, actullay time, to a function that composed of:

error function/time + error function/squre root of time + sum from 0 to infinity to a production of three functions exp,cos, and sin.

with respect to time.

it seems that my function inside the integral is complicated
its composed of error function, sum of exp,sin,cos..

first ; I couldnt find a routine/subtoutine to calculte the sum from zero to infinity?? in the NR book

and how can we treat this problem.


thanks

jaje
11-03-2002, 10:11 AM
Were you asking about this? (see attached.)

Jan M.(~_')

tome
11-03-2002, 04:03 PM
thanks Jan M. for your quick reply.

yes its simmilar except that the sum from k=1 to infinity is multiplied by the sum of error functions and take the integral to the whole thing.

looking forward your help.
tome.

jaje
11-06-2002, 06:36 AM
Could you please clarify what you meant by "multiplied by a sum of error functions"?

Jan M. (~_~)

P.S. Yes, I took the integral of the whole expression. As you can see, the whole expression was THE integrand.

tome
11-16-2002, 02:52 PM
thank you for the reply..

actually i have solved the problem but i still need a help. The question is what is the fortran codes to do the sum from k=1 to infinity for a function f(k) note: it is function of the k. I'm looking for the fortran lines to do this job.

i can do the sum from k=1 to kmax=10000 or any big number but its not efficent..

..


sum=0.0
do k=1,kmax
f=f(k)+sum
sum=f
end do


..

how can i do that if kmax = infinity!!!


thanks

jaje
11-18-2002, 05:11 AM
Well, the only thing you can do is to set kmax to be a very big number, say 10^4, or whatever is the "overflow threshold of your system".

After all, we are only going to approximate the sum, aren't we?

Hope this helps...

Jan M. (~_~)

Integral
09-18-2003, 07:37 AM
A good way to terminate such a sum as you are doing is to moniter each term, when they are sufficiently small exit the sum. What small is can vary of course. Play with the mimimun allowable term, watching your result to ensure a convergent process.