logo

Python の葉序パターン |アルゴリズム植物学の単位

葉序/葉序とは、植物の茎上の葉の配置であり、葉序のらせんは自然界で独特のパターンを形成します。この言葉自体は、ギリシャ語の「葉」を意味する phullon と、「配置」を意味するタクシーに由来しています。基本的な花の葉序配置には次のようなものがあります。

1. らせん葉序 -

らせん状葉序では、個々の花器官が同じ発散角で一定の時間間隔で作成されます。らせん状の葉序を持つ花の発散角は約 137.5 度で、これは次のようなパターンを示しています。



文字列を int に変換する方法

フィボナッチ数列

下の図は、時計回りと反時計回りの両方の螺旋パターンを持つ螺旋葉序パターンを示しています。

Python の葉序パターン |アルゴリズム植物学の単位


注意すべき重要な点:

  1. フィボナッチ数列は通常、自然界に見られる螺旋を表します。これは、前の数値のペアが系列内の次の数値に合計される系列として計算されます。シリーズは 1 1 2 3 5 8 13 21 34 55 89 … です。
  2. 実際には、時計回りの螺旋が 1 セット、反時計回りの螺旋が 1 セットあります。
  3. 花器官の螺旋は、オフセットしたフィボナッチ数の分子と分母のセット (1/2 1/3 2/5 3/8 5/13 8/21 13/34 …) に従います。分子は、開始原点に戻るまでの軸の周りの回転回数です。分母はターン中に開始されるオルガンの数を示します。したがって、2/5 は軸を中心に 2 回転し、5 つの器官が原点に戻ることを示します。
  4. 例 - 松では頭状葉序に (2 3) (5 3) および (5 8) の葉序があり、ペアは (21 34) (55 34) (55 89) および (89 144) であり、六角形の鱗を持つパイナップルでは、パイナップルのサイズに応じて三つ組 (8 13 21) または (13 21 34) が見つかります。標本。
  5. 葉序におけるフィボナッチ数列の蔓延は、「葉序の謎」とよく呼ばれます。


他のタイプの花の葉序配置は次のとおりです。

2. 輪生葉序 3. 単純輪生葉序 4. 複雑輪生葉序 & 5. 不規則葉序

パターンの形成:まとめ

葉序と呼ばれる一部の植物の美しい葉の配置は、多くの微妙な数学的関係に従っています。たとえば、ヒマワリの頭にある小花は 2 つの逆向きの螺旋を形成し、そのうち 55 個は時計回り、34 個は反時計回りです。驚くべきことに

bash 環境変数が設定されているかどうかを確認する
  1. これらの数値は連続したフィボナッチ数です。
  2. 代替フィボナッチ数の比率は、φ^(-2) への収束によって与えられます。ここで、φ は 黄金比 植物の茎の連続する葉の間の回転の割合を測定すると言われています。
  3. 例: ニレとシナノキの場合は 1/2、ブナとハシバミの場合は 1/3、オークとリンゴの場合は 2/5、ポプラとバラの場合は 3/8、ヤナギとアーモンドの場合は 5/13 など。
  4. 植物の茎の新しい葉はそれぞれ、前の葉に対して特定の角度で配置され、この角度は葉の間で一定です。通常は約 137.5 度です。

つまり、植物を上から見下ろし、茎から葉に引いた線と次の葉の対応する線の間に形成される角度を測定すると、一般に発散角と呼ばれる一定の角度があることがわかります。ここではらせん葉序に興味があり、タートル グラフィックスを使用して Python でらせん葉序パターンを形成するコードを作成します。

コードの設計

  1. 葉序パターンを描画する関数と花びらを描画する関数の 2 つの関数をコーディングします。
  2. 花びらは、葉序パターンが完了した後にのみ描画する必要があります。そのため、葉序パターンを描画した後に訪問される最後の x & y 座標を使用して、drawPhyllPattern() 関数内からdrawPetal() 関数を呼び出します。
  3. drawPetal()関数はタートル関数と機能を使用して花びらを描画します。 タートルプログラミング

葉序パターンをコード化するには、次の方程式に従う必要があります。

x = r*cos(θ)  
y = r*sin(θ)

r θ can also vary - so the to form phyllotactic pattern we substitutethe cartesian form
by polar form:

