插图 引用 同一行两个插图

by Chris Lam

克里斯·林(Chris Lam)

数学身份的优雅LED插图 (An elegant LED illustration of a mathematical identity)

I am a big fan of science toys. I have been looking for one that combines the elegance of math and programming for a while. However, there was not much success in the search. So, I decided to make one myself.

我是科学玩具的忠实粉丝。 我一直在寻找一种结合了数学和编程优雅的软件。 但是,搜索没有太大的成功。 所以,我决定自己做一个。

Here is a demo. The flashing LEDs are used to illustrate a mathematical identity visually.

这是一个演示。 闪烁的LED用于可视地说明数学身份。

数学 (Math)

The mathematical identity is the following. The left side of the equation is an arithmetic sum from 1 to n-1 and the right side of the equation is “n choose 2”, the number of unique ways to choose 2 items from n items.

数学上的恒等式如下。 等式的左侧是从1到n-1的算术和,等式的右侧是“ n select 2 ”,这是从n个项目中选择2个项目的唯一方式的数量。

It is not the identity itself that is elegant, but the visual proof itself. Let’s look at the diagram below. There are n=4 green dots in the illustration.

优雅本身不是身份本身,而是视觉证明本身。 让我们看下面的图。 插图中有n = 4个绿色的点。

For every two green dots on the bottom row, there is always a unique red dot in the triangle above that corresponds to them. That red dot is the tip of an equilateral triangle with the base specified by the green dots.

对于底行的每两个绿点,在上方的三角形中始终存在一个与之对应的唯一红点。 该红点是等边三角形的尖端,其底点由绿点指定。

Therefore, the number of ways to choose 2 green dots out of n green dots is equal to the sum of the red dots, 1 +2 + 3 + … + (n-1).

因此,从n个绿色点中选择2个绿色点的方法数量等于红色点的总和1 +2 + 3 +…+( n -1)。

In this case, it is 1 + 2 + (4 –1) = 6.

在这种情况下,它是1 + 2 +(4 –1)= 6。

This observation was originally made by Loren C. Larson in this article.

此观察最初由Loren C. Larson在本文中进行 。

程式设计 (Programming)

While it is easy to trace the red dot from the green dots visually, it is more fun and challenging to specify the relationship in code.

虽然很容易在视觉上从绿点中追踪红点,但是在代码中指定关系更加有趣和具有挑战性。

Let us assume that we know the indices of the green dots (say, i and j). The programming challenge is to specify the corresponding index of the red dot that forms the equilateral triangle with the green dots.

让我们假设我们知道绿点的索引(例如,i和j)。 编程上的挑战是指定与绿点形成等边三角形的红点的相应索引。

It looks difficult at first glance.

乍看起来似乎很困难。

But the problem can be simplified a lot when we tweak the way that we label the red dots. We can label the red dots from bottom-up instead of top-down.

但是,当我们调整标记红点的方式时,可以大大简化该问题。 我们可以从下至上而不是从上至下标记红点。

With that indexing scheme, we can then specify the index of the red dots by the following formula.

使用该索引方案,然后可以通过以下公式指定红点的索引。

Here is the complete code used to flash the LEDs using Arduino.

这是用于使用Arduino闪烁LED的完整代码。

电子产品 (Electronics)

I solder the LEDs on a board and connect the LEDs to Arduino output pins through 1k resistors. It is very important to use the resistors because they protect the LEDs.

我将LED焊接在板上,然后通过1k电阻将LED连接到Arduino输出引脚。 使用电阻非常重要,因为它们可以保护LED。

The connection is as follows.

连接如下。

And when you put them together and load the software to Arduino, it will start flashing like below.

当您将它们放在一起并将软件加载到Arduino时,它将开始闪烁,如下所示。

Hope you enjoy this gadget!

希望您喜欢这个小工具!

翻译自: https://www.freecodecamp.org/news/an-elegant-led-illustration-of-a-mathematical-identity-de88ee88c963/

插图 引用 同一行两个插图

