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.

Recall "gravitational"-type force functions, by which I mean anything of the form:

$f(x,y,z) = \frac{k}{((x-x_0)^2+(y-y_0)^2+(z-z_0)^2)^p}, p\in\Re_{>0}, k\in\Re, (x,y,z) \neq(x_0,y_0,z_0)$
(e.g., for gravity, $p=1,k=G m_1 m_2$)

Define a function $g(x,y,z) = f_1(x,y,z) + f_2(x,y,z) + f_3(x,y,z) +\cdots+f_n(x,y,z)$ (a sum of several force functions, presumably each with different $k$ (though probably not $p$).

I have two points $(x_1,y_1,z_1)$ and $(x_2,y_2,z_2)$ such that $g(x_1,y_1,z_1)<a$ and $g(x_2,y_2,z_2)>a$. My problem is to find the location $(x_3,y_3,z_3)$ such that $g(x_3,y_3,z_3)=a$ where $(x_3,y_3,z_3)$ lies on the straight line between $(x_1,y_1,z_1)$ and $(x_2,y_2,z_2)$. If it helps, I know that exactly two of the xs, ys, and zs are equal.

I'm currently solving this numerically, but it will eventually be solved on an OpenCL kernel where I would very much like a closed form solution.

However, I am having trouble getting such a solution. I'm not even sure it's possible. I tried inverting $g$, but got basically nowhere. Ideas? Thanks.

share|improve this question
The usual gravitational potential is actually $p = \frac12$ in your formulation, because your denominator represents the square of the distance between the two points. –  Rahul Jun 16 '12 at 5:13
In any case, I doubt there will be a closed-form solution for general $p$. Nonlinear equations usually can't be solved analytically. –  Rahul Jun 16 '12 at 5:18
Nope should be 1 :-) It's over r^2, but in calulating r I'm using the Pythagorean theorem, which has a square root, so the 1/2 and 2 powers cancel. Anyway, I figured it would be unsolvable, but I wanted to check just in case. It should be easy to solve if you have only one term, but of course I have several . . . –  Ian Mallett Jun 16 '12 at 5:35
The magnitude of the gravitational force is proportional to $1/r^2$. The corresponding potential, which the force is a derivative of, is proportional to $1/r$. –  Rahul Jun 16 '12 at 5:46
Ackkk that's what I meant (you probably mean the derivative the other way). I've edited the question. Thanks! –  Ian Mallett Jun 16 '12 at 6:14
show 3 more comments

1 Answer

up vote 1 down vote accepted

Let us consider an extremely simplified version of the problem: $p=1$ and just two terms centered at $(0,\bar y_1,0)$ and $(\bar x_2,\bar y_2,0)$, with the line on which the unknown point lies being $y_1 = y_2 = 0$ and $z_1 = z_2 = 0$. Then you want to solve the equation $$\frac{k_1}{x^2+\bar y_1^2} + \frac{k_2}{(x-\bar x_2)^2+\bar y_2^2} = a,$$ which expands to the fourth-degree polynomial equation in $x$, $$k_1\big((x-\bar x_2)^2+\bar y_2^2\big) + k_2\big(x^2+\bar y_1^2\big) = a\big(x^2+\bar y_1^2\big)\big((x-\bar x_2)^2+\bar y_2^2\big).$$ Mathematica finds an analytical solution that I cannot reproduce here because its $\LaTeX$ code has 11887 characters in it. If you have more than two terms, of course, you'll get a polynomial equation of degree greater than five, and those are known to have no analytical solutions in general.

share|improve this answer
Okay. I'll take this to mean that there probably isn't an analytical solution for the general case. I'll just keep using an L1 or L2 approximation. Thanks for the help (and putting up with my mistakes)! –  Ian Mallett Jun 16 '12 at 7:58
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.