Message Boards Message Boards

0
|
3329 Views
|
2 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Calculate the following integral?

Posted 6 years ago

I found a difficult to calculate this integral with Wolfram Mathematica, any help?

enter image description here

POSTED BY: Hamza Hboub
2 Replies
Integrate[1/Sqrt[R^2 + (x1 - x2)^2], {x2, 0, l}, {x1, 0, l}, Assumptions -> {R > 0, l > 0, x1 >= 0, x2 >= 0}] // 
FullSimplify // AbsoluteTiming
(* {45.2976, 2 R - 2 Sqrt[l^2 + R^2] + l Log[R] - l Log[-l + Sqrt[l^2 + R^2]] + 1/2 l Log[1 + (2 l (l + Sqrt[l^2 + R^2]))/R^2]}*)

$$-2 \sqrt{l^2+R^2}-l \log \left(\sqrt{l^2+R^2}-l\right)+\frac{1}{2} l \log \left(\frac{2 l \left(\sqrt{l^2+R^2}+l\right)}{R^2}+1\right)+l \log (R)+2 R$$

Extended version for solving integral:

 sol = Integrate[1/Sqrt[R^2 + (x1 - x2)^2], {x2, 0, l}, Assumptions -> {R > 0, l > 0, x1 > 0}]
 (* 1/2 Log[-(((x1 + Sqrt[R^2 + x1^2]) (-l + x1 - Sqrt[
       l^2 + R^2 - 2 l x1 + x1^2]))/((-x1 + Sqrt[R^2 + x1^2]) (-l + 
       x1 + Sqrt[l^2 + R^2 - 2 l x1 + x1^2])))] *)

sol2 = FullSimplify[sol, Assumptions -> {R > 0, l > 0, x1 >= 0}]
(* 1/2 (Log[l + Sqrt[R^2 + (l - x1)^2] - x1] - 
   Log[(-l + Sqrt[R^2 + (l - x1)^2] + x1) (-x1 + Sqrt[R^2 + x1^2])] + 
   Log[x1 + Sqrt[R^2 + x1^2]])*)

 Integrate[sol2, {x1, 0, l}, Assumptions -> {R > 0, l > 0}]
 (*  2 (R - Sqrt[l^2 + R^2] + l ArcTanh[l/Sqrt[l^2 + R^2]])*)

and we have:

enter image description here

Both solutions are correct.

Regards,MI

POSTED BY: Mariusz Iwaniuk
Anonymous User
Anonymous User
Posted 6 years ago

ON MATHEMATICA 11.3 RUNNING ON INTEL 3 PROCESSOR, THE EVALUATION IS STUCK FOR SEVERAL MINUES GIVING NO ANSWER (this is after parenthesis are added as the warning requests)

looks like a trigonometric integral if you rewrite it, to me (followed by a simple double integral part), which is simple for Mathematica to do

but i think:

  • you said difficult but did not say in what way

  • you don't show Integral[...], which you'll need to use if you have many variables (you gotta tell Mathematica which variables are dependent and independent, you'll need Integral[] syntax to tell it). I'm not sure if each W(ij) is independent of x or just a renaming: i'm pretty sure mathematica would consider W(ij) as a single variable name like "y". also: I don't think mathematica understands W(ij) as a function (you can't simply use subscripts and hope that mathematica understands the assignment: you need to express it as a function using the right syntax). is W(ij) an array of values like W(i,j), a product, a sum? you can use subscripts in a kind of freeform for products and sums, yes: but that involves an operator and guided 2D input.

i have too many question to comment further

it's hard for me to say because Mathematica's integral ability continually widens: i'm sure I don't know all of its' current capabilities as much as some others who visit this forum

(i cannot paste the expression using "code paste" possibly because it gives an immediate error unless parenthesis are added)

I cannot say if you used "a proper double integral" (or infact intended to do so) or not because Notebooks (.nb, .cdf) are not shared here by this forum and i cannot possibly know if the 2D output that you posted represents Output (that Mathematica converted to 2D from your Input) or your Input (which you supplied as 2D). its' a shame there isn't currently a platform to share "safe .nb" in a forum format.

Check your documentation. The following syntax applies to double integrals.

Integrate[f,{x,xmin,xmax},{y,ymin,ymax},…]

the rest i think you really have to read further on or ask others as how to best specify to Integrate which kind of variables you are using (how best to tell integrate this). many examples are given in the documentation

Again, you didn't say what your difficulty is.

POSTED BY: Anonymous User
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract