Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm trying to use Maple to do something like this integral:

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

Where $a, b$ are vectors and $\mu$ is a scalar I'm integrating by. But I can't figure out to tell Maple to treat them like vectors, and specifically have it figure out how to distribute the dot products in the denominator (calculate the squared length of a vector by dotting it with itself).

Right now I'm solving this specific integral like this:

int((a*u-b)/sqrt(C*u^2-2*u*D+E)^3, u)

I've basically been multiplying out the denominator in to dot products, and treating the dot products as separate variables (eg: $a \cdot a = C, a \cdot b = D, b \cdot b = E$). But this adds a lot of bookkeeping and I'm tired of doing it like this. The equations I'm trying to integrate are becoming increasingly complex and I'd like the computer to handle more of the work.

What's the proper way to solve this integral in Maple?

Alternatively, is there a way to get Mathematica to do this integration?

share|improve this question
add comment

2 Answers 2

If you want a numeric result, I think the following in Mathematica will get you close to where you want to be. a and b can be of arbitrary dimensions:

NIntegrate[(a u - b)/Norm[a u - b]^3, {u, lowerLimit, upperLimit}]

If you do not want the 2 Norm, then Norm[a,n] will give you the nth Norm.

In three dimensions, symbolically, Mathematica given

a = {a1, a2, a3}
b = {b1, b2, b3}

Integrate[(a u - b)/Sqrt[(a u - b)^2]^3, u]


{-(1/(a1 Sqrt[(b1-a1 u)^2])), -(1/(a2 Sqrt[(b2-a2 u)^2])), -(1/(a3 Sqrt[(b3-a3 u)^2]))}

share|improve this answer
There is a Mathematica StackExchange on which wiser people than I might give you alternate solutions to your question. –  image_doctor Apr 8 '12 at 11:02
I'm actually looking for a symbolic result. :/ I'll look at the Mathematic exchange. –  Jay Lemmon Apr 9 '12 at 0:06
add comment

This seems more like a programming than a math issue, so it might be better placed on stackoverflow (or a forum like www.mapleprimes.com)

I suppose that you intend to map the integration action over each element of Vector a*mu-b, is that right?

I don't quite understand what is the difficulty about computing the denominator. Sure, you could use that expression involving several dot-products. Or you could just take the 2-norm.

It helps if you know something about mu and the entries of Vectors a and b, even if it's only that all are real-valued. Below, I use the assumption that all are positive (and thus implicitly real), with a pairwise relationship to mu.

N:=2: # or 3, 4...


with(LinearAlgebra): # to pick up LinearAlgebra:-Norm
myassumptions:=seq(mu*A[i]>B[i],i=1..N), positive: # up to you

sol1 := map(int,(a*mu-b)/(Norm(a*mu-b,2)^3),mu)
   assuming myassumptions;

sol2 := int~((a*mu-b)/(sqrt((a*mu-b).(a*mu-b))^3),mu) 
   assuming myassumptions;

sol3 := map(int,(a*mu-b)/(sqrt(a.a*mu^2-2*a.b*mu+b.b)^3),mu)
   assuming myassumptions;

sol4 := int~((a*mu-b)/(Norm(a*mu-b,2)^3),mu) 
   assuming myassumptions;


The last variation above is using the relatively new syntax wherein the ~ symbol makes the int command act elementwise over the Vector a*mu-b.

What do you plan on doing with the results of this? Is going to be symbolic, or (floating-point) numeric?

share|improve this answer
Thanks, you actually showed me a number of things I didn't know you could do. Using Norm isn't great, because it seems to create a lot of csgn functions that aren't necessary at all (the Norm function does $|x_i|^2$). The sqrt form gets me closer to what I'm after. But even using sqrt, it breaks out the dot products in to components instead of keeping them as $a \cdot b$, which would be preferable. And the solution it gives me has the X and Y terms explicitly stated, instead of keeping things in terms of the $a, b$ vectors. –  Jay Lemmon Apr 9 '12 at 0:05
add comment

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.