원주좌표계에서 이변수함수

    z = g(r, theta) = sin(r) / r = sin(sqrt(x^2 + y^2)) / sqrt(x^2 + y^2)

의 그래프를 그려보자. 이 함수의 그래프는 xz-평면에서 z = sin(x) / x 의 그래프를 그린 다음 z-축을 회전축으로 하여 일회전허면 얻어지는 곡면이다, z의 값은 theta 에 관하여는 상수이고, 오직 z-축 까지의 거리 r 에만 의존한다. 참고로, 이 이변수함수의 그래프는 Octave 의 로고

로도 쓰인다,


* 윈도우 XP 에서 Mathematica 8 을 이용하여 그리기





* 윈도우 XP 에서 wxMaxima 를 이용하여 그리기
** 명령 입력



** 위의 명령으로 별도의 창에 그려진 곡면





* Mac OS X Lion 에서 Grapher 를 이용하여 그리기





* 윈도우 XP 에서 Gnuplot 을 이용하여 그리기
** Gnuplot 소스
set term win
set samples 51, 51
set isosamples 21, 21
splot [-2*pi:2*pi][-2*pi:2*pi] sin(sqrt(x**2 + y**2))/sqrt(x**2 + y**2)


** 위의 명령으로 Gnuplot 이 그려준 곡면




* 윈도우 XP 에서 Octave 3.2.4 를 이용하하여 곡면 그리기
** Octave 소스
 tx = ty = linspace (-8, 8, 41)';
[xx, yy] = meshgrid (tx, ty);
r = sqrt (xx .^ 2 + yy .^ 2) + eps;
tz = sin (r) ./ r;
mesh (tx, ty, tz);



** 위의 명령으로 Octave 가 그려준 곡면




* Matplotlib 를 이용하여 곡면 그리기
** 파이썬 소스

#!/usr/bin/env python

from mpl_toolkits.mplot3d.axes3d import Axes3D
import matplotlib.pyplot as plt

# imports specific to the plots in this example
import numpy as np
from matplotlib import cm

# Twice as wide as it is tall.
fig = plt.figure(figsize=plt.figaspect(0.7))

#---- First subplot
ax = fig.add_subplot(111, projection='3d')
X = np.arange(-2*np.pi, 2*np.pi, 0.05)
Y = np.arange(-2*np.pi, 2*np.pi, 0.05)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R) / R
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet,
        linewidth=0, antialiased=False)
ax.set_zlim3d(-1.01, 1.01)

fig.colorbar(surf, shrink=0.5, aspect=10)

plt.show()



** 위의 소스를 실행시켜서 그린 곡면



 

Posted by Scripter
,