Maxima で螺旋(らせん)を立体的にグラデーションで描く

関数の定義

らせん軌道をあらわす $x, y, z$ は媒介変数表示で

\begin{eqnarray}
x(u) &=& \cos 2\pi u \\
y(u) &=& \sin 2\pi u \\
z(u) &=& \mbox{pitch} \times u
\end{eqnarray}

In [1]:
x(u):= cos(2*%pi*u)$
y(u):= sin(2*%pi*u)$
z(u):= pitch * u$

pitch: 0.01$

グラデーション付きのらせんの例

前後関係がわかるように,手前を palette で濃いめの色(dark-red),奥を薄目の色(light-pink)にしている。

In [2]:
u0: -0.25$
u1: 20.25$

draw3d(
  nticks = 1000, axis_3d = false, 
  line_width = 5, xrange = [-2, 2], yrange = [-2, 2],
  palette = [dark-red, red, light-pink], enhanced3d = y(u), 
  colorbox=false, 
  dimensions = [640,640],
  user_preamble = 
    "set zeroaxis;
     set xyplane 0;",

  parametric(x(u), y(u), z(u), u, u0, u1))$

ソレノイドがつくる内部磁場

ソレノイドは1本の電線を螺旋状に密に巻いたものである。十分に長いソレノイドを流れる電流により,ソレノイドの内部にのみ,長さ方向に一定の内部磁場ができることがわかる。

ソレノイドの「奥」半分を描く

In [3]:
plines: makelist(
    [parametric(x(u), y(u), z(u), u, i, i+0.5)], 
    i, 0, 19
    )$

draw3d(
  nticks = 100, axis_3d = false, 
  xrange = [-2, 2], yrange = [-2, 2],
  palette = [dark-red, red, light-pink], enhanced3d = y(u), 
  colorbox=false, 
  dimensions = [640,640],
  title = "十分に長いソレノイドの内部磁場", 
  user_preamble = 
    "set zeroaxis;
     set xyplane 0;",

  line_width = 5, 
  plines)$

内部磁場を描く

In [4]:
draw3d(
  nticks = 100, axis_3d = false, 
  xrange = [-2, 2], yrange = [-2, 2],
  palette = [dark-red, red, light-pink], enhanced3d = y(u), 
  colorbox=false, 
  dimensions = [640,640],
  title = "十分に長いソレノイドの内部磁場", 
  user_preamble = 
    "set zeroaxis;
     set xyplane 0;",

  line_width = 5, 
  plines, 

  color="green", 
  line_width=10,  
  vector([-0.5,0,0],[0,0,0.2]),
  vector([0,0,0],[0,0,0.2]),
  key = "磁場",
  vector([0.5,0,0],[0,0,0.2]))$

ソレノイドの「手前」半分を描く

In [5]:
mlines: makelist(
    [parametric(x(u),y(u),z(u),u,i+0.5,i+1)], 
    i, 0, 19
    )$

draw3d(
  nticks = 100, axis_3d = false, 
  xrange = [-2, 2], yrange = [-2, 2],
  palette = [dark-red, red, light-pink], enhanced3d = y(u), 
  colorbox=false, 
  dimensions = [640,640],
  title = "十分に長いソレノイドの内部磁場", 
  user_preamble = 
    "set zeroaxis;
     set xyplane 0;",

  line_width = 5, 
  plines, 

  color="green", 
  line_width=10,  
  vector([-0.5,0,0],[0,0,0.2]),
  vector([0,0,0],[0,0,0.2]),
  key = "磁場",
  vector([0.5,0,0],[0,0,0.2]),
  
  line_width = 5, key = "", 
  mlines)$

最初と最後にちょっと追加

ソレノイドの最初と最後に 0.25 周と電流の矢印を追加。