r = c*sqrt(n)
θ = n*137.508°
Python の葉序パターン |アルゴリズム植物学の単位
Reduces the problem to optimal packing on a disc so  
r = c*sqrt(n) is from the area of the circle
Area = πr² and n fills the Area in some units
c1 * n/π = r² c is 1/sqrt(c1/π)
So r = some constant c * sqrt(n)

疑似コード : 葉序パターン

IMPORT MODULES ( MATH TURTLE )  

FUNCTION - DrawPhyllotaxisPattern( turtle t length petalstart angle = 137.508 size cspread)
turtleColor('Black')
FillColor(''Orange')
Convert angle to radians (Φ)
initialize ( xcenterycenter ) = ( 00 )
Drawing the Pattern Starts:
For n in Range ( 0t ):
r = cspread * sqrt(n)
θ = n * Φ

x = r * cos(θ) + xcenter
y = r * sin(θ) + ycenter

TURTLE POSITION(xy)
START DRAWING():
if Drawing pattern ends:
DrawFlowerPetals()

FUNCTION - DrawFlowerPetals(Turtle x coordinate y coordinate)
DRAW using Turtle methods

Create Turtle = gfg
Call DrawPhyllotaxisPattern( gfg t length petalstart angle = 137.508 size cspread)

END
Python Pattern A
import math import turtle def drawPhyllPattern(turtle t petalstart angle = 137.508 size = 2 cspread = 4 ):  '''print a pattern of circles using spiral phyllotactic data''' # initialize position # turtle.pen(outline=1 pencolor='black' fillcolor='orange') turtle.color('black') turtle.fillcolor('orange') phi = angle * ( math.pi / 180.0 ) #we convert to radian xcenter = 0.0 ycenter = 0.0 # for loops iterate in this case from the first value until < 4 so for n in range (0 t): r = cspread * math.sqrt(n) theta = n * phi x = r * math.cos(theta) + xcenter y = r * math.sin(theta) + ycenter # move the turtle to that position and draw  turtle.up() turtle.setpos(x y) turtle.down() # orient the turtle correctly turtle.setheading(n * angle) if n > petalstart-1: turtle.color('yellow') drawPetal(turtle x y) else: turtle.stamp() def drawPetal(turtle x y ): turtle.penup() turtle.goto(x y) turtle.pendown() turtle.color('black') turtle.fillcolor('yellow') turtle.begin_fill() turtle.right(20) turtle.forward(70) turtle.left(40) turtle.forward(70) turtle.left(140) turtle.forward(70) turtle.left(40) turtle.forward(70) turtle.penup() turtle.end_fill() # this is needed to complete the last petal gfg = turtle.Turtle() gfg.shape('turtle') gfg.speed(0) # make the turtle go as fast as possible drawPhyllPattern(gfg 200 160 137.508 ) gfg.penup() gfg.forward(1000) 
Python Pattern B
import math import turtle def drawPhyllotacticPattern( t petalstart angle = 137.508 size = 2 cspread = 4 ):  '''print a pattern of circles using spiral phyllotactic data''' # initialize position turtle.pen(outline=1 pencolor='black' fillcolor='orange') # turtle.color('orange') phi = angle * ( math.pi / 180.0 ) xcenter = 0.0 ycenter = 0.0 # for loops iterate in this case from the first value until < 4 so for n in range (0 t): r = cspread * math.sqrt(n) theta = n * phi x = r * math.cos(theta) + xcenter y = r * math.sin(theta) + ycenter # move the turtle to that position and draw  turtle.up() turtle.setpos(x y) turtle.down() # orient the turtle correctly turtle.setheading(n * angle) if n > petalstart-1: #turtle.color('yellow') drawPetal(x y) else: turtle.stamp() def drawPetal( x y ): turtle.up() turtle.setpos(x y) turtle.down() turtle.begin_fill() #turtle.fill(True) turtle.pen(outline=1 pencolor='black' fillcolor='yellow') turtle.right(20) turtle.forward(100) turtle.left(40) turtle.forward(100) turtle.left(140) turtle.forward(100) turtle.left(40) turtle.forward(100) turtle.up() turtle.end_fill() # this is needed to complete the last petal turtle.shape('turtle') turtle.speed(0) # make the turtle go as fast as possible drawPhyllotacticPattern( 200 160 137.508 4 10 ) turtle.exitonclick() # lets you x out of the window when outside of idle 

出力:

葉序パターン。

Python の葉序パターン |アルゴリズム植物学の単位

クイズの作成