问题描述
我需要找到多个点到曲线的距离: f(x)= a ^(k ^(bx))
我的第一个选择是使用它的导数,使用一个具有导数倒数的形式的行,给它的坐标 Point 并与原始曲线相交。最后,我们计算具有简单几何图形的点之间的距离。
这是我通常遵循的数学过程。我需要节省时间(因为我正在做一个遗传算法程序),所以我需要一个有效的方法来做到这一点。想法?
点(c,d)和曲线之间的距离是函数的最小值
$ $ p $ code sqrt((cx)^ 2 +(da ^(k ^(bx)))^ 2)
$ c为了找到它的最小值,我们可以忘记 sqrt 并查看第一个衍生物。找出它的0(它必须是最小距离,因为没有最大距离)。这会给出曲线上最近点的x坐标。为了得到距离,你需要计算y坐标,然后计算到该点的距离(你可以计算距离函数在 x ,这是同样的事情) 。
重复你的每一点。
距离函数的一阶导数不幸的是,一种婊子。使用,结果是希望(if我没有做任何复制错误):
pre $ dist(x)/ dx = 2(b * lna * lnk * k ^(bx)* a ^(k ^(bx))*(a ^(k ^(bx)) - d) - c + x)
I need to find the distance of multiple points to a curve of the form: f(x) = a^(k^(bx))
My first option was using its derivative, using a line of the form with the inverse of the derivative, giving it coordinates of the Point and intersecting it with the original curve. Finally, we calculate the distance between points with simple geometry.
That's the mathematical process that I usually follow. I need to save time (since I'm doing a genetic algorithms program) so I need an efficient way to do this. Ideas?
The distance between a point (c,d) and your curve is the minimum of the function
sqrt((c-x)^2 + (d-a^(k^(bx)))^2)
To find its minimum, we can forget about the sqrt and look at the first derivative. Find out where it's 0 (it has to be the minimal distance, as there's no maximum distance). That gives you the x coordinate of the nearest point on the curve. To get the distance you need to calculate the y coordinate, and then calculate the distance to the point (you can just calculate the distance function at that x, it's the same thing).
Repeat for each of your points.
The first derivative of the distance function, is, unfortunately, a kind of bitch. Using Wolfram's derivator, the result is hopefully (if I haven't made any copying errors):
dist(x)/dx = 2(b * lna * lnk * k^(bx) * a^(k^(bx)) * (a^(k^(bx)) - d) - c + x)
这篇关于从某点到该曲线的最短距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!