데카르트의 엽선(folium)  x^3 + y^3 = 3xy 의 매개방정식 표현은

             x = 3t/(1 + t^3)
            y = 3t^2/(1 + t^3)
               where   -infinity < t < -1, or -1 < t < infinity

이다.

* 윈도우 XP 에서 Mathematica 8 을 이용하여 그린 데카르트의 엽선:





* 윈도우 XP 에서 Maxima 5.25.0 을 이용하여 매개곡선을 그리는 명령



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



*** plot2d 대신에 wxplot2d 를 사용하면 뱔도의 창을 열지 않고 같은 창에 그려준다.




 

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

** Descartes' folium 을 매개곡선으로 그리기 위한 gnuplot 소스

# set term win
set xrange [-6:6]
set yrange [-6:6]
set title "Descartes' folium"
set parametric
set dummy t
set samples 1600
plot 3*t/(1 + t**3), 3*t**2/(1 + t**3)




** 윈도우 XP 에 설치된 Cygwin-X 에서 Gnuplot 을 실행시킨 모습 




*** 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 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
,

데카르트의 엽선(folium)이라고도 불리우는
음함수 x^3 + y^3 = 3xy 의 그래프 그리기 연습

* 윈도우 7 에서 Mathematica 8 을 이용하여 그린 함수의 그래프:




* Mac OS X Lion 에서 Maxima 5.25.0 을 이용하여 그린 함수의 그래프


 

