사이클로이드(cycloid)의 직교방정식(직교좌표에 의한 방정식)은

             x = a arccos(1 - y/a) - sqrt(2ay - y^2)

이다. 이 직교방정식을 이용하여 사이클로이드를 그려보자.


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




* Mac OS X Lion 에서 Maxima 5.25.0 을 이용하여 그린 직교방정식의 사이클로이드

 

 

* Mac OS X Lion 에서 직교방정식의 사이클뢰드 그리기
   (사이클로이드를 직교방정식으로 그리기 위한 gnuplot 소스)

set term aqua
set xrange[-1:9] 
set yrange[-1:4]
set isosamples 250
set view map
unset surface
set hidden3d
set key outside
set contour base
set title "cycloid by plotting contour"
splot x - acos(1 - y) + sqrt(2*y - y**2) 


 

** Mac OS X Lon 에서 Gnuplot 을 실행시킨 모습 

 


*** Gnuplot 이 그려준 직교방정식에 의한 사이클로이드

 



* Mac OS X Lion 에서 Grapher 를 이용하여 직교방정식의 사이클로이드:

 

 

* 윈도우 XP 에서 Python 2.7 & matplotlib 1.0.1 을 이용하여 그린 그래프:
** 파이썬 소스

#!/usr/bin/env python

import math
from pylab import *
import matplotlib.pyplot as plt
import matplotlib.lines as lines


def make_xaxis(ax, yloc, offset=0.05, **props):
    xmin, xmax = ax.get_xlim()
    locs = [loc for loc in ax.xaxis.get_majorticklocs()
            if loc>=xmin and loc<=xmax]
    tickline, = ax.plot(locs, [yloc]*len(locs),linestyle='',
            marker=lines.TICKDOWN, **props)
    axline, = ax.plot([xmin, xmax], [yloc, yloc], **props)
    tickline.set_clip_on(False)
    axline.set_clip_on(False)
    for loc in locs:
        ax.text(loc, yloc-offset, '%1.1f'%loc,
                horizontalalignment='center',
                verticalalignment='top')

def make_yaxis(ax, xloc=0, offset=0.05, **props):
    ymin, ymax = ax.get_ylim()
    locs = [loc for loc in ax.yaxis.get_majorticklocs()
            if loc>=ymin and loc<=ymax]
    tickline, = ax.plot([xloc]*len(locs), locs, linestyle='',
            marker=lines.TICKLEFT, **props)
    axline, = ax.plot([xloc, xloc], [ymin, ymax], **props)
    tickline.set_clip_on(False)
    axline.set_clip_on(False)

    for loc in locs:
        ax.text(xloc-offset, loc, '%1.1f'%loc,
                verticalalignment='center',
                horizontalalignment='right')


fig = plt.figure(facecolor='white')
ax = fig.add_subplot(111, frame_on=False)

props = dict(color='black', linewidth=2, markeredgewidth=2)
ax.axison = False
ax.set_xlim(-2, 3*pi)
ax.set_ylim(-1, 5)
make_xaxis(ax, 0, offset=0.2, **props)
make_yaxis(ax, 0, offset=0.5, **props)

y = arange(0.0, 2., 0.01)
x = arccos(1 - y) - sqrt(2*y - y**2)
ax.plot(x, y, 'b-')

grid(True)
xlabel('----> x')
ylabel('----> y')

title('A cycloid : the graph of x = arccos(1 - y) - sqrt(2y -y^2)')

# plot the colored markers on the graph
# ax.plot(t, b, 'd', markersize=3, markerfacecolor='blue')
# ax.plot(x, a, 'd', markersize=3, markerfacecolor='red')

# set the rectangular range to be viewed.
plt.axis([-2, 3*pi, -1.0, 5.0])

plt.show()






** 위의 소스를 실행시켜서 그린 그래프


 

Posted by Scripter
,