Eddygp
National Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 858
Registered: 31-3-2012
Location: University of York, UK
Member Is Offline
Mood: Organometallic
|
|
Apparently easy maths question
Say you have the functions f(x) and g(x)
f(x)=x2; g(x)=ln(x)
This is the seemingly easy question (which might need implicit derivatives):
What is the minimum distance in any direction between the functions f(x) and g(x)?
The problem is that it is fairly easy to calculate the minimum VERTICAL distance, i.e. you calculate (f-g)'(x)=0 and that is fairly simple. But there
is an absolute minimum distance that belongs to some other line, neither horizontal nor vertical, but of the next equation: r(x)=ax+b
with a and b belonging to the real numbers.
Any ideas?
there may be bugs in gfind
[ˌɛdidʒiˈpiː] IPA pronunciation for my Username
|
|
Marvin
National Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 995
Registered: 13-10-2002
Member Is Offline
Mood: No Mood
|
|
Does the line of minimum distance always cross the curves at a normal?
|
|
smaerd
International Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 1262
Registered: 23-1-2010
Member Is Offline
Mood: hmm...
|
|
edit- oh I re-read your original post and now I see what the question is asking. If I get time today I'll give it a shot and see if I can provide
helpful hints(assuming I get the answer).
[Edited on 11-10-2014 by smaerd]
|
|
Metacelsus
International Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 2537
Registered: 26-12-2012
Location: Boston, MA
Member Is Offline
Mood: Double, double, toil and trouble
|
|
Step 1: Find a formula for the distance of an arbitrary point (x,y) to the curve y = x^2. Use the fact that the vector between (x,y) and the closest
point will be normal to the curve.
Step 2: Plug in the formula y = ln(x)
Step 3: Minimize it.
I don't want to devote a lot of time to this, but I can help. I've solved similar problems before.
|
|
woelen
Super Administrator
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 7990
Registered: 20-8-2005
Location: Netherlands
Member Is Offline
Mood: interested
|
|
Solving this problem in principle is not difficult, but in practice you need a lot of (tedious) algebraic manipulations and you certainly need to
numerically estimate the shortest distance.
Proceed as outlined below.
You have two points, one on the curve y=x2 and the other on the curve y=ln(x). You have the freedom to choose two x-coordinates freely.
Let's call them x1 and x2.
Now we have two points (x1, x12) and (x2, ln(x2)). The square of the distance between these two
points equals (x1-x2)2 + (x12-ln(x2))2.
The task which you have left is finding the global minimum of this square distance (you can of course also use the distance, but that makes things
only unnecessarily complex due to the presence of a square root). Finding the minimum of the square distance can be done by computing the partial
derivatives with respect to x1 and with respect to x2 and setting both partial derivates equal to zero. In general, such points
either are (possibly local) minima, or saddle points. In your specific situation there only is one such point and it will be the global minimum. By
means of a rough sketch you can get decent estimates of x1 and x2 near the global minimum. Using Newton-Raphson iteration on the
system of equations of both derivates yields more accurate solutions.
|
|
franklyn
International Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 3026
Registered: 30-5-2006
Location: Da Big Apple
Member Is Offline
Mood: No Mood
|
|
That's a real problem
I think that was meant as a hint.
The shortest distance between two curves is always the normal line common to both.
It is a unique solution.
The slope of the tangent to each curve is the same , at the point on each curve
that joins the normal line common to both. That means the tangents at those
two points are parallel and the line normal is perpendicular to them. It is also the
solution where the two tangents are farthest apart. All other parallel tangents
have a shorter distance apart and two solutions , one of lesser slope and one
of greater slope.
@ Eddygp
My reasoning up to here is right. While the value of the derivative of X² must
equal the value of the derivative of lnx , each is going to need it's own coordinate
solution of x. Forget what I wrote before. It's been a long time since I did this sort
of thing and it shows.
![Line Normal to two curves.gif - 3kB Line Normal to two curves.gif - 3kB](https://www.sciencemadness.org/whisper/files.php?pid=353122&aid=34322)
http://math.stackexchange.com/questions/292919/calculus-ques...
[Edited on 12-10-2014 by franklyn]
|
|
Eddygp
National Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 858
Registered: 31-3-2012
Location: University of York, UK
Member Is Offline
Mood: Organometallic
|
|
OK here is the progress:
We have two points of the sort (x,y):
A(a,a^2)
B(b,ln(b))
Where A belongs to f(x) and B belongs to g(x).
Second relationship:
f'(a)=g'(b)
So this boils down to two variables and two equations and can, therefore, be solved.
However, using the sqrt(x^2+y^2) to obtain the actual distance, to have the minimum you will use the derivative of a monster:
d(a,b)=sqrt((b-a)^2+(ln(b)-a^2)^2)
2a=1/b --> a=1/(2b) [SUBSTITUTION NOW:]
d(b)=sqrt((b-1/(2b))^2+(ln(b)-(1/(2b))^2)^2)
Now, d'(b)=0 --> you get an answer for b and, since a=1/(2b), you have the value of a.
[Edited on 14-10-2014 by Eddygp]
there may be bugs in gfind
[ˌɛdidʒiˈpiː] IPA pronunciation for my Username
|
|
woelen
Super Administrator
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 7990
Registered: 20-8-2005
Location: Netherlands
Member Is Offline
Mood: interested
|
|
Instead of minimizing the distance, you can use the square of the distance. This still gives a monster, but it has fewer heads than your monster
|
|
Eddygp
National Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 858
Registered: 31-3-2012
Location: University of York, UK
Member Is Offline
Mood: Organometallic
|
|
Quote: Originally posted by woelen ![](images/xpblue/lastpost.gif) | Instead of minimizing the distance, you can use the square of the distance. This still gives a monster, but it has fewer heads than your monster |
That is a fairly good idea! I had not thought about it.
Just imagine this monster for more complex functions, such as
f(x)=x^2*e^x
g(x)=-x*e^(1-x)-2
But yes, the problem is solved. Even if the answer is grotesque.
there may be bugs in gfind
[ˌɛdidʒiˈpiː] IPA pronunciation for my Username
|
|
Eddygp
National Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 858
Registered: 31-3-2012
Location: University of York, UK
Member Is Offline
Mood: Organometallic
|
|
By the way, I did it yesterday and the result was around 0.534 units.
there may be bugs in gfind
[ˌɛdidʒiˈpiː] IPA pronunciation for my Username
|
|