매개방정식을 공부할 때면 빠지지 않고 등장하는 사이클로이드(cycloid)

             x = a (theta  - sin(theta))
            y = a(1 - cos(theta)) 
               where  a is the radius of rolling circle and theta is the rotated angle

를 그려보자.

[참고  자료 1] Maxima 로 동작하는 사이클로이드 애니메이션
[참고 자료 2] SVG 로 만든 사이클로이드 애니메이션 

* 윈도우 XP 에서 Mathematica 8 을 이용하여 그린 사이클로이드(cycloid):





* 윈도우 XP 에서 Maxima 5.25.0 을 이용하여 매개곡선으로 사이클로이드 그리기



*** wxplot2d 대신에 plot2d 를 사용하면 뱔도의 창에 그려준다.
     (wxMaxima 대신에 xMaxima 를 사용하였다)



** 위의 명령으로 xMaxima 가 별도의 창에 그려준 매개곡선




 

* 윈도우 XP 에서 윈도우 용 Gnuplot 을 이용하여 그린 함수의 그래프:
(* 윈도우 용 Gnuplot 다운로드: http://www.tatsuromatsuoka.com/gnuplot/Eng/winbin/ *)

** 사이클로이드를 매개곡선으로 그리기 위한 gnuplot 소스

set term win
set parametric
set dummy t
set samples 1600
set trange [0 : 3.5*pi]
set xrange [-1 : 5*pi]
set yrange [-2 : 5]
set title "cycloid"
plot t - sin(t), 1 - cos(t)



** 윈도우 XP 에서 윈도우용 Gnuplot(wgnuplot.exe)을 실행시킨 모습 




*** Gnuplot 이 그려준 사이클로이드




* Mac OS X Lion 에서 Grapher 를 이용하여 그린 사이클로이드:

 

 

* 윈도우 XP 의 Python 2.7 에 matplotlib 1.0.1 을 (모두 32비트 용으로) 설치하여 파이썬 소스로 그린 음함수의 그래프:

#!/usr/bin/env python

"""
An example which plots the parametirized curve.
         Plot a cycloid..
"""

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure, show, rc, title
import matplotlib.lines as mlines


# radar green, solid grid lines
rc('grid', color='#316931', linewidth=1, linestyle='-')
rc('xtick', labelsize=15)
rc('ytick', labelsize=15)

# force square figure and square axes looks better for polar, IMO
fig = figure(figsize=(8,8))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=False, axisbg='#d5de9c')

plt.axvline(x=0, color='black')
plt.axhline(y=0, color='black')
plt.axvline(x=np.pi, color='silver')
plt.axvline(x=2*np.pi, color='silver')
plt.axvline(x=3*np.pi, color='silver')
plt.axvline(x=4*np.pi, color='silver')
plt.axhline(y=2, color='silver')

t = np.arange(0.0, 3.5*np.pi, 0.05)

a = 1
x = a*(t - np.sin(t))
y = a*(1 - np.cos(t))

ax.set_xlim(-0.5, 4*np.pi)
ax.set_ylim(-1, 4)
ax.plot(x, y, color='#ee8d18', lw=3, label='cycloid')
ax.legend()

title("cycloid")
show()




 

#!/usr/bin/env python

"""
An example which plots the parametirized curve.
         Plot the Descartes' folium.
"""

import numpy as np
from matplotlib.pyplot import figure, show, rc, title

# radar green, solid grid lines
rc('grid', color='#316931', linewidth=1, linestyle='-')
rc('xtick', labelsize=15)
rc('ytick', labelsize=15)

# force square figure and square axes looks better for polar, IMO
fig = figure(figsize=(8,8))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=False, axisbg='#d5de9c')


t = np.arange(0.0, 27.0, 0.05)
x =3*t/(1 + t**3)
y =3*t**2/(1 + t**3)
ax.plot(x, y, color='#ee8d18', lw=3, label='a line')
ax.legend()

t = np.arange(-18, -1.15, 0.05)
x =3*t/(1 + t**3)
y =3*t**2/(1 + t**3)
ax.plot(x, y, color='#ee8d18', lw=3, label='a line')

t = np.arange(-0.82, 0.01, 0.05)
x =3*t/(1 + t**3)
y =3*t**2/(1 + t**3)
ax.plot(x, y, color='#ee8d18', lw=3, label='a line')
# ax.legend()

title("Descartes' folium")
show()


(* 위의 소스는 수정 없이 윈도우 7 의 Python 3.2 64bit 에 matplotlib 1.1.0 64bit 를 설치하여 실행해도 된다 *)


 

Posted by Scripter
,