高德地图是直线距离吗_是直线直线

高德地图是直线距离吗

This simple question “is a straight line linear?” came to my mind and couldn’t get out of it. It seems to be obvious, so it should have an obvious answer. However, when I dig into the research and try to find proof for this simple answer, I realized it’s more complex than I thought and more interesting!

这个简单的问题“直线是线性的吗?” 浮现在我的脑海,无法摆脱。 它似乎很明显,因此应该有一个明显的答案。 但是,当我深入研究并尝试找到这个简单答案的证据时,我意识到它比我想的还要复杂,也更有趣!

Linearity and non-linearity are terms commonly used in Data Science and Math. We try to figure out if a problem can be solved using linear or non-linear models, or if our data is linearly separable. If we widely use these terms, it’s important to understand them well, isn’t it? So what does it mean that something is linear by the book?

线性非线性是数据科学和数学中常用的术语。 我们尝试找出是否可以使用线性或非线性模型解决问题,或者我们的数据是线性可分离的 。 如果我们广泛使用这些术语,那么一定要很好地理解它们,不是吗? 那么这本书意味着什么是线性的呢?

很简单……画出来! (It’s simple… draw it!)

Let’s think and try to visualize linearity. What comes to your mind? For me, it’s a simple straight line. Such a line is described by the following formula:

让我们思考并尝试可视化线性度 。 您想到什么? 对我来说,这是一条简单的直线。 此行由以下公式描述:

Linear function formula f(x) = ax + b.
Linear (?) function formula (image by Author).
线性(?)函数公式(作者提供的图像)。

And indeed it is called a linear function [1]. In this formula, we have a variable x, and two parameters a and b. Let’s assume that a = 1, b = -2, and plot it:

实际上,它被称为线性函数 [1]。 在这个公式中,我们有一个变量x ,以及两个参数ab 。 假设a = 1b = -2 ,并绘制它:

Plot of linear function f(x) = x-2. It’s a straight line going through points (-2, 0) and (0, 2).
Linear function f(x) = x -2 (image by Author).
线性函数f(x)= x -2(作者提供的图像)。

In the picture we can see that line goes through point A (0, 2) as f(0) = 2 and point B (-2, 0), because f(-2) = 0. That’s how we usually imagine linearity.

在图片中可以看出,线经过点A(0,2)f(0)= 2和点B(-2,0),因为F(-2)= 0。 那就是我们通常想象线性的方式。

We also tend to think about linearity in terms of proportionality [2]. It means that the input is proportional to the output. Such intuitive thinking is natural for us, however, we need to remember that formally proportionality is a separate, wider term.

我们也倾向于根据比例来考虑线性[2]。 这意味着输入与输出成比例。 这种直觉的思维对我们来说很自然,但是,我们需要记住,正式的比例性是一个单独的,更广泛的术语。

By definition proportionality of two variables or quantities is a relation that occurs when ratio or product of these quantities is a constant. Having variables x and y, they are proportional if:

根据定义,两个变量或数量的比例关系是当这两个数量的比例或乘积为常数时发生的关系。 具有变量xy ,它们在以下情况下成比例

Proportionality coefficient formula. x divided by y, equals k.
Proportionality coefficient (image by Author).
比例系数(作者提供的图像)。

Where k is a constant. In this situation, if x is increasing, y also is increasing. The same applies when we decrease our variables, it’s proportional.

其中k是一个常数。 在这种情况下,如果x增加, y也增加。 当我们减少变量时也是如此,它是成比例的。

Variables are inversely proportional if their product is a constant:

如果变量的乘积为常数,则它们成反比

Inverse proportionality coefficient formula. x dot y equals k.
Inverse proportionality coefficient (image by Author).
反比例系数(作者提供的图像)。

To check if it fits our intuition, we can transform this formula like this:

要检查它是否符合我们的直觉,我们可以像下面这样转换此公式:

Transformed inverse proportionality formula. x equals k dvidied by y.
Transformed inverse proportionality formula (image by Author).
变换后的反比例公式(作者提供的图像)。

Assuming that k is greater than 0, and y is not equal to 0, while increasing y, x is decreasing. So everything is ok, it’s inversely proportional.

假设k大于0 ,并且y不等于0 ,而增加y ,则x减小。 因此,一切正常,它成反比。

书中的线性 (Linearity by the book)

Having in mind our intuitive thoughts on linearity, let’s confront it with the formal definition.

牢记我们对线性的直觉想法,让我们以正式定义面对它。