插图 引用 同一行两个插图_数学身份的优雅LED插图相关推荐

  1. 插图 引用 同一行两个插图_提出食物主题中的插图

    插图 引用 同一行两个插图 I have a page in my portfolio, which is about search functionality. I wanted that page ...

  2. 插图 引用 同一行两个插图_为什么插图是产品的重要组成部分

    插图 引用 同一行两个插图 "Hi, my name is Ludmila and I'm a UX/UI designer" "嗨,我叫Ludmila,我是UX / U ...

  3. 插图 引用 同一行两个插图_插图的目的

    插图 引用 同一行两个插图 If you're a designer in tech you've likely come across them. Any search for UI or prod ...

  4. 插图 引用 同一行两个插图_将图标变成插图的五个简单步骤

    插图 引用 同一行两个插图 Every creative person has probably already been in this situation: A project, be it a ...

  5. 插图 引用 同一行两个插图_案例研究产品设计中的动画插图

    插图 引用 同一行两个插图 At the beginning of this year I was working on a new feature for the Undo app. It is a ...

  6. [转载] 如何用python实现一行两个输入

    参考链接: 如何在Python的一行中从用户输入多个值 前几天突发奇想要用python做SDNU OJ的题,就是最简单的那道1001,然而错了==原因就在于命题要求在同一行中输入,而我的代码用了两个i ...

  7. wps excel 中将一行多列数据转换为一行两列的格式 的方法函数

    在使用wps excel 整理表格时,我的表格一行有多列内容,我想把这些数据转换为一行两列的格式,在百度上查了很多方法,都很不好用,最后在论坛中看到的方法,借鉴了一下,各位可以参考. 非常重要的一点: ...

  8. android 菜单一行两列,Android RadioGroup 横向显示(两行两列)

    做的android平板项目中,需要做一个调查问卷的界面,所以需要使用radiogroup的单选按钮,在listview的一个item上添加四个radiobutton,具体的demo是参考这位博主的,链 ...

  9. 不知不觉,搞这一行两年了

    不知不觉,搞这一行两年了,看博客里好多大牛的经历让人佩服,我却过的总是那么平静

最新文章

  1. linux 进程原理内存,linux进程通信之共享内存原理(基于linux 1.2.13)
  2. 用 HTTPS 就安全了?HTTPS 会被抓包吗?
  3. 博物馆守卫问题(世界名画展览馆)
  4. UnicodeMath数学公式编码_翻译(Unicode Nearly Plain - Text Encoding of Mathematics Version 3)
  5. ue4 怎么传递变量到另一个蓝图_[UE4蓝图]虚幻4中实现简易天气系统(三)—— 受风力影响的Cascade雨水粒子...
  6. editthiscookie
  7. JavaScript 弹出子窗体并返回结果到父窗体
  8. 洛谷P2698 花盆Flowerpot【单调队列】
  9. mysql定义语言_MySQL基础(一)--数据定义语言DDL
  10. Application_Start 不执行
  11. 【Boost】boost库的随机数的例子
  12. 用html5写个炫酷的3d电子相册
  13. 低代码快速实现跟进提醒
  14. 三极管放大电路基础知识
  15. HMM隐马尔可夫模型-通俗易懂
  16. 纯CSS3制作优惠券线性UI效果
  17. 【Python cursor指针】——Python Tkinter Cursor鼠标指针属性值
  18. 百度地图大头针图片的自定义
  19. 【Android系统】虚拟按键 平板设备中重叠的问题
  20. P1328 [NOIP2014 提高组] 生活大爆炸版石头剪刀布

热门文章

  1. 26.课时26.【Django模版】if标签使用详解(Av61533158,P26)
  2. fastdfs配置-跟踪服务器
  3. Java 语言实现的 I/O 模型
  4. 使用Hyper-V创建虚拟机
  5. Python爬虫-- Scrapy框架
  6. 使用 JMockit 来 mock 构造函数
  7. 我的nginx+php是如何配置的?
  8. vSphere 5.0热添加
  9. 用移动智能设备访问Ossim系统
  10. pig:group by之后的其它统计方法一