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

You are not logged in.

|
Options

bobbym
2010-06-11 11:40:52

They are often filled with incorrect data.

calccrypto
2010-06-11 11:23:57

weird. why are government publications so annoying???

bobbym
2010-06-11 09:49:44

Hi calccrypto;

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

calccrypto
2010-06-11 03:26:42

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

bobbym
2010-06-11 02:56:53

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.

calccrypto
2010-06-11 02:53:40

Thanks! but what about for s<2?

bobbym
2010-06-10 14:30:10

You don't need to:

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

calccrypto
2010-06-10 14:09:04

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.

bobbym
2010-06-10 13:15:54

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.

calccrypto
2010-06-10 13:14:04

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

bobbym
2010-06-10 13:05:53

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.

calccrypto
2010-06-10 13:02:22

oops. forgot that dt

thanks!

bobbym
2010-06-10 12:34:45

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:

calccrypto
2010-06-10 12:27:13

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

bobbym
2010-06-10 11:08:11

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.