This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Technology & Calculator Open Topic subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

Math and Science => Technology & Calculator Open Topic
Author Message
Graphmastur

Joined: 25 Mar 2009
Posts: 360

 Posted: 27 Apr 2010 07:46:01 pm    Post subject: Simply for the record. THIS IS NOT A HOMEWORK QUESTION. Okay, now on to the homework looking question... Okay, I have this integral: [attachment=3168:gamma(Z).tiff] If I want to find the antiderivative (indefinite derivative?) of the function, how do I do it? This will allow me to solve it right? If not, how do I solve it quickly? My overall goal is to solve it fairly quickly, or in a reasonable amount of time. Is this possible? I will be using a HUGE n value, I don't know what z is just yet, and t is the variable, so.... please help. Also, ignore the "/; Re(z)>0" thing. I think that means it's just real numbers greater than 0, or something. Since I only want to use real positive numbers for z, that's no problem. Also, I understand the derivative. Antiderivatives are still above my current level. So, how do I solve this? Thanks in advance.
wesley

Newbie

Joined: 05 May 2009
Posts: 45

 Posted: 27 Apr 2010 08:29:06 pm    Post subject: Well, that's pretty funny. That's no ordinary antiderivative you've got there. That is a gamma function. You learn about those in probability and statistics with applied calculus (calculus 2). Also, yours has a limit. This is the most important thing. It doesn't mean you keep integrating for every value of n, that would take forever of course! (Considering the fact that n goes to infinite.) Thus, you simply substitute infinite with an arbitrary variable until you are done integrating, at which point, you will insert infinite for that variable you placed in the equation. Also, the antiderivative is simply an integral, not an indefinite derivative. This problem can be solved in a quick manner of time, but it takes some good thought and understanding the gamma function. This is NOT, by any means an elementary calculus problem. If it isn't homework, do you mind sharing its source? I didn't dive too deep into the gamma function in my class last year, but we went over it a little, so it is familiar.Last edited by Guest on 27 Apr 2010 08:32:05 pm; edited 1 time in total
Graphmastur

Joined: 25 Mar 2009
Posts: 360

 Posted: 27 Apr 2010 10:03:46 pm    Post subject: Wesley wrote: Also, yours has a limit. This is the most important thing. It doesn't mean you keep integrating for every value of n, that would take forever of course! (Considering the fact that n goes to infinite.) Thus, you simply substitute infinite with an arbitrary variable until you are done integrating, at which point, you will insert infinite for that variable you placed in the equation. This problem can be solved in a quick manner of time, but it takes some good thought and understanding the gamma function. This is NOT, by any means an elementary calculus problem. If it isn't homework, do you mind sharing its source? So in order: I will be using java, so I will substitute some HUGE number to use for infinity. Yeah, I know limits and derivatives. I know antiderivatives of polynomial functions, but nothing else. I know nothing of solving them either. The source of the function is wolfram. I'm trying to find a factorial fairly quickly, so I decided to use the gamma function. This works perfectly in mac grapher, but I don't know how to do integrals at all. This is a programming question, because I need to be able to implement it. Thanks for the quick reply.
wesley

Newbie

Joined: 05 May 2009
Posts: 45

 Posted: 27 Apr 2010 10:38:25 pm    Post subject: Oh, I see. Why don't you just make an implementation with memorization. This would be a great deal better than recursion (as you most-likely know).
wesley

Newbie

Joined: 05 May 2009
Posts: 45

 Posted: 28 Apr 2010 12:25:22 am    Post subject: Ah, man! I can't believe I got hooked on this problem! Just to calculate that integral, you need to take just as many steps as multiplying all the numbers from 1 to n. The integral is recursive, you need to use integration by parts.
thornahawk
μολών λαβέ

Active Member

Joined: 27 Mar 2005
Posts: 569

 Posted: 28 Apr 2010 04:45:21 am    Post subject: It looks to me like a not-too-docile (for numerical work, that is) integral, not in any event any more advantageous than (for instance) the defining infinite integral for the gamma function. "This is a programming question, because I need to be able to implement it." There are so much better methods for calculating a gamma function; the Stirling and Lanczos approximations being the most popular. You should look into those instead of looking for integrals. If my words are not convincing enough, you might wish to peruse the following Mathematica output: The entries of that table are of the form -log10(|(f(n,z)-Γ(z))/Γ(z)|) (i.e. the negative common logarithm of the relative error), where n is the row heading, z is the column heading, and f(n,z) is the expression inside the limit. As you can see you only gain one digit of accuracy every time you increase n ten times. Much ado about nothing when there are ways to compute the gamma function more accurately with less effort. thornahawk
Graphmastur

