L4K ︰ Python Turtle《九》

於是小海龜探索『相平面』之道︰

Phase plane

In applied mathematics, in particular the context of nonlinear system analysis, a phase plane is a visual display of certain characteristics of certain kinds of differential equations; a coordinate plane with axes being the values of the two state variables, say (x, y), or (q, p) etc. (any pair of variables). It is a two-dimensional case of the general n-dimensional phase space.

The phase plane method refers to graphically determining the existence of limit cycles in the solutions of the differential equation.

The solutions to the differential equation are a family of functions. Graphically, this can be plotted in the phase plane like a two-dimensional vector field. Vectors representing the derivatives of the points with respect to a parameter (say time t), that is (dx/dt, dy/dt), at representative points are drawn. With enough of these arrows in place the system behaviour over the regions of plane in analysis can be visualized and limit cycles can be easily identified.

The entire field is the phase portrait, a particular path taken along a flow line (i.e. a path always tangent to the vectors) is a phase path. The flows in the vector field indicate the time-evolution of the system the differential equation describes.

In this way, phase planes are useful in visualizing the behaviour of physical systems; in particular, of oscillatory systems such as predator-prey models (see Lotka–Volterra equations). In these models the phase paths can “spiral in” towards zero, “spiral out” towards infinity, or reach neutrally stable situations called centres where the path traced out can be either circular, elliptical, or ovoid, or some variant thereof. This is useful in determining if the dynamics are stable or not.[1]

Other examples of oscillatory systems are certain chemical reactions with multiple steps, some of which involve dynamic equilibria rather than reactions that go to completion. In such cases one can model the rise and fall of reactant and product concentration (or mass, or amount of substance) with the correct differential equations and a good understanding of chemical kinetics.[2]

Classification of equilibrium points of a linear autonomous system.[1] These profiles also arise for non-linear autonomous systems in linearized approximations.

 

貫通『直達』與『轉向』之理︰

pi@raspberrypi:~ $ python3
Python 3.4.2 (default, Oct 19 2014, 13:31:11) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import turtle, math
>>> turtle.setup(width=1024, height=768)
>>> turtle.shape('turtle')
>>> turtle.mode('logo')
>>> 
>>> t = [math.pi/180*n for n in range(361)]
>>> x = [80*math.sin(t[n])**3 for n in range(361)]
>>> y = [65*math.cos(t[n])- 25*math.cos(2*t[n])-10*math.cos(3*t[n])-5*math.cos(4*t[n]) for n in range(361)]
>>> 點距 = [math.sqrt( (y[n+1]-y[n])**2 + (x[n+1]-x[n])**2 ) for n in range(360)]
>>> 朝向 = [90 - 180.0/math.pi*math.atan( (y[n+1]-y[n])/(x[n+1]-x[n]) ) for n in range(360)]
>>> 轉向角度 = [朝向[n+1]-朝向[n] for n in range(359)]
>>> 轉向角度[89] = 轉向角度[88]
>>> 轉向角度[269] = 轉向角度[268]
>>> 
>>> 起始角度 = 朝向[0]
>>> 第一步長度 = 點距[0]
>>> 餘步列 = 點距[1:]
>>> def 知心():
...     保存原向 = turtle.heading()
...     turtle.right(起始角度)
...     turtle.forward(第一步長度)
...     for n in range(359):
...         if 轉向角度[n] > 0:
...             turtle.right(轉向角度[n])
...         else:
...             turtle.left(-轉向角度[n])
...         turtle.forward(餘步列[n])
...     turtle.seth(保存原向)
... 
>>> def 四季():
...     turtle.color('red', 'yellow')
...     turtle.penup()
...     for sun in range(4):
...         turtle.forward(300)
...         turtle.pendown()
...         turtle.begin_fill()
...         知心()
...         turtle.end_fill()
...         turtle.penup()
...         turtle.backward(300)
...         turtle.left(90)
... 
>>> 四季()
>>> 

 

 

深體五湖四海皆兄弟,四面八方多友朋,豈可不識上下乎??

自然萬物是科學觀察之園地,技術啟發的寶庫。回聲可以定位︰

Animal echolocation