In [6]:
draw3d(
  nticks = 100, axis_3d = false, 
  xrange = [-2, 2], yrange = [-2, 2],
  palette = [dark-red, red, light-pink], enhanced3d = y(u), 
  colorbox=false, 
  dimensions = [640,640],
  title = "十分に長いソレノイドの内部磁場", 
  user_preamble = 
    "set zeroaxis;
     set xyplane 0;",

  line_width = 5, 
  parametric(x(u), y(u), z(u), u, -0.25, 0),
  plines, 

  color="green", 
  line_width=10,  
  vector([-0.5,0,0],[0,0,0.2]),
  vector([0,0,0],[0,0,0.2]),
  key = "磁場",
  vector([0.5,0,0],[0,0,0.2]),
  
  line_width = 5, key = "", 
  mlines,
  parametric(x(u), y(u), z(u), u, 20, 20.25),

  color="light-pink",
  vector([x(20.25), y(20.25), z(20.25)], [-1.5,0,0]),  
  color="dark-red", key = "電流",
  vector([x(-0.25)-1.5, y(-0.25), z(-0.25)], [1.5,0,0]))$

一様な静磁場中の荷電粒子の運動

電場はないとして,磁場によるローレンツ力を受けた荷電粒子の運動方程式を解くと,一様な静磁場中では,荷電粒子はらせん軌道を描いて運動することがわかる。

らせん軌道の「奥」半分を描く

In [7]:
pitch: 0.1$
plines: makelist(
    [parametric(x(u),y(u),z(u),u,i,i+0.5)], 
    i, 0, 4
    )$

draw3d(
  nticks = 100, axis_3d = false, 
  xrange = [-2, 2], yrange = [-2, 2],
  palette = [dark-blue, cyan], enhanced3d = y(u), 
  colorbox=false, 
  dimensions = [640,640],
  title = "一様な静磁場中の荷電粒子の運動", 
  user_preamble = 
    "set zeroaxis;
     set xyplane 0;",

  line_width = 5, 
  plines)$

一様な静磁場を描く

In [8]:
vecs: makelist(
    [vector([0.8*i, 0, 0], [0, 0, 0.55])], 
    i, -2, 1
    )$

draw3d(
  nticks = 100, axis_3d = false, 
  xrange = [-2, 2], yrange = [-2, 2],
  palette = [dark-blue, cyan], enhanced3d = y(u), 
  colorbox=false, 
  dimensions = [640,640],
  title = "一様な静磁場中の荷電粒子の運動", 
  user_preamble = 
    "set zeroaxis;
     set xyplane 0;",

  line_width = 5, 
  plines,
  
  line_width = 10, 
  color = "light-green",
  vecs,
  key = "磁場 B",
  vector([1.6, 0, 0], [0, 0, 0.55]))$

らせん軌道の「手前」半分を描く

In [9]:
mlines: makelist(
    [parametric(x(u),y(u),z(u),u,i+0.5,i+1)], 
    i, 0, 4
    )$

draw3d(
  nticks = 100, axis_3d = false, 
  xrange = [-2, 2], yrange = [-2, 2],
  palette = [dark-blue, cyan], enhanced3d = y(u), 
  colorbox=false, 
  dimensions = [640,640],
  title = "一様な静磁場中の荷電粒子の運動", 
  user_preamble = 
    "set zeroaxis;
     set xyplane 0;",

  line_width = 5, 
  plines,
  
  line_width = 10, 
  color = "light-green",
  vecs,
  key = "磁場 B",
  vector([1.6, 0, 0], [0, 0, 0.55]),
  
  line_width = 5, key = "", 
  mlines)$

最初と最後にちょっと追加

In [10]:
draw3d(
  nticks = 100, axis_3d = false, 
  xrange = [-2, 2], yrange = [-2, 2],
  palette = [dark-blue, cyan], enhanced3d = y(u), 
  colorbox=false, 
  dimensions = [640,640],
  title = "一様な静磁場中の荷電粒子の運動", 
  user_preamble = 
    "set zeroaxis;
     set xyplane 0;",

  line_width = 5, 
  plines,
  
  line_width = 10, 
  color = "light-green",
  vecs,
  key = "磁場 B",
  vector([1.6, 0, 0], [0, 0, 0.55]),
  
  line_width = 5, key = "", 
  mlines,

  parametric(x(u), y(u), z(u), u, 5, 5.25),
  color = cyan, 
  vector([x(5.25), y(5.25), z(5.25)], [-0.5, 0, 0]),
  key = "荷電粒子の軌道",
  parametric(x(u), y(u), z(u), u, -0.25, 0))$