Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I asked this same question in Mathematics, and it was suggested I might try here. I'm more comfortable with Maple, but if I can get Mathematica to do what I'm after, so much the better.

Basically I'm trying to symbolically integrate something like this:

$\displaystyle\int \frac{a\mu-b}{||a\mu-b||^3} \mathrm{d}\mu$

where $a,b$ are vectors and $\mu$ is a scalar. The denominator is the cube of the 2-norm of the vector, and can be found by taking the dot product of a vector with itself, and raising it to the power of $\frac{3}{2}$.

Right now in Maple I'm explicitly multiplying out the denominator and making substitutions so that the denominator, at least, is only in terms of scalars ($a \cdot a = C$, etc. ), but I hate doing it this way, because it adds a lot of bookkeeping. Basically I'd like the computer to understand that $a * (b \cdot a)$ is not the same thing as $b * a^2$, but that $a \cdot b * c \cdot d = c \cdot d * a \cdot b$.

What's the most kosher way to do this integration in Mathematica?


This is the full integral I'm trying to do. I'm not sure it even has an answer, but the first integral is similar to what I have above. So I was hoping I could take any techniques that work on the simpler one above and apply them to the full problem below.

Let: $\vec{f} = (a - c) \mu_1 + (b - c) \upsilon_1 - (x - z) \mu_2 - (y-z) \upsilon_2 - (z - c) $

where $a, b, c, x, y, z$ are vectors representing positions, and $\mu_1, \nu_1, \mu_2, \nu_2$ are scalars.

I want to find:

$\vec{F_G} = \displaystyle\int_0^1 \int_0^{1-v_2} \int_0^{1} \int_0^{1-v_1} \! \frac{f}{||{f}||^3} \, \mathrm{d} \mu_1 \mathrm{d} \upsilon_1 \mathrm{d} \mu_2 \mathrm{d} \upsilon_2 $

share|improve this question
Did you check the packages mentioned here ? – belisarius has settled Apr 9 '12 at 14:28
Using a tensor plugin is an interesting idea. I'll explore it a bit and see if I can get what I'm after. – Jay Lemmon Apr 10 '12 at 16:38
Atlas 2 seems capable of what I'm after ( It's a plugin for either Maple or Maya. Not sure I want to spend the cash on it, though. There seems to be a few other free plugins for Mathematica that might work, too. I'll give them a try. – Jay Lemmon Apr 12 '12 at 22:37
Don't forget to post an answer if you solve it. Good luck! – belisarius has settled Apr 13 '12 at 1:29
Atlas 2 is add-on for Maple and Mathematica, not for Maple or Maya. ;) Maya is 3D animation editor ( – helen May 7 '12 at 6:04

2 Answers 2

If I understood ...

av = Table[Subscript[a, i], {i, 3}];
bv = Table[Subscript[b, i], {i, 3}];
i = Integrate[(av mu - bv)/Dot[av mu - bv, av mu - bv]^(3/2), mu]
k = i /. {x_ __, x_ __, x_ __} -> x;

And then your integral is k * j


$k =\frac{1}{\left(a_1^2 \left(b_2^2+b_3^2\right)-2 a_3 a_1 b_1 b_3+a_3^2 \left(b_1^2+b_2^2\right)-2 a_2 b_2 \left(a_1 b_1+a_3 b_3\right)+a_2^2 \left(b_1^2+b_3^2\right)\right) \sqrt{-2 a_1 b_1 \mu -2 a_2 b_2 \mu -2 a_3 b_3 \mu +a_1^2 \mu ^2+a_2^2 \mu ^2+a_3^2 \mu ^2+b_1^2+b_2^2+b_3^2}}$


$ j = \frac{i}{k}$

share|improve this answer
Thanks, but I'm specifically trying to prevent it from breaking the vectors in to their components. It makes the resultant equation messy to put back together. (For instance, you have $b_1^2+b_2^2+b_3^2$, when I'd want it to just be $||b||^2$ or even $b \cdot b$) – Jay Lemmon Apr 9 '12 at 6:46
@belisarius Is the i /. {x_ __, x_ __, x_ __} -> x used to extract a common factor of the vector? – tkott Apr 9 '12 at 14:09
@tkott yep. Surely there is a safer way, but in this case it works OK – belisarius has settled Apr 9 '12 at 14:19

It helps to do a little analysis to simplify the problem. This expression is integrating over a line through $\mathbf{b}$ in the direction of $\mathbf{a}$. By choosing a suitable coordinate system you can arrange for $\mathbf{a} = (x,0,0)$ where, to assure a unit Jacobian, $x = \|\mathbf{a}\|$ (and you can even make $\mathbf{b} = (0,b,0)$ if you like, but let's just stop here and generically take $\mathbf{b} = (a,b,c)$). Brute force now succeeds:

ClearAll[x, a, b, c];
Integrate[{x, 0, 0} \[Mu] / Norm[{x, 0, 0} \[Mu] - {a, b, c}]^3, 
  {\[Mu], -Infinity, Infinity}, 
  Assumptions -> Im[a] == 0 && Im[b] == 0 && Im[c] == 0 && Im[x] == 0 && a b c != 0]

The output, after 5 seconds, is

{ConditionalExpression[(2 a Abs[x])/((b^2 + c^2) x^2), x != 0], 0, 0}

Change back to the original coordinates to obtain the general answer.

The key is to specify the assumptions implicit in the question: namely, that these are real vectors and that the line does not pass through the origin (where the integral diverges).

share|improve this answer
The same result can be achieved by assuming that {a, b, c, x} \[Element] Reals instead of specifying that their imaginary parts are zero. – rcollyer Apr 9 '12 at 2:01
It's an interesting approach, but the actual problems I'm interested in (specifically integrating across two triangles' barycentric coordinates (so forming a quadruple integral)) could be difficult to set up with all the coordinate transformations. Unless there's a reasonable way to automate those, also? – Jay Lemmon Apr 9 '12 at 2:56
Jay, there probably is a simple way to set up the transformations. Consider posing the problem you want answered, rather than a simplified version. @rcollyer: Thank you for the tip! – whuber Apr 9 '12 at 14:27
@whuber I've updated the problem. Don't know if you have any further insights/ideas? – Jay Lemmon Apr 10 '12 at 16:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.