Echolocation, also called bio sonar, is the biological sonar used by several kinds of animals Echolocating animals emit calls out to the environment and listen to the echoes of those calls that return from various objects near them. They use these echoes to locate and identify the objects. Echolocation is used for navigation and for foraging (or hunting) in various environments. Some blind humans have learned to find their way using clicks produced by a device or by mouth.

Echolocating animals include some mammals and a few birds; most notably microchiropteran bats and odontocetes (toothed whales and dolphins), but also in simpler form in other groups such as shrews, one genus of megachiropteran bats (Rousettus) and two cave dwelling bird groups, the so-called cave swiftlets in the genus Aerodramus (formerly Collocalia) and the unrelated Oilbird Steatornis caripensis.[1]

 300px-Animal_echolocation.svg
A depiction of the ultrasound signals emitted by a bat, and the echo from a nearby object.

 

舞蹈可以傳意︰

蜜蜂舞蹈

蜜蜂舞蹈英語:waggle dance,蜜蜂八字形搖擺舞)為用於表達蜜蜂養殖行為中之蜜蜂特定八字形舞蹈(figure-eight dance)的一個術語。通過進行這個舞蹈,成功覓食者可以與群體的其他成員分享有關產生花蜜和花粉的花,水源,或以新的巢址位置的方向和距離的信息。[1][2]出自於奧地利生物學家諾貝爾獎得主卡爾·馮·弗里希在1940年代的研究翻譯其意義,工蜂在採完花蜜回到蜂巢之後,會進行兩種特別的移動方式。[3]研究對象是一種西方蜜蜂、為卡尼鄂拉蜂。當一隻工蜂回到巢中,其他工蜂會面向她,並以她為中心,就像在觀看這隻蜜蜂跳舞一樣。在發現提出之後經過多年的爭議,最後被大多數生物學家接受,並且成為當代生物學教科書中有關動物行為的經典教材。

Bee_dance

花朵的方向與太陽方向的夾角,等於搖臀直線與地心引力的夾角(α角)。

舞蹈的種類

搖臀舞

蜜 蜂跳舞的移動路徑會形成一個8字形。外圍環狀部分稱做回歸區(return phase);中間直線部分稱做搖臀區(waggle phase),搖臀舞(Waggle dance)因此得名。蜜蜂會一邊搖動臀部一邊走過這條直線,搖臀的持續時間表示食物的距離,搖臀時間愈長,表示食物距離愈遠,以75毫秒代表100公尺。而這段直線與地心引力的方向之夾角,代表食物方向與太陽方向的夾角。之後更發現,蜜蜂會因太陽位置的相對移動而修正直線的角度。

環繞舞

環繞舞(Round dance),一開始被分類為另一種舞蹈,是工蜂用來表達蜂巢附近有食物的存在,但無法表達食物的距離與方向。通常使用在發現近距離的食物(距離小於50-60公尺)。然而後來的研究認為環繞舞並非獨立存在,而是搖臀舞的直線部分極短暫的版本。

搖擺舞交流演化

科學家透過觀察發現不同品種的蜜蜂擁有不同舞蹈的「語言」,每個品種或亞種舞蹈的弧度及時間都各有不同[4][5]一項近期研究顯示在東方蜜蜂西方蜜蜂共同居住的地區,二者能夠逐漸理解對方舞蹈中的「語言」[6]

Waggle_dance

西方蜜蜂的八字形搖擺舞。搖擺舞進行於垂直蜂巢45°的”向上”方向(A圖);即表示食物來源位於蜂巢(B圖)外之太陽右側45°(α角)向上方向。”舞蹈蜜蜂”的腹部因從一邊快速移動到另一邊故出現些許的模糊影像.

─ 摘自《W!o+ 的《小伶鼬工坊演義》︰神經網絡【超參數評估】五

 

據說已入相空間

Phase space

Phase space of a dynamic system with focal instability, showing one phase space trajectory

In mathematics and physics, a phase space of a dynamical system is a space in which all possible states of a system are represented, with each possible state corresponding to one unique point in the phase space. For mechanical systems, the phase space usually consists of all possible values of position and momentum variables. The concept of phase space was developed in the late 19th century by Ludwig Boltzmann, Henri Poincaré, and Willard Gibbs.[1]

 

矣☆