Any idea how can I solve this integral?

Started by
12 comments, last by grhodes_at_work 19 years ago
I have to integrate this function: (Ln[(1+x)/(1-x)]+2*x^(1/3))/(x+2*Sin[x]) in the interval [0 1]. One way it to use Simpson's rule but there will be a division by 0 (obviously). Any ideas what to do?? [Edited by - NamelessTwo on March 29, 2005 11:26:52 AM]
Another nameless person in the virtual space...
Advertisement
Your parentheses don't match.

Do you need the antiderivative of the function or only the value of the integral?
well, here is a very cool link. BTW, you might want to put an extra open-parens on the front of the equation you posted.
((Log[1+x]/(1-x))+(2*x^1/3))/(x+2*Sin[x]) if you're gonna use above website

rating++ for lonesock for posting it :)
"It's better to regret something you've done than to regret something you haven't done."
Parentesis now should match. I've doublechecked them.

All I need is the value...

...but the antiderivative function would be nice too :) (for curiosity reasons).


(x^1/3 is cube root of x)

here is the latest version :) (Ln[(1+x)/(1-x)]+2*x^(1/3))/(x+2*Sin[x])

for me the main problem is the interval [0 1] if the interval is something like: [0.1 0.6] the value is: 0.40

[Edited by - NamelessTwo on March 29, 2005 11:54:56 AM]
Another nameless person in the virtual space...
The problem is not the division at x = 0. For x near zero, your integrand looks like 2*x^{-2/3}, in which case your function is integrable near zero. The problem is at x = 1. For x near 1, your integrand looks like (Log(2)/(1-x)+2)/(1+Sin(1)). The term 1/(1-x) is not integrable near one since the antiderivative is -Log(1-x). The definite integral is infinite.

Generally, if you have a function F(x) defined on (a,b] and you need to compute the definite integral Integral(a,b;F(x)), and if the definite integral exists, you need to partition the domain into (a,a+e) and [a+e,b] for some small number e > 0. A numerical integrator is used to compute Integral(a+e,b;F(x)). The function F(x) is approximated by a function G(x) that has had the singularity at x = a removed, and you numerically compute Integral(a,a+e;G(x)).

For example, if F(x) = 2*x^{1/3}/(x+2*sin(x)) for 0 < x <= 1, then for x nearly zero, sin(x) is approximated by x. The function G(x) = 2*x^{1/3}/(x+2*x) = 2*x^{-2/3}/3. The choice of e for the partition into (0,e) and [e,1] will affect the error. The smaller the value of e, the better G(x) approximates F(x). However, the smaller the value of e, the larger the probability that the numerical integrator will have problems on [e,1]. You have to strike a good balance...

How does that relate to game programming?
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Quote:Original post by Fruny
How does that relate to game programming?


Improper integrals can show up in physical simulations. For example, the equations of motion for a simple pendulum without friction may be manipulated to an expression that specifies the period of motion in terms of an improper integral. The period of the motion is then estimated by numerically computing the improper integral using the general method I proposed. The OP did not say that the origin of his question was a physics problem, but who knows.
Dave, thank you for your explanation :) Now I need to understand it.


BTW the integrator (from the link) produces this: (2*x^(1/2)+log[1+x]/(1-x))/x+2*sin[x])





Fruny,

Quote: How does that relate to game programming?


That's numerical math, which I haven't studied carefully at the university. It's about real stuff :) (like games)
Another nameless person in the virtual space...
Thread closing immediately. This has every indication of being schoolwork. I know the original poster said later that it isn't, but still didn't offer a satisfactory explanation for the reason for the post.

Folks, I'd appreciate it if you would all go and read the Forum FAQ, for review or for the first time. If a post resembles schoolwork (such as a math statement involving integration or evaluation of an arbitrary equation), then the policy here requires some justification and description, along with some evidence that the poster has tried to solve the problem for him/herself.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement