# Any idea how can I solve this integral?

## Recommended Posts

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]

##### Share on other sites

Do you need the antiderivative of the function or only the value of the integral?

##### Share on other sites
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.

##### Share on other sites
((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 :)

##### Share on other sites
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)

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]

##### Share on other sites
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...

##### Share on other sites
Quote:
 Original post by FrunyHow 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.

##### Share on other sites
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)

##### Share on other sites
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.

##### Share on other sites
Quote:
 This has every indication of being schoolwork.

:) I've finished school in 1995 :) I'm trying to learn about the numerical approximation for integration (Simpson & Trapezoid rules) and this is a problem I do not know if it has a solution or I just simply don't get the idea right.
And I need that for my work.

Is my explanation good enough?

BTW I've changed to the function slightly to (Ln[(1+x)/(1-x)]+2*x^(1/3))/(x+2*Sin[x])

(log is now ln)

##### Share on other sites
Nameless*,

I'll let the thread stay open now. But your clarification does not fully address the forum policy requirement for this type of question. You have not yet documented your own effort to solve the problem. And, you're being just a bit vague about your "work". If your work is game development, I'd like to see enough details that bring the thread on topic. If your work is not game development, tell us a little bit more and show your work.

##### Share on other sites
OK. If you think that my thread violates the rules. I won't mind if you close it.

Sorry! Pls delete this thread. I don't think I can do it myself.
I belive the problem is unsolvable with these parameters, so this thread doesn't makes sense now.

##### Share on other sites
Nameless*, per your last request I'm closing (but won't delete) the thread.

My main goal in my prior comments was to let you know what the forum policy is, and to also let you know that I do enforce policy. Not 100% consistent, since a lot of this is subjective and its just impossible. But, I do try to enforce it. That is all!

##### Share on other sites
This topic is now closed to further replies.

• ### Forum Statistics

• Total Topics
628377
• Total Posts
2982326

• 10
• 9
• 14
• 24
• 11