Joined: 25 Mar 2009
Posts: 360

 Posted: 28 Apr 2010 06:39:51 am    Post subject: thornahawk wrote: It looks to me like a not-too-docile (for numerical work, that is) integral, not in any event any more advantageous than (for instance) the defining infinite integral for the gamma function. "This is a programming question, because I need to be able to implement it." There are so much better methods for calculating a gamma function; the Stirling and Lanczos approximations being the most popular. You should look into those instead of looking for integrals. If my words are not convincing enough, you might wish to peruse the following Mathematica output: The entries of that table are of the form -log10(|(f(n,z)-Γ(z))/Γ(z)|) (i.e. the negative common logarithm of the relative error), where n is the row heading, z is the column heading, and f(n,z) is the expression inside the limit. As you can see you only gain one digit of accuracy every time you increase n ten times. Much ado about nothing when there are ways to compute the gamma function more accurately with less effort. thornahawk The problem is that it needs to be accurate. Why can't I just solve the integral? N would be huge, so that shouldn't be a problem.
thornahawk
μολών λαβέ

Active Member

Joined: 27 Mar 2005
Posts: 569

 Posted: 28 Apr 2010 08:20:59 am    Post subject: Hmm, I seem to have screwed the labeling up in that post; the rows are supposed to be the z values and the columns the n values for that integral. As you have seen it required a limit of 108 (and approximately the same amount of function evaluations) to get merely 8 digit accuracy. Stirling and Lanczos, written properly, can give 12-14 digit accuracy with less effort. thornahawk
Graphmastur

Joined: 25 Mar 2009
Posts: 360

 Posted: 28 Apr 2010 05:35:07 pm    Post subject: thornahawk wrote: Hmm, I seem to have screwed the labeling up in that post; the rows are supposed to be the z values and the columns the n values for that integral. As you have seen it required a limit of 108 (and approximately the same amount of function evaluations) to get merely 8 digit accuracy. Stirling and Lanczos, written properly, can give 12-14 digit accuracy with less effort. thornahawk So if I do a 1099999, it will give me 99999 digits accuracy? So even if the other two are better, how do I work this problem?
thornahawk
μολών λαβέ

Active Member

Joined: 27 Mar 2005
Posts: 569

Graphmastur

Joined: 25 Mar 2009
Posts: 360

 Posted: 28 Apr 2010 09:37:57 pm    Post subject: I will use one of the other methods, if they can give me completely accurate. Is this possible?
wesley

Newbie

Joined: 05 May 2009
Posts: 45

 Posted: 29 Apr 2010 01:04:32 am    Post subject: Graphmastur wrote: I will use one of the other methods, if they can give me completely accurate. Is this possible? Graphmastur, if you want your result to be completely accurate, you will have to take just as many steps as calculating the factorial the original way, unless you used a slightly sped-up version. Or possibly some of these. Is it really that important to get the exact value? This can't be necessary. Remember that we must sacrifice some things to make up for speed. Accuracy meets this case.
thornahawk
μολών λαβέ

Active Member

Joined: 27 Mar 2005
Posts: 569

 Posted: 29 Apr 2010 01:20:58 am    Post subject: Think of gamma like the other more common transcendentals: sin(1) and ln(2) are never exactly computed, be it Java or some other programming language; these quantities are (usually) computed up to the number of significant figures the machine supports. Since the gamma function is rational only for nonnegative integers, you can only approximate it. Which brings me to the question that should have been asked right off the bat in the very first reply: why exactly do you need a gamma function. Usually computing it only comes up in the context of computing a more complicated function in a lot of applications. What are you trying to compute, and how does gamma enter that picture? thornahawk P.S. I've alluded to P. Luschny's work in a number of my previous posts (including some of my posts related to computing the gamma function); do have a peek at his site.
Graphmastur

Joined: 25 Mar 2009
Posts: 360

 Posted: 29 Apr 2010 06:28:35 am    Post subject: thornahawk wrote: Think of gamma like the other more common transcendentals: sin(1) and ln(2) are never exactly computed, be it Java or some other programming language; these quantities are (usually) computed up to the number of significant figures the machine supports. Since the gamma function is rational only for nonnegative integers, you can only approximate it. Which brings me to the question that should have been asked right off the bat in the very first reply: why exactly do you need a gamma function. Usually computing it only comes up in the context of computing a more complicated function in a lot of applications. What are you trying to compute, and how does gamma enter that picture? thornahawk P.S. I've alluded to P. Luschny's work in a number of my previous posts (including some of my posts related to computing the gamma function); do have a peek at his site. Well, the majority, if not all of the factors need to be correct. I've also looked into luschny's work. I figured out how to solve this with Riemann sums, but is there afaster way to solve the integral? (please don't refer me to any other algorithms at this time. I simply want to find the answer to this integral now.)
thornahawk
μολών λαβέ

Active Member

Joined: 27 Mar 2005
Posts: 569

 Posted: 29 Apr 2010 08:33:26 am    Post subject: Frankly, your insistence on quadrature tells me you've never even attempted to graph the function you're trying to integrate. 'cause, a good look at the graph alone would have told me that even the most sophisticated adaptive quadrature scheme would fare just as badly as a simple Riemann sum. Trying to pretend a decidedly ill-behaved function can be adequately represented as a (piecewise) polynomial has never ended well. I have no further advice to give; I think I have done my utmost here, and there seems to be no dissuading you. I can only hope whatever lessons you learn from attempting this exercise are not easily forgotten. Cordially, thornahawk
 Display posts from previous: All Posts Oldest FirstNewest First
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
 Page 1 of 1 » All times are UTC - 5 Hours