Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2010-06-09 10:24:48

calccrypto
Member
Registered: 2010-03-06
Posts: 96

How do programs integrate to infinity?

How do non-symbolic programs integrate to infinity? sometimes using a large upper bound isnt good enough


Visit calccrypto.wikidot.com for detailed descriptions of algorithms and other crypto related stuff (not much yet, so help would be appreciated).

Offline

#2 2010-06-09 13:08:11

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,611

Re: How do programs integrate to infinity?

Hi calccrypto;

There are numerous techniques, to be more specific I would have to see the integral.

Here is the caveat. If a black box integrator can't do the integral, whether it has an upper limit of infinity or not means that you are usually going to have to use math to clean the integral up. The term is called improving the geometry of the integrand.

There is a story about a certain air force whose pilots enjoyed a 10 to 1 kill ratio. When those pilots were upgraded to missiles, their kill ratio dropped down to 3 to 1. Why, they became dependent on missiles and had lost their basic dogfighting skills. Same thing here, as everyone grows dependent on the black box integrator, fewer and fewer people can now "improve the geometry." The trend is to plug it in to say Maple and forget about it. Worse, to blindly trust any answer any computer, anywhere spits out.

Here is an example that is easy to follow but yet illustrates the point. Now this integral is easy to do analytically and equals 2 / 3 = .6666666666. This is only to demonstrate a point. Incidentally this is called BM's integral, as part of an inside joke.

If we try to use simpsons rule on it we need 100 panels to get .66585. If we now transform the integral into:

Now using simpsons rule and 100 panels we get .666666666

This is a much better answer for the same amount of work.

Same thing for your question.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#3 2010-06-09 14:27:13

calccrypto
Member
Registered: 2010-03-06
Posts: 96

Re: How do programs integrate to infinity?

so the functions are transformed some how? how would that work for a small program? a large library of familiar functions? that would be crazy

the function im working on is


Visit calccrypto.wikidot.com for detailed descriptions of algorithms and other crypto related stuff (not much yet, so help would be appreciated).

Offline

#4 2010-06-09 14:34:45

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,611

Re: How do programs integrate to infinity?

Hi calccrypto;

Should be a dt on the end :

This numerator is an upper incomplete gamma function and you only have to look up how to evaluate it. The abramowitz stegun book might help.

There is a neat continued fraction:


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#5 2010-06-09 15:02:22

calccrypto
Member
Registered: 2010-03-06
Posts: 96

Re: How do programs integrate to infinity?

oops. forgot that dt

im downloading the book right now, but its taking a bit long (43mb)

thanks!


Visit calccrypto.wikidot.com for detailed descriptions of algorithms and other crypto related stuff (not much yet, so help would be appreciated).

Offline

#6 2010-06-09 15:05:53

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,611

Re: How do programs integrate to infinity?

Yes, there are some other forms, that might be even easier for computation. It looks pretty stable though. It is a good book and a must for numerical work.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#7 2010-06-09 15:14:04

calccrypto
Member
Registered: 2010-03-06
Posts: 96

Re: How do programs integrate to infinity?

weird. i just remembered to look at wolfram, and i found another way to do it: 1 - lower_incomplete_gamma (the equation involving sigma), but the values that come out are weird. some values come out correctly, but others dont

>>> igamc(1.,2.13333/2)
0.34415436045553527        correct
>>> igamc(1.5,4.882605/2)
0.19091682276034516       off slightly
>>> igamc(1,.596953/2)
0.74194771741659593       correct
>>> igamc(1.5,.5)
0.65129687629720212      supposed correct answer is 0.801252, wolfram is giving me 0.710091

and i have not yet figured out how to do those continued fractions, so im afraid no luck there for the moment


Visit calccrypto.wikidot.com for detailed descriptions of algorithms and other crypto related stuff (not much yet, so help would be appreciated).

Offline

#8 2010-06-09 15:15:54

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,611

Re: How do programs integrate to infinity?

The lower incomplete is not what you want. You want the upper and remember your your function divides by gamma(a).

I can dig up possibly some computer programs for the evaluation of continued fractions.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#9 2010-06-09 16:09:04

calccrypto
Member
Registered: 2010-03-06
Posts: 96

Re: How do programs integrate to infinity?

ooh... could you? im terrible with finding programs i need/want

after editing the formula to
upper = 1 - lower_incomplete_gamma-> upper / gamma(a), im still getting the same correct values, but different wrong values.


Visit calccrypto.wikidot.com for detailed descriptions of algorithms and other crypto related stuff (not much yet, so help would be appreciated).

Offline

#10 2010-06-09 16:30:10

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,611

Re: How do programs integrate to infinity?

You don't need to:

Try that. It is accurate for s >= 2 and z > 0.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#11 2010-06-10 04:53:40

calccrypto
Member
Registered: 2010-03-06
Posts: 96

Re: How do programs integrate to infinity?

Thanks! but what about for s<2?


Visit calccrypto.wikidot.com for detailed descriptions of algorithms and other crypto related stuff (not much yet, so help would be appreciated).

Offline

#12 2010-06-10 04:56:53

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,611

Re: How do programs integrate to infinity?

Hi calcrypto;

Actually it is very accurate for s >= 1 and z > 0. If you need values of 0< s <1 I can compute those.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#13 2010-06-10 05:26:42

calccrypto
Member
Registered: 2010-03-06
Posts: 96

Re: How do programs integrate to infinity?

im afraid that the equation is giving me similar incorrect values for the values i got wrong, and the correct values that i got correct. weird

>>> igamc(2,1.6/2)
0.80879213541099948        0.9057
igamc(1,.596953/2)
0.74194771741659604        correct
igamc(4,.502193/2)
5.9991863583757725          0.261961
>>> igamc(1.5,4.882605/2)
0.16003494020523146        0.180598

or did i mess up the equation in my program?
def igamc(s,z):
    return ((e**-z)*(z**(s-1))*(z*((s**2)-s*(2*z+9)+z*(z+11)+26)+6))/(-s**3 + 3*s**2*(z +3) - s*(3*z*(z+7)+26) + z*((z+6)**2)+24)



EDIT: it turns out that the values are more or less correct, but the reference paper has weird answers

Last edited by calccrypto (2010-06-10 09:09:51)


Visit calccrypto.wikidot.com for detailed descriptions of algorithms and other crypto related stuff (not much yet, so help would be appreciated).

Offline

#14 2010-06-10 11:49:44

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,611

Re: How do programs integrate to infinity?

Hi calccrypto;

I have checked my function with mathematica and it is returning very accurate answers for all your input.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

#15 2010-06-10 13:23:57

calccrypto
Member
Registered: 2010-03-06
Posts: 96

Re: How do programs integrate to infinity?

weird. why are government publications so annoying???


Visit calccrypto.wikidot.com for detailed descriptions of algorithms and other crypto related stuff (not much yet, so help would be appreciated).

Offline

#16 2010-06-10 13:40:52

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 81,611

Re: How do programs integrate to infinity?

They are often filled with incorrect data.


In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

Board footer

Powered by FluxBB