To call given relation, or a function, linear it should satisfy two properties (also known as superposition) [3]:

要调用给定的关系或函数,线性的应满足两个属性(也称为叠加 )[3]:

  1. Additivity

    可加性
  2. Homogeneity

    同质性

Additivity is described by the following formula:

通过以下公式描述可加性

Additivity formula. f(x+y) = f(x) + f(y).
Additivity formula (image by Author).
可加性公式(作者提供的图像)。

It means that the result of a function for the sum of inputs should be equal to the sum of the function’s results for each input separately.

这意味着输入总和的函数结果应分别等于每个输入的函数结果之和。

So let’s check if the function we drew before satisfies additivity. Just to quickly remind you, our function has parameters a = 1, b = -2, and its formula looks like this:

因此,让我们检查一下在满足可加性之前绘制的函数。 为了快速提醒您,我们的函数具有参数a = 1b = -2,其公式如下所示:

Sample function f(x) equals x minus 2.
Sample function (image by Author).
示例函数(作者提供的图像)。

To check additivity we’ll assume that x = 2, y = 3. Now we need to calculate values of the function for the left and right side of additivity formula and check if they are equal. Let’s start with the left side:

为了检查可加性,我们假设x = 2y = 3 。 现在我们需要为可加性公式的左侧和右侧计算函数的值,并检查它们是否相等。 让我们从左侧开始:

The left side of the additivity formula: f(2+3) = f(5) = 5–2 = 3.
The left side of the additivity formula (image by Author).
可加性公式的左侧(作者提供的图像)。

Now let’s calculate the right side of the formula:

现在让我们计算公式的右边:

The right side of the additivity formula: f(2) + f(3) = 0 + 1 = 1.
The right side of the additivity formula (image by Author).
可加性公式的右侧(作者提供的图像)。

Oops, 3 is not equal 1, it means that our linear function does not satisfy additivity, which is a required property of linearity. So it’s not really linear…

糟糕,3不等于1,这表示我们的线性函数不满足可加性 ,这是线性的必需属性。 所以它不是线性的...

Maybe at least it’s homogeneous [3]? But first, what does it mean that function is homogeneous? Let’s say we multiply input x by a factor d and calculate the output of the function f(dx). Then let’s calculate the value of such expression df(x). According to homogeneity property, both results should be equal. It’s elegantly expressed by the simple formula:

也许至少是同质的 [3]? 但是首先,功能是同质的意味着什么? 假设我们将输入x乘以因子d,然后计算函数f(dx)的输出。 然后让我们计算这样的表达式df(x)的值 。 根据同质性,两个结果应相等。 简单的公式优雅地表达了这一点:

Homogeneity formula: f(dx) = df(x).
Homogeneity formula (image by Author).
同质性公式(作者提供的图像)。

Now, we’ll do the same experiment as for additivity and check if our sample function satisfies homogeneity property. Let’s assume that d = 4, x = 2 and calculate the left side of the formula:

现在,我们将进行与可加性相同的实验,并检查我们的样本函数是否满足均一性。 假设d = 4x = 2并计算公式的左侧:

The left side of the homogeneity formula for sample function: f(4 dot 2) = f(8) = 8 -2 =6.
The left side of the homogeneity formula (image by Author).
同质性公式的左侧(作者提供的图像)。

And then let’s calculate the right side:

然后让我们计算右边:

The right side of the homogeneity formula for sample function: 4f(2)=4(2–2)=0.
The right side of the homogeneity formula (image by Author).
同质性公式的右侧(作者提供的图像)。

Hmm, 6 is definitely not equal 0, again our function doesn’t meet linearity requirements, this time in terms of homogeneity.

嗯,6绝对不等于0,这一次我们的函数不符合线性要求,这次是同质性。

哪个线性函数满足叠加要求? (Which linear function satisfies superposition?)

If our simple linear function doesn’t meet either of linearity requirements, which function does? Actually, it’s even simpler linear function with parameter b = 0:

如果我们的简单线性函数不满足任何一个线性要求,那么哪个函数呢? 实际上,它甚至是参数b = 0的更简单的线性函数:

Linear function with parameter b = 0, f(x)=ax.
Linear function with parameter b = 0 (image by Author).
参数b = 0的线性函数(作者提供的图像)。

What is characteristic, functions described with such formulas go through the origin of the coordinates system (in the 2D system it’s (0,0)) [4].

用这种公式描述的函数的特征是经过坐标系的原点(在2D系统中为(0,0) )[4]。