* 윈도우 7 에서 윈도우 용 Gnuplot 을 이용하여 그린 함수의 그래프:
(* 윈도우 용 Gnuplot 다운로드: http://www.tatsuromatsuoka.com/gnuplot/Eng/winbin/ *)
(* gp45-winbin.zip 이라고 적힌 곳을 클릭하여 다운로드하고,
    압축을 풀어서 gnuplot 이라는 폴더를 아무 곳이나 옮기거나 복사히면
    그 곳이 윈도우 용 Gnuplot 의 설치 디렉토리이다.
    윈도우 용 Gnuplot 이 설치된 폴더 안의 폴더 binary 에 있는 Gnuplot 아이콘을 더블 클릭하여 실행한다.
    실행하면 반드시 첫 명령으로 'set term win' 이라는 명령을 내려야만 그래프 출력을 볼 수 있다.
*)



* Descartes' folium 을 그리기 위한 gnuplot 소스

#set terminal to windows
set term win

set contour
splot x**3 + y**3 - 3*x*y

#set discrete levels
set cntrparam levels discrete 0
set title "Descartes' folium"
unset surface

#show contour setting
# show contour
set isosamples 100
set view 0,0

# set the line color to black
set linetype 1 lc rgb "dark-violet" lw 2 pt 0
set linetype 2 lc rgb "sea-green"   lw 2 pt 7
set linetype 3 lc rgb "cyan"        lw 2 pt 6 pi -1
set linetype 4 lc rgb "dark-red"    lw 2 pt 5 pi -1
set linetype 5 lc rgb "blue"        lw 2 pt 8
set linetype 6 lc rgb "dark-orange" lw 2 pt 3
set linetype 7 lc rgb "black"       lw 2 pt 11
set linetype 8 lc rgb "goldenrod"   lw 2
set linetype cycle 8
replot




* Gnuplot 이 그려준 곡선

 

 



* Mac OS X Lion 에서 Grapher 를 이용하여 그린 함수의 그래프:


 

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

#!/usr/bin/env python
"""
An example which plots the graph of an implicit function.

         Plot the Descartes' folium.
"""
import matplotlib
import numpy as np
import matplotlib.pyplot as plt

delta = 0.025
x = np.arange(-6.0, 6.0, delta)
y = np.arange(-6.0, 6.0, delta)
X, Y = np.meshgrid(x, y)
Z = X**3 + Y**3 - 3*X*Y

# Set negative contours to be solid iine.
matplotlib.rcParams['contour.negative_linestyle'] = 'solid'
plt.figure()
CS = plt.contour(X, Y, Z, 1, colors='k')
plt.title("Descartes' folium")

plt.show()



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


Posted by Scripter
,
함수 y = x*x*exp(x) 의 그래프 그리기 연습

* 윈도우 XP 에서 Mathematica 8 을 이용하여 그린 함수의 그래프:



* 윈도우 7 에서 Mathematica 8 을 이용하여 그린 함수의 그래프:




* 윈도우 XP 에서 Maxima 5.25.0 을 이용하여 그린 함수의 그래프





* 윈도우 XP 에서 윈도우 용 Gnuplot 을 이용하여 그린 함수의 그래프:
   (* 윈도우 용 Gnuplot 다운로드:  http://www.tatsuromatsuoka.com/gnuplot/Eng/winbin/ *)
   (* gp45-winbin.zip 이라고 딘 곳을 클릭하여 다운로드 하고, 
      압축을 풀어서 gnuplot 이라는 폴더를 아무 곳이나 옮기거나 복사히면 
      그 곳이 윈도우 영 Gnuplot 의 설치 디렉퇴리이다.
      윈도우 용 Gnuplot  이 설치된 폴더 안의 폴더 binary 에 있는 아이콘

      를 더블 클릭하여 실행한다. 
      실행하면 반드시 'set terminal win' 이라는 명령을 내려야만 그래프 출력을 볼 수 있다.
  *)


gnuplot> set terminal win

gnuplot> plot [-8:2][-2:15] x**2 * exp(x)








* Mac OS X Lion 에서 Grapher 를 이용하여 그린 함수의 그래프:





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

#!/usr/bin/env python

from pylab import *
import matplotlib.pyplot as plt

x = arange(-8.0, 2.0, 0.01)

plot(x, (x**2)*exp(x), '-')
grid(True)
xlabel('x')
ylabel('y')

# set the rectangular range to be viewed.
plt.axis([-8, 2, -2.0, 15.0])

show()



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

 



Posted by Scripter
,
함수 y = sin(1/x) 의 그래프 그리기 연습

* 윈도우 7 에서 Mathematica 8 을 이용하여 그린 함수의 그래프:




* Mac OS X 에서 Maxima 5.25.0 을 이용하여 그린 함수의 그래프:





* Mac OS X Lion 에서 Gnuplot 을 이용하여 그린 함수의 그래프:

gnuplot> plot [-2*pi:2*pi] [-1.5:1.5] sin(1/x)






* Mac OS X Lion 에서 Grapher 를 이용하여 그린 함수의 그래프:




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

#!/usr/bin/env python

from pylab import *
import matplotlib.pyplot as plt

x = arange(-2.0*pi, 2.0*pi, 0.01)

plot(x, sin(1/x), '-')
grid(True)
xlabel('x')
ylabel('y')

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

show()



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


 



Posted by Scripter
,

함수 y = sin(x * x) 의 그래프 그리기 연습

* 윈도우 7 에서 Mathematica 8 을 이용하여 그린 함수의 그래프:




* 윈도우 7 에서 Maxima 5.25.0 을 이용하여 그린 함수의 그래프:





* 윈도우 XP 에서 Cygwin-X 의 Gnuplot 을 이용하여 그린 함수의 그래프:






* Mac OS X Lion 에서 Grapher 이용하여 그린 함수의 그래프:




* 윈도우 XP 의 Python 2.6 에 matplotlib 1.0.1 을 설치하여 파이썬 소스로 그린 함수의 그래프:

#!/usr/bin/env python


from pylab import *
import matplotlib.pyplot as plt


x = arange(-2.0*pi, 2.0*pi, 0.01)

plot(x, sin(x**2), '-')
grid(True)
xlabel('x')
ylabel('y')


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


show()





 



 

Posted by Scripter
,