Merge pull request #28655 from toknow-gh/master

translated
This commit is contained in:
Xingyu.Wang 2023-02-15 23:03:00 +08:00 committed by GitHub
commit 6402d85294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 143 additions and 147 deletions

View File

@ -1,147 +0,0 @@
[#]: subject: "How to Use a Differential Analyzer (to Murder People)"
[#]: via: "https://twobithistory.org/2020/04/06/differential-analyzer.html"
[#]: author: "Two-Bit History https://twobithistory.org"
[#]: collector: "lujun9972"
[#]: translator: "toknow-gh"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Use a Differential Analyzer (to Murder People)
======
A differential analyzer is a mechanical, analog computer that can solve differential equations. Differential analyzers arent used anymore because even a cheap laptop can solve the same equations much faster—and can do it in the background while you stream the new season of Westworld on HBO. Before the invention of digital computers though, differential analyzers allowed mathematicians to make calculations that would not have been practical otherwise.
It is hard to see today how a computer made out of anything other than digital circuitry printed in silicon could work. A mechanical computer sounds like something out of a steampunk novel. But differential analyzers did work and even proved to be an essential tool in many lines of research. Most famously, differential analyzers were used by the US Army to calculate range tables for their artillery pieces. Even the largest gun is not going to be effective unless you have a range table to help you aim it, so differential analyzers arguably played an important role in helping the Allies win the Second World War.
To understand how differential analyzers could do all this, you will need to know what differential equations are. Forgotten what those are? Thats okay, because I had too.
### Differential Equations
Differential equations are something you might first encounter in the final few weeks of a college-level Calculus I course. By that point in the semester, your underpaid adjunct professor will have taught you about limits, derivatives, and integrals; if you take those concepts and add an equals sign, you get a differential equation.
Differential equations describe rates of change in terms of some other variable (or perhaps multiple other variables). Whereas a familiar algebraic expression like \\(y = 4x + 3\\) specifies the relationship between some variable quantity \\(y\\) and some other variable quantity \\(x\\), a differential equation, which might look like \\(\frac{dy}{dx} = x\\), or even \\(\frac{dy}{dx} = 2\\), specifies the relationship between a _rate of change_ and some other variable quantity. Basically, a differential equation is just a description of a rate of change in exact mathematical terms. The first of those last two differential equations is saying, “The variable \\(y\\) changes with respect to \\(x\\) at a rate defined exactly by \\(x\\),” and the second is saying, “No matter what \\(x\\) is, the variable \\(y\\) changes with respect to \\(x\\) at a rate of exactly 2.”
Differential equations are useful because in the real world it is often easier to describe how complex systems change from one instant to the next than it is to come up with an equation describing the system at all possible instants. Differential equations are widely used in physics and engineering for that reason. One famous differential equation is the heat equation, which describes how heat diffuses through an object over time. It would be hard to come up with a function that fully describes the distribution of heat throughout an object given only a time \\(t\\), but reasoning about how heat diffuses from one time to the next is less likely to turn your brain into soup—the hot bits near lots of cold bits will probably get colder, the cold bits near lots of hot bits will probably get hotter, etc. So the heat equation, though it is much more complicated than the examples in the last paragraph, is likewise just a description of rates of change. It describes how the temperature of any one point on the object will change over time given how its temperature differs from the points around it.
Lets consider another example that I think will make all of this more concrete. If I am standing in a vacuum and throw a tennis ball straight up, will it come back down before I asphyxiate? This kind of question, posed less dramatically, is the kind of thing I was asked in high school physics class, and all I needed to solve it back then were some basic Newtonian equations of motion. But lets pretend for a minute that I have forgotten those equations and all I can remember is that objects accelerate toward earth at a constant rate of \\(g\\), or about \\(10 \;m/s^2\\). How can differential equations help me solve this problem?
Well, we can express the one thing I remember about high school physics as a differential equation. The tennis ball, once it leaves my hand, will accelerate toward the earth at a rate of \\(g\\). This is the same as saying that the velocity of the ball will change (in the negative direction) over time at a rate of \\(g\\). We could even go one step further and say that _the rate of change in the height of my ball above the ground_ (this is just its velocity) will change over time at a rate of negative \\(g\\). We can write this down as the following, where \\(h\\) represents height and \\(t\\) represents time:
\\[\frac{d^2h}{dt^2} = -g\\]
This looks slightly different from the differential equations we have seen so far because this is what is known as a second-order differential equation. We are talking about the rate of change of a rate of change, which, as you might remember from your own calculus education, involves second derivatives. Thats why parts of the expression on the left look like they are being squared. But this equation is still just expressing the fact that the ball accelerates downward at a constant acceleration of \\(g\\).
From here, one option I have is to use the tools of calculus to solve the differential equation. With differential equations, this does not mean finding a single value or set of values that satisfy the relationship but instead finding a function or set of functions that do. Another way to think about this is that the differential equation is telling us that there is some function out there whose second derivative is the constant \\(-g\\); we want to find that function because it will give us the height of the ball at any given time. This differential equation happens to be an easy one to solve. By doing so, we can re-derive the basic equations of motion that I had forgotten and easily calculate how long it will take the ball to come back down.
But most of the time differential equations are hard to solve. Sometimes they are even impossible to solve. So another option I have, given that I paid more attention in my computer science classes that my calculus classes in college, is to take my differential equation and use it as the basis for a simulation. If I know the starting velocity and the acceleration of my tennis ball, then I can easily write a little for-loop, perhaps in Python, that iterates through my problem second by second and tells me what the velocity will be at any given second \\(t\\) after the initial time. Once Ive done that, I could tweak my for-loop so that it also uses the calculated velocity to update the height of the ball on each iteration. Now I can run my Python simulation and figure out when the ball will come back down. My simulation wont be perfectly accurate, but I can decrease the size of the time step if I need more accuracy. All I am trying to accomplish anyway is to figure out if the ball will come back down while I am still alive.
This is the numerical approach to solving a differential equation. It is how differential equations are solved in practice in most fields where they arise. Computers are indispensable here, because the accuracy of the simulation depends on us being able to take millions of small little steps through our problem. Doing this by hand would obviously be error-prone and take a long time.
So what if I were not just standing in a vacuum with a tennis ball but were standing in a vacuum with a tennis ball in, say, 1936? I still want to automate my computation, but Claude Shannon wont even complete his masters thesis for another year yet (the one in which he casually implements Boolean algebra using electronic circuits). Without digital computers, Im afraid, we have to go analog.
### The Differential Analyzer
The first differential analyzer was built between 1928 and 1931 at MIT by Vannevar Bush and Harold Hazen. Both men were engineers. The machine was created to tackle practical problems in applied mathematics and physics. It was supposed to address what Bush described, in [a 1931 paper][1] about the machine, as the contemporary problem of mathematicians who are “continually being hampered by the complexity rather than the profundity of the equations they employ.”
A differential analyzer is a complicated arrangement of rods, gears, and spinning discs that can solve differential equations of up to the sixth order. It is like a digital computer in this way, which is also a complicated arrangement of simple parts that somehow adds up to a machine that can do amazing things. But whereas the circuitry of a digital computer implements Boolean logic that is then used to simulate arbitrary problems, the rods, gears, and spinning discs _directly_ simulate the differential equation problem. This is what makes a differential analyzer an analog computer—it is a direct mechanical analogy for the real problem.
How on earth do gears and spinning discs do calculus? This is actually the easiest part of the machine to explain. The most important components in a differential analyzer are the six mechanical integrators, one for each order in a sixth-order differential equation. A mechanical integrator is a relatively simple device that can integrate a single input function; mechanical integrators go back to the 19th century. We will want to understand how they work, but, as an aside here, Bushs big accomplishment was not inventing the mechanical integrator but rather figuring out a practical way to chain integrators together to solve higher-order differential equations.
A mechanical integrator consists of one large spinning disc and one much smaller spinning wheel. The disc is laid flat parallel to the ground like the turntable of a record player. It is driven by a motor and rotates at a constant speed. The small wheel is suspended above the disc so that it rests on the surface of the disc ever so slightly—with enough pressure that the disc drives the wheel but not enough that the wheel cannot freely slide sideways over the surface of the disc. So as the disc turns, the wheel turns too.
The speed at which the wheel turns will depend on how far from the center of the disc the wheel is positioned. The inner parts of the disc, of course, are rotating more slowly than the outer parts. The wheel stays fixed where it is, but the disc is mounted on a carriage that can be moved back and forth in one direction, which repositions the wheel relative to the center of the disc. Now this is the key to how the integrator works: The position of the disc carriage is driven by the input function to the integrator. The output from the integrator is determined by the rotation of the small wheel. So your input function drives the rate of change of your output function and you have just transformed the derivative of some function into the function itself—which is what we call integration!
If that explanation does nothing for you, seeing a mechanical integrator in action really helps. The principle is surprisingly simple and there is no way to watch the device operate without grasping how it works. So I have created [a visualization of a running mechanical integrator][2] that I encourage you to take a look at. The visualization shows the integration of some function \\(f(x)\\) into its antiderivative \\(F(x)\\) while various things spin and move. Its pretty exciting.
![][3] _A nice screenshot of my visualization, but you should check out the real thing!_
So we have a component that can do integration for us, but that alone is not enough to solve a differential equation. To explain the full process to you, Im going to use an example that Bush offers himself in his 1931 paper, which also happens to be essentially the same example we contemplated in our earlier discussion of differential equations. (This was a happy accident!) Bush introduces the following differential equation to represent the motion of a falling body:
\\[\frac{d^2x}{dt^2} = -k\,\frac{dx}{dt} - g\\]
This is the same equation we used to model the motion of our tennis ball, only Bush has used \\(x\\) in place of \\(h\\) and has added another term that accounts for how air resistance will decelerate the ball. This new term describes the effect of air resistance on the ball in the simplest possible way: The air will slow the balls velocity at a rate that is proportional to its velocity (the \\(k\\) here is some proportionality constant whose value we dont really care about). So as the ball moves faster, the force of air resistance will be stronger, further decelerating the ball.
To configure a differential analyzer to solve this differential equation, we have to start with what Bush calls the “input table.” The input table is just a piece of graphing paper mounted on a carriage. If we were trying to solve a more complicated equation, the operator of the machine would first plot our input function on the graphing paper and then, once the machine starts running, trace out the function using a pointer connected to the rest of the machine. In this case, though, our input is just the constant \\(g\\), so we only have to move the pointer to the right value and then leave it there.
What about the other variables \\(x\\) and \\(t\\)? The \\(x\\) variable is our output as it represents the height of the ball. It will be plotted on graphing paper placed on the output table, which is similar to the input table only the pointer is a pen and is driven by the machine. The \\(t\\) variable should do nothing more than advance at a steady rate. (In our Python simulation of the tennis ball problem as posed earlier, we just incremented \\(t\\) in a loop.) So the \\(t\\) variable comes from the differential analyzers motor, which kicks off the whole process by rotating the rod connected to it at a constant speed.
Bush has a helpful diagram documenting all of this that I will show you in a second, but first we need to make one more tweak to our differential equation that will make the diagram easier to understand. We can integrate both sides of our equation once, yielding the following:
\\[\frac{dx}{dt} = - \int \left(k\,\frac{dx}{dt} + g\right)\,dt\\]
The terms in this equation map better to values represented by the rotation of various parts of the machine while it runs. Okay, heres that diagram:
![][4] _The differential analyzer configured to solve the problem of a falling body in one dimension._
The input table is at the top of the diagram. The output table is at the bottom-right. The output table here is set up to graph both \\(x\\) and \\(\frac{dx}{dt}\\), i.e. height and velocity. The integrators appear at the bottom-left; since this is a second-order differential equation, we need two. The motor drives the very top rod labeled \\(t\\). (Interestingly, Bush referred to these horizontal rods as “buses.”)
That leaves two components unexplained. The box with the little \\(k\\) in it is a multiplier respresnting our proportionality constant \\(k\\). It takes the rotation of the rod labeled \\(\frac{dx}{dt}\\) and scales it up or down using a gear ratio. The box with the \\(\sum\\) symbol is an adder. It uses a clever arrangement of gears to add the rotations of two rods together to drive a third rod. We need it since our equation involves the sum of two terms. These extra components available in the differential analyzer ensure that the machine can flexibly simulate equations with all kinds of terms and coefficients.
I find it helpful to reason in ultra-slow motion about the cascade of cause and effect that plays out as soon as the motor starts running. The motor immediately begins to rotate the rod labeled \\(t\\) at a constant speed. Thus, we have our notion of time. This rod does three things, illustrated by the three vertical rods connected to it: it drives the rotation of the discs in both integrators and also advances the carriage of the output table so that the output pen begins to draw.
Now if the integrators were set up so that their wheels are centered, then the rotation of rod \\(t\\) would cause no other rods to rotate. The integrator discs would spin but the wheels, centered as they are, would not be driven. The output chart would just show a flat line. This happens because we have not accounted for the initial conditions of the problem. In our earlier Python simulation, we needed to know the initial velocity of the ball, which we would have represented there as a constant variable or as a parameter of our Python function. Here, we account for the initial velocity and acceleration by displacing the integrator discs by the appropriate amount before the machine begins to run.
Once weve done that, the rotation of rod \\(t\\) propagates through the whole system. Physically, a lot of things start rotating at the same time, but we can think of the rotation going first to integrator II, which combines it with the acceleration expression calculated based on \\(g\\) and then integrates it to get the result \\(\frac{dx}{dt}\\). This represents the velocity of the ball. The velocity is in turn used as input to integrator I, whose disc is displaced so that the output wheel rotates at the rate \\(\frac{dx}{dt}\\). The output from integrator I is our final output \\(x\\), which gets routed directly to the output table.
One confusing thing Ive glossed over is that there is a cycle in the machine: Integrator II takes as an input the rotation of the rod labeled \\((k\,\frac{dx}{dt} + g)\\), but that rods rotation is determined in part by the output from integrator II itself. This might make you feel queasy, but there is no physical issue here—everything is rotating at once. If anything, we should not be surprised to see cycles like this, since differential equations often describe rates of change in a function as a function of the function itself. (In this example, the acceleration, which is the rate of change of velocity, depends on the velocity.)
With everything correctly configured, the output we get is a nice graph, charting both the position and velocity of our ball over time. This graph is on paper. To our modern digital sensibilities, that might seem absurd. What can you do with a paper graph? While its true that the differential analyzer is not so magical that it can write out a neat mathematical expression for the solution to our problem, its worth remembering that neat solutions to many differential equations are not possible anyway. The paper graph that the machine does write out contains exactly the same information that could be output by our earlier Python simulation of a falling ball: where the ball is at any given time. It can be used to answer any practical question you might have about the problem.
The differential analyzer is a preposterously cool machine. It is complicated, but it fundamentally involves nothing more than rotating rods and gears. You dont have to be an electrical engineer or know how to fabricate a microchip to understand all the physical processes involved. And yet the machine does calculus! It solves differential equations that you never could on your own. The differential analyzer demonstrates that the key material required for the construction of a useful computing machine is not silicon but human ingenuity.
### Murdering People
Human ingenuity can serve purposes both good and bad. As I have mentioned, the highest-profile use of differential analyzers historically was to calculate artillery range tables for the US Army. To the extent that the Second World War was the “Good Fight,” this was probably for the best. But there is also no getting past the fact that differential analyzers helped to make very large guns better at killing lots of people. And kill lots of people they did—if Wikipedia is to be believed, more soldiers were killed by artillery than small arms fire during the Second World War.
I will get back to the moralizing in a minute, but just a quick detour here to explain why calculating range tables was hard and how differential analyzers helped, because its nice to see how differential analyzers were applied to a real problem. A range table tells the artilleryman operating a gun how high to elevate the barrel to reach a certain range. One way to produce a range table might be just to fire that particular kind of gun at different angles of elevation many times and record the results. This was done at proving grounds like the Aberdeen Proving Ground in Maryland. But producing range tables solely through empirical observation like this is expensive and time-consuming. There is also no way to account for other factors like the weather or for different weights of shell without combinatorially increasing the necessary number of firings to something unmanageable. So using a mathematical theory that can fill in a complete range table based on a smaller number of observed firings is a better approach.
I dont want to get too deep into how these mathematical theories work, because the math is complicated and I dont really understand it. But as you might imagine, the physics that governs the motion of an artillery shell in flight is not that different from the physics that governs the motion of a tennis ball thrown upward. The need for accuracy means that the differential equations employed have to depart from the idealized forms weve been using and quickly get gnarly. Even the earliest attempts to formulate a rigorous ballistic theory involve equations that account for, among other factors, the weight, diameter, and shape of the projectile, the prevailing wind, the altitude, the atmospheric density, and the rotation of the earth[1][5].
So the equations are complicated, but they are still differential equations that a differential analyzer can solve numerically in the way that we have already seen. Differential analyzers were put to work solving ballistics equations at the Aberdeen Proving Ground in 1935, where they dramatically sped up the process of calculating range tables.[2][6] Nevertheless, during the Second World War, the demand for range tables grew so quickly that the US Army could not calculate them fast enough to accompany all the weaponry being shipped to Europe. This eventually led the Army to fund the ENIAC project at the University of Pennsylvania, which, depending on your definitions, produced the worlds first digital computer. ENIAC could, through rewiring, run any program, but it was constructed primarily to perform range table calculations many times faster than could be done with a differential analyzer.
Given that the range table problem drove much of the early history of computing even apart from the differential analyzer, perhaps its unfair to single out the differential analyzer for moral hand-wringing. The differential analyzer isnt uniquely compromised by its military applications—the entire field of computing, during the Second World War and well afterward, advanced because of the endless funding being thrown at it by the United States military.
Anyway, I think the more interesting legacy of the differential analyzer is what it teaches us about the nature of computing. I am surprised that the differential analyzer can accomplish as much as it can; my guess is that you are too. It is easy to fall into the trap of thinking of computing as the realm of what can be realized with very fast digital circuits. In truth, computing is a more abstract process than that, and electronic, digital circuits are just what we typically use to get it done. In his paper about the differential analyzer, Vannevar Bush suggests that his invention is just a small contribution to “the far-reaching project of utilizing complex mechanical interrelationships as substitutes for intricate processes of reasoning.” That puts it nicely.
_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][7] on Twitter or subscribe to the [RSS feed][8] to make sure you know when a new post is out._
_Previously on TwoBitHistory…_
> Do you worry that your children are "BBS-ing"? Do you have a neighbor who talks too much about his "door games"?
>
> In this VICE News special report, we take you into the seedy underworld of bulletin board systems:<https://t.co/hBrKGU2rfB>
>
> — TwoBitHistory (@TwoBitHistory) [February 2, 2020][9]
1. Alan Gluchoff. “Artillerymen and Mathematicians: Forest Ray Moulton and Changes in American Exterior Ballistics, 1885-1934.” Historia Mathematica, vol. 38, no. 4, 2011, pp. 506547., <https://www.sciencedirect.com/science/article/pii/S0315086011000279>. [↩︎][10]
2. Karl Kempf. “Electronic Computers within the Ordnance Corps,” 1961, accessed April 6, 2020, <https://ftp.arl.army.mil/~mike/comphist/61ordnance/index.html>. [↩︎][11]
--------------------------------------------------------------------------------
via: https://twobithistory.org/2020/04/06/differential-analyzer.html
作者:[Two-Bit History][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://twobithistory.org
[b]: https://github.com/lujun9972
[1]: http://worrydream.com/refs/Bush%20-%20The%20Differential%20Analyzer.pdf
[2]: https://sinclairtarget.com/differential-analyzer/
[3]: https://twobithistory.org/images/diff-analyzer-viz.png
[4]: https://twobithistory.org/images/analyzer-diagram.png
[5]: tmp.MoynZsbJ7w#fn:1
[6]: tmp.MoynZsbJ7w#fn:2
[7]: https://twitter.com/TwoBitHistory
[8]: https://twobithistory.org/feed.xml
[9]: https://twitter.com/TwoBitHistory/status/1224014531778826240?ref_src=twsrc%5Etfw
[10]: tmp.MoynZsbJ7w#fnref:1
[11]: tmp.MoynZsbJ7w#fnref:2

View File

@ -0,0 +1,143 @@
[#]: subject: "How to Use a Differential Analyzer (to Murder People)"
[#]: via: "https://twobithistory.org/2020/04/06/differential-analyzer.html"
[#]: author: "Two-Bit History https://twobithistory.org"
[#]: collector: "lujun9972"
[#]: translator: "toknow-gh"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
怎么用微分分析仪(杀人)
======
微分分析仪是一种能够求解微分方程的机械式模拟计算机。它已经不再使用了,因为如今最便宜的笔记本电脑都能更快地解决相同的问题,并且你还可以同时在线刷剧。然而在数字计算机发明之前,微分分析仪使数学家能够完成一些用其它工具不可能完成的计算。
现如今很难想象一台不是由印刷数字电路组成的计算机竟然是可以正常运作的。机械计算机听起来就像是从蒸汽朋克小说里跑出来的一样。事实证明微分分析仪不但能用,而且还是一些研究领域中必不可少的工具。它最为人所知的应用是曾被美国陆军用于编制火炮射表。如果没有射表辅助瞄准,口径再大的火炮也无法充分发挥效能。所以理论上来说,微分分析仪在帮助同盟国赢得二战上发挥了重要作用。
要弄清微分分析仪是如何做到这些的,你首先得知道什么是微分方程。已经还给学校了?没事,我也一样。
### 微分方程
你首次接触微分方程应该是在大学微积分 I 的最后几周。在学期的这个阶段,你那薪资低微的兼职教授应该已经教授过极限、导数和积分这些概念了。在这些概念之上再引入等号,现在你就得到了一个微分方程。
微分方程描述一个变量相对于另一个(或多个)变量的变化率。形如 $y = 4x + 3$ 的常见代数式表示变量 $y$ 与 变量 $x$ 之间的关系。形如 $\frac{dy}{dx} = x$ 或 $\frac{dy}{dx} = 2$ 的微分方程表示变化率与其它变量间的关系。本质上微分方程就是用纯数学方式来描述变化率。前面第一个方程表示 “变量 $y$ 相对于变量 $x$ 的变化率刚好等于 $x$。”第二个方程表示“无论 $x$ 的值是多少,$y$ 相对于 $x$ 的变化率总是 2。”
微分方程非常有用,因为在面对真实世界中的复杂系统时比起提出一个能够描述系统在任意时刻状态的方程,描述系统从一个时刻到下一个时刻的状态变化要容易得多。因此,微分方程被广泛应用于物理和工程领域。一个著名的微分方程是<ruby>热传导方程<rt>heat equation</rt></ruby>。它能描述热量在物体中的扩散过程。要提出一个完全地描述物体在某时刻 $t$ 的热量分布的函数很困难,但推理热量从某时刻到下一个时刻的扩散过程不太可能会让你绞尽脑汁——近冷者变热,近热者变冷。所以尽管热传导方程在形式上比起前面的例子要复杂得多,它也只是变化率的描述而已。它描述了在给定与周围的温差时,物体上任意一点的温度随时间的变化。
再来举一个更具体的例子。假如我在真空中竖直向上抛出一个网球,在我窒息之前它会落回来吗?这是我在高中物理课上被问到的问题,解决它只需要基本的牛顿运动方程。现在暂且假设我已经忘记了牛顿运动方程,只记得物体以恒定的加速度 $g$ (大约为 $10 \;m/s^2$)向地球加速运动。那么如何用微分方程来解决这个问题呢?
现在把我对高中物理仅存的记忆表示成微分方程。网球在离手后会向地球以 $g$ 加速运动。也就是说网球的速度相对于时间的变化率为 $g$(在负方向上)。进一步,我们可以说球离地高度的变化率(也就是速度)随时间的变化率是负方向的 $g$。其微分方程形式如下,其中 $h$ 表示高度,$t$ 表示时间:
$$
\frac{d^2h}{dt^2} = -g
$$
它跟前面的微分方程看起来略有差别,因为这是所谓的二阶微分方程。我们讨论的是变化率的变化率,也许你还记得微积分课讲过,这需要用到二阶导数。这是方程左边部分看上去像被平方了的原因。但是该方程也仅仅表示了球向下以恒定的加速度 $g$ 加速运动这一事实。
到这里,我可以选择使用微积分来求解微分方程。解微分方程并不是要找满足指定关系的值,而是要找满足关系的函数。对上面的微分方程的另一种理解是存在这样的函数,它的二阶导数为 $-g$。我们想要找到这个函数,因为它能告诉我们球在任意时刻的高度。好在这个微分方程恰巧是容易求解的。通过这样,我们可以重新推导出那些被我遗忘了的运动方程,从而轻松地计算出球落回来所花的时间。
但是大部分情况下微分方程是很难求解的。有时甚至是无法求解的。假设我在大学时把更多的精力花在了计算机科学上,那么我的另一种选择就是用微分方程来做模拟。如果已知球的初速度和加速度,我可以轻易用 Python 写一个 for 循环来逐秒迭代计算球在离手后 $t$ 时刻的速度。在此基础上对循环程序稍加修改,就可以用算出的速度迭代计算出球的高度。运行这个 Python 模拟程序,它就可以计算出球什么时候落回来了。这个模拟并不是完全精确的,但是我可以通过减小计算用的时间步长来提升精度。总之我要做的只是搞清楚当球落回来时我是否还活着。
这就是微分方程的数值解法。这也是大多数领域中求解微分方程时实际采用的方法。对于用数值方法求解微分方程,计算机是必不可少的,因为模拟的精度取决于在微小步长上进行的大量计算。手工计算容易出错并且太耗时。
那如果将这个问题的背景时间设定在 1936 年呢?我仍然希望实现计算过程的自动化。但是此时离 <ruby>克劳德·香农<rt>Claude Shannon</rt></ruby> 完成他的硕士论文还有一年时间。在这篇论文中香农用数字电路实现了布尔 <ruby>代数<rt> boolean algebra</rt></ruby>。没有数字计算机可用,恐怕就只能寄希望于于模拟计算机了。
### 微分分析仪
首台微分分析仪是由 <ruby>范内瓦·布什<rt>Vannevar Bush</rt></ruby><ruby>哈罗德·哈森<rt>Harold Hazen</rt></ruby> 于 1928 年到 1931年在 MIT 建造的。他们两人都是工程师。制造它是为了解决应用数学和物理领域中的实际问题。正如布什在 [1931 年的一篇论文][1] 中所说,微分分析仪是为了解决那些“持续被他们所用方程的复杂度而不是深度所困扰的”的数学家的所面临的当代问题。
微分分析仪是一台由传动轴、齿轮和转盘组成的复杂仪器,它能够求解高达六阶的微分方程。它是一台由简单部件通过复杂组合而成的神奇机器。在这一点上它和数字计算机很像。不同点是,数字计算机通过在电路中实现布尔代数来模拟代数问题,而微分分析仪通过传动轴、齿轮和转盘直接模拟微分方程问题。微分分析仪的本质就是对实际问题的直接机械类比。
那到底怎么用齿轮和转盘来计算微积分呢?其实这是最容易解释的部分。微分分析仪最重要的构件是六个积分器,每一个对应一阶的微分方程。机械积分器的历史可以追溯到 19 世纪,它是一个相对简单的装置,能够对单个简单函数进行积分运算的。下面我们将了解积分器的工作原理,但顺便说一句,布什的巨大成就不是发明了机械积分器,而是发现了一种将积分器串联起来解决高阶微分方程的方法。
机械积分器由一个大转盘和一小得多的转轮组成。转盘像唱片机的转台一样平行于地面平放。它由电机驱动匀速转动。转轮竖直的轻放于转盘表面上,其压力既要足够让转盘驱动转轮,又不能太大以致于阻碍转轮相对于转盘自由侧向滑动。总之当转盘转动时,转轮也跟着转动。
转轮的转速由它距离转盘中心的距离决定。转盘的中心部分自然转动得比边缘部分慢。转轮的位置是固定不动的,而转盘被安装在一个可以来回滑动的底座上。这样就可以调节转轮相对转盘中心的位置。下面就是积分器工作的关键原理:转盘底座的位置由积分器的输入函数控制。积分器输出取决于转轮的转动量。所以输入函数驱动了输出函数的变化率,这就是将某个函数的导数转换成了这个函数本身。这不就是积分运算吗?
如果刚才的解释还没有让你理解积分器的原理,那么直接看到机械积分器实际工作的样子应该对你有所帮助。其实它的原理出乎意料的简单,看一遍它的运行过程你肯定就能窥见其运作机制。因此我制作了一个 [运行中的机械积分器动态原理图][2],强烈建议你看一看。它展示了通过各个部件的旋转和移动求函数 $f(x)$ 的 <ruby>不定积分<rt>antiderivative</rt></ruby> $F(x)$ 的过程。这可太有趣了。
![][3] _A nice screenshot of my visualization, but you should check out the real thing!_
现在我们有了可以做积分运算的组件,但是只靠它还不足以解决微分方程。为了解释求解微分方程的全过程,我将使用布什在他 1931 年的论文中所举的例子。这个例子恰巧跟前面考虑的微分方程是在本质上是一样的。(真是奇妙的巧合!)布什使用下面的微分方程来表示下落物体的运动:
$$
\frac{d^2x}{dt^2} = -k\,\frac{dx}{dt} - g
$$
这跟前面的网球运动的方程基本上是一样的,只不过布什使用 $x$ 代替了 $h$,并且增加了一项来表示空气阻力的减速作用。这个新增项采用了最简单的形式来描述空气阻力的作用:空气减慢球速的比率正比于球的速度(这里 $k$ 是一个常比例系数,我并不关心它的具体取值)。也就说是球运动得越快,空气阻力就越大,对球的减速作用越显著。
为了配置微分分析仪来解决这个微分方程,我们需要从布什称之为“输入面板”的东西开始。输入面板其实就是一张安装在支架上的坐标纸。如果想要解更复杂的方程,首先需要操作员在坐标纸上绘制好输入函数图像,然后在机器启动时用一个与机器主体相连的指针来跟踪函数图像的轨迹。在我们举的例子中,输入是常数 $g$,所以我们只需将指针移动到正确的位置并让它保持不动即可。
剩下的变量 $x$ 和 $t$ 又是什么呢?变量 $x$ 表示球的高度,是微分分析仪的输出。它会被绘制在输出面板上的坐标纸上。输出面板与输入面板类似,只是它没有指针,取而代之的是由微分分析仪驱动的绘图笔。变量 $t$ 仅仅是按固定速率步进。(在前面模拟网球运动 Python 程序中,我们通过循环来增加 $t$。)变量 $t$ 来源于微分分析仪的电机,它通过匀速转动传动轴来驱动整个计算过程。
布什的原理图对于理解我下面要介绍的内容很有帮助。不过为了便于理解,需要先对微分方程再做一次变换。对方程两边同时进行一次积分,得到下式:
$$
\frac{dx}{dt} = - \int \left(k\,\frac{dx}{dt} + g\right)\,dt
$$
现在方程中的各项与微分分析仪运行中各部件转动量所表示的值之间有了更明确的对应关系。布什的原理图如下:
![][4] _The differential analyzer configured to solve the problem of a falling body in one dimension._
在原理图的顶部是输入面板,右下角是输出面板。图中的输出面板被配置成同时绘制高度 $x$ 和速度 $\frac{dx}{dt}$。积分器在左下方,由于这是二阶微分方程,所以我们需要两个积分器。电机驱动顶部标注为 $t$ 的传动轴。(有趣的是,布什将这些水平传动轴称为“总线”。)
现在原理图中还剩下两个部件没有解释了。里边标记了 $k$ 的方框是<ruby>乘法器<rt>multiplier</rt></ruby>$k$ 是比例常数。它获取由 $\frac{dx}{dt}$ 标记的传动轴的转动量,并通过齿轮组进行放缩。用 $\sum$ 标记的方框是<ruby>加法器<rt>adder</rt></ruby>。它通过巧妙的齿轮组合将两个传动轴的的转动叠加起来驱动第三个传动轴。我们的方程中涉及了求两项之和,所以需要引入加法器。这些额外组件的引入确保了微分分析仪有足够的灵活性来模拟由各种各样的项和系数组成的方程。
我发现以慢放的方式来推演电机启动时的级联因果过程对于理解微分分析仪的原理很有帮助。电机启动后立即驱动传动轴 $t$ 匀速旋转。这样我们就有了时间的概念。这个传动轴有三个作用,分别由连接其上的三个竖直传动轴表示:它驱动了两个积分器的转盘的转动,同时带动输出面板的支架让绘图笔作图。
如果积分器的转轮被放置在转盘中心,那么传动轴 $t$ 就不会带动其它传动轴转动。积分器的转盘会转动,但是放置在转盘中心的转轮不会被带动。这时输出图像将会是一条平坦的直线。出现这种情况是因为我们没有明确指定问题的初始条件。在上面的 Python 程序中,我们需要以常量或函数参数的形式用到网球的初始速度。在启动机器之前,我们通过将两个积分器的转盘调整到合适的位置来指定速度和加速度的初始值。
设置好这些之后,传动轴 $t$ 的转动将会传导到整个系统之中。从物理上来说,许多部件会同时开始转动。但是我们可以认为转动首先传导到积分器 II然后与基于 $g$ 计算得到的加速度表达式求积分得到球的速度 $\frac{dx}{dt}$。速度又反过来作为积分器 I 的输入,推动它的转盘让输出转轮以速率 $\frac{dx}{dt}$ 转动。积分器 I 的输出作为最终结果将会被直接导向到输出面板上。
前面我有意避开了一个令人困惑的细节,那就是机器里有一个怪圈。积分器 II 以传动轴 $(k\,\frac{dx}{dt} + g)$ 为输入,但是该传动轴的转动又部分决定于积分器 II 的输出本身。这可能快把你绕吐了,但在物理上这并没有任何问题——因为所有部部件都是一同转动的。出现这种怪圈并没什么奇怪的,因为在用微分方程在描述某函数的变化率时,也经常会用该函数的函数的形式。(在这个例子中,加速度,即速度的变化率,取决于于速度。)
在将所有东西都正确配置好后,机器会输出球的高度和速度随时间变化的函数图像。这个图像是纸质的。用我们的现代数字化思维来看,这可能有点难以理解。画在纸上的函数图像能干什么?微分分析仪确实不能魔术般地给出解的简洁数学表达式,这是事实。但也请记住一点,很多的微分方程根本没有简洁的解析解。纸上的函数图像与前面模拟球下落的 Python 程序包含相同的信息:某时刻球的位置。它可以回答任何关于该问题的实际问题。
微分分析仪简直酷到爆。它虽然结构复杂,但是本质上只是一些传动轴和齿轮外的组合。要理解它的运作过程,你不必是电气工程师或者会制造芯片。然而它确实可以解微积分!它能够求解出那些靠你自己永远无法解决的微分方程问题。它证明建造计算机器的关键材料不是硅而是人类的创造力。
### 杀人
人类的创造力既能为善,也能为恶。正如我提到的,微分分析仪在历史上最知名的应用是为美国陆军计算火炮射表。鉴于二战是一场“正义的战争”,这是最好的结果。但是也不能忽视微分分析仪增强了大口径火炮的杀伤效能。火炮的确杀死了很多人。如果维基百科可信的话,在二战中死于炮火的士兵比被轻武器杀死的更多。
我们稍后再回到道德讨论上来,先快速解释一下为什么计算射表这么困难,以及微分分析仪是怎么帮助计算射表的。这是将微分分析仪应用于实际问题的很好的例子。射表能告诉炮手在射击某个距离外的目标时需要将炮口上抬多高。编制射表的一种方法是在不同的仰角下发射该火炮,并将结果记录下来。这种方法被用在靶场,比如位于马里兰的阿伯丁试验场。但是单纯通过实验观察的方式来编制射表即昂贵又耗时。在考虑到如天气状况或不同弹丸重量等其它因素时,需要进行的射击次数将会随组合爆增到无法实施的程度。所以基于少量观测数据建立数学模型,再基于该模型来填充出完整的射表是一个更好的方法。
我不想太深入讨论这些数学理论,它们实在太难了,我也不懂。但是你应该也想到了,支配飞行中的炮弹和向上抛出的网球运动的物理规律并没有什么不同。由于计算精度的需要,我们使用的微分方程不得不偏离其理想化的形式,并迅速变得面目狰狞起来。即便是最早的精确弹道理论中的公式,除其它因素外,还考虑了弹丸的重量、直径、形状、主风、海拔、大气密度以及地球自转[1][5]。
虽然关于射表计算的方程很复杂但它们跟前面的微分方程一样都可以通过微分分析仪数值求解。1935 年微分分析仪被阿伯丁试验场用于求解弹道方程。这显著加快了计算射表的速度。[2][6] 然而,二战期间对于射表的需求增长太快了,以至于美国陆军计算射表的速度难以满足运往欧洲战场的武器装备的配套需求。这最终导致陆军资助了宾夕法尼亚大学的 ENIAC 项目。这促成了世界上第一台数字计算机的诞生。(译注:严格来说 ENIAC 是第二台电子数字计算机。第一台电子计算机是阿塔纳索夫-贝瑞计算机AtanasoffBerry Computer简称 ABC 计算机ENIAC 能够通过重新布线运行任意程序。但建造它的主要是为了以数倍于微分分析仪的速度来计算射表。
鉴于在微分分析仪之外,射表计算问题极大地推动了早期计算领域的发展,专门挑出微分分析仪的道德问题也许是不公正的。微分分析仪并没有局限于军事领域的应用,在二战期间和二战后的很大一段时间里,由于美国军方投入的大量的拨款,整个计算领域得到了发展。
总之,我认为微分分析仪更有趣的遗产是它告诉了我们计算的本质。我惊叹于于微分分析仪能做到这么多事情,我猜你也一样。我们很容易落入这样的思维陷阱:将计算看作是由快速数字电路实现的领域。事实上,计算是更抽象的过程,电子数字电路只是实现计算的典型手段罢了。在关于微分分析仪的论文中,布什说他的发明不过是在“运用复杂机械结构来类比复杂的推理过程这一影响深远的计划”上的微小贡献。他的总结很贴切。
1. Alan Gluchoff. “Artillerymen and Mathematicians: Forest Ray Moulton and Changes in American Exterior Ballistics, 1885-1934.” Historia Mathematica, vol. 38, no. 4, 2011, pp. 506547., <https://www.sciencedirect.com/science/article/pii/S0315086011000279>. [↩︎][10]
2. Karl Kempf. “Electronic Computers within the Ordnance Corps,” 1961, accessed April 6, 2020, <https://ftp.arl.army.mil/~mike/comphist/61ordnance/index.html>. [↩︎][11]
--------------------------------------------------------------------------------
via: https://twobithistory.org/2020/04/06/differential-analyzer.html
作者:[Two-Bit History][a]
选题:[lujun9972][b]
译者:[toknow-gh](https://github.com/toknow-gh)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://twobithistory.org
[b]: https://github.com/lujun9972
[1]: http://worrydream.com/refs/Bush%20-%20The%20Differential%20Analyzer.pdf
[2]: https://sinclairtarget.com/differential-analyzer/
[3]: https://twobithistory.org/images/diff-analyzer-viz.png
[4]: https://twobithistory.org/images/analyzer-diagram.png
[5]: tmp.MoynZsbJ7w#fn:1
[6]: tmp.MoynZsbJ7w#fn:2
[7]: https://twitter.com/TwoBitHistory
[8]: https://twobithistory.org/feed.xml
[9]: https://twitter.com/TwoBitHistory/status/1224014531778826240?ref_src=twsrc%5Etfw
[10]: tmp.MoynZsbJ7w#fnref:1
[11]: tmp.MoynZsbJ7w#fnref:2