Linear function going through the origin. It’s a straight blue line going through point (0, 0).
Linear function going through the origin (image by Author).
穿过原点的线性函数(作者提供的图像)。

Let’s check if it really satisfies the requirements of linearity. We’ll assume that a=2, so our function is described by f(x) = 2x.

让我们检查一下它是否真的满足线性要求。 我们假设a = 2 ,因此我们的函数由f(x)= 2x来描述。

We go for additivity first. Calculating the left side of additivity formula for x = 2, y = 3, we get:

我们首先寻求可加性。 计算x = 2,y = 3的可加性公式的左侧,我们得到:

The left side of the additivity formula for sample function: f(2+3) = f(5) = 2 dot 5 equals 10.
The left side of the additivity formula (image by Author).
可加性公式的左侧(作者提供的图像)。

And for the right side of the formula we have:

对于公式的右侧,我们有:

The right side of the additivity formula for sample function: f(2) + f(3) = 2 dot 2 + 2 dot 3 = 10.
The right side of the additivity formula (image by Author).
可加性公式的右侧(作者提供的图像)。

So far so good! 10 is equal to 10, so our function is additive, great. Let’s check homogeneity then.

到目前为止,一切都很好! 10等于10,所以我们的功能是可加的,很棒。 然后让我们检查同质性。

Assuming that d = 2, x = 4, we can calculate the left side of the homogeneity formula:

假设d = 2x = 4 ,我们可以计算出均匀性公式的左侧:

The left side of the homogeneity formula: f(2 dot 4) = f(8) = 2 dot 8 = 16.
The left side of the homogeneity formula (image by Author).
同质性公式的左侧(作者提供的图像)。

Ok, it’s 16, let’s check the right side of the formula:

好的,现在是16,让我们检查一下公式的右侧:

The right side of the homogeneity formula: 2f(4) = 2 dot 2 dot 4 = 16.
The right side of the homogeneity formula (image by Author).
同质性公式的右侧(作者提供的图像)。

Yes! Our function is homogeneous. It satisfies both requirements of linearity, so we can tell it’s “truly” linear.

是! 我们的功能是同质的。 它满足线性的两个要求,因此我们可以说它是“真正的”线性。

那么这条直线是线性的吗? (So is this straight line linear, or not?)

The answer is: it depends. As you can see not all of the linear functions comply with strict requirements of linearity. Of course, it doesn’t mean that all of us make a huge mistake by using the term linear function. We just need to be careful in which context we use it.

答案是:这取决于。 如您所见,并不是所有的线性函数都符合严格的线性要求。 当然,这并不意味着我们所有人都通过使用线性函数一词犯了巨大的错误。 我们只需要谨慎使用我们的上下文即可。

Math is a really complex domain, containing a lot of different branches. The term linear function we use on a daily basis is perfectly correct in terms of calculus. In this context, every straight line is a linear function.

数学是一个非常复杂的领域,包含许多不同的分支。 就微积分而言,我们每天使用的线性函数一词是完全正确的。 在这种情况下,每条直线都是线性函数。

However, in terms of linear algebra only a subset of linear functions is truly linear (these with b = 0). It’s a wider context where we think in terms of linear mappings and linear systems (models that use linear operators). In this context, with strict requirements, a straight line may not be linear.

但是,就线性代数而言,只有线性函数的一个子集才是真正的线性(这些b = 0 )。 在更广泛的上下文中,我们根据线性映射和线性系统(使用线性算子的模型)进行思考。 在这种情况下,在严格的要求下,直线可能不是线性的。

Answering the original question we learned not only about linearity but also about the value of asking really obvious questions. They help us to obtain clarity and understanding of concepts we think we fully understand.

回答最初的问题,我们不仅学到了线性问题,而且学到了提出真正显而易见的问题的价值。 它们帮助我们获得对我们认为完全理解的概念的清晰度和理解。

参考书目: (Bibliography:)

  1. https://en.wikipedia.org/wiki/Linear_function

    https://zh.wikipedia.org/wiki/线性功能

  2. https://en.wikipedia.org/wiki/Proportionality_(mathematics)

    https://zh.wikipedia.org/wiki/比例_(数学)

  3. https://en.wikipedia.org/wiki/Superposition_principle

    https://zh.wikipedia.org/wiki/Superposition_principle

  4. https://mathinsight.org/linear_function_one_variable

    https://mathinsight.org/linear_function_one_variable

翻译自: https://towardsdatascience.com/is-a-straight-line-linear-f9f491514e97

高德地图是直线距离吗

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值