Sciencemadness Discussion Board
Not logged in [Login ]
Go To Bottom

Printable Version  
Author: Subject: Apparently easy maths question
Eddygp
National Hazard
****




Posts: 858
Registered: 31-3-2012
Location: University of York, UK
Member Is Offline

Mood: Organometallic

[*] posted on 11-10-2014 at 05:51
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
View user's profile View All Posts By User
Marvin
National Hazard
****




Posts: 995
Registered: 13-10-2002
Member Is Offline

Mood: No Mood

[*] posted on 11-10-2014 at 06:23


Does the line of minimum distance always cross the curves at a normal?
View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 11-10-2014 at 06:24


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]




View user's profile View All Posts By User
Metacelsus
International Hazard
*****




Posts: 2539
Registered: 26-12-2012
Location: Boston, MA
Member Is Offline

Mood: Double, double, toil and trouble

[*] posted on 11-10-2014 at 11:22


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.




As below, so above.

My blog: https://denovo.substack.com
View user's profile View All Posts By User
woelen
Super Administrator
*********




Posts: 8014
Registered: 20-8-2005
Location: Netherlands
Member Is Offline

Mood: interested

[*] posted on 11-10-2014 at 11:33


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.




The art of wondering makes life worth living...
Want to wonder? Look at https://woelen.homescience.net
View user's profile Visit user's homepage View All Posts By User
franklyn
International Hazard
*****




Posts: 3026
Registered: 30-5-2006
Location: Da Big Apple
Member Is Offline

Mood: No Mood

[*] posted on 11-10-2014 at 23:38
That's a real problem


Quote: Originally posted by Marvin  
Does the line of minimum distance always cross the curves at a normal ?

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


http://math.stackexchange.com/questions/292919/calculus-ques...



[Edited on 12-10-2014 by franklyn]
View user's profile View All Posts By User
Eddygp
National Hazard
****




Posts: 858
Registered: 31-3-2012
Location: University of York, UK
Member Is Offline

Mood: Organometallic

[*] posted on 14-10-2014 at 10:59


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
View user's profile View All Posts By User
woelen
Super Administrator
*********




Posts: 8014
Registered: 20-8-2005
Location: Netherlands
Member Is Offline

Mood: interested

[*] posted on 15-10-2014 at 00:55


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 :D



The art of wondering makes life worth living...
Want to wonder? Look at https://woelen.homescience.net
View user's profile Visit user's homepage View All Posts By User
Eddygp
National Hazard
****




Posts: 858
Registered: 31-3-2012
Location: University of York, UK
Member Is Offline

Mood: Organometallic

[*] posted on 15-10-2014 at 11:35


Quote: Originally posted by woelen  
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 :D

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
View user's profile View All Posts By User
Eddygp
National Hazard
****




Posts: 858
Registered: 31-3-2012
Location: University of York, UK
Member Is Offline

Mood: Organometallic

[*] posted on 1-11-2014 at 01:27


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
View user's profile View All Posts By User

  Go To Top