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

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

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

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,339

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.****If it ain't broke, fix it until it is.****No great discovery was ever made without a bold guess. **

Offline

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

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,339

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.****If it ain't broke, fix it until it is.****No great discovery was ever made without a bold guess. **

Offline

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

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,339

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.****If it ain't broke, fix it until it is.****No great discovery was ever made without a bold guess. **

Offline

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

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,339

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.****If it ain't broke, fix it until it is.****No great discovery was ever made without a bold guess. **

Offline

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

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.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,339

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.****If it ain't broke, fix it until it is.****No great discovery was ever made without a bold guess. **

Offline

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

Thanks! but what about for s<2?

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,339

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.****If it ain't broke, fix it until it is.****No great discovery was ever made without a bold guess. **

Offline

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

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)*

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,339

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.****If it ain't broke, fix it until it is.****No great discovery was ever made without a bold guess. **

Offline

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

weird. why are government publications so annoying???

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 106,339

They are often filled with incorrect data.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.****No great discovery was ever made without a bold guess. **

Offline

Pages: **1**