Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions 01-ExamplesPaper1-Field-Lines.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,26 @@
" N = 100\n",
" ds = float(distance) / N\n",
" \n",
" X = np.zeros(N)\n",
" Y = np.zeros(N)\n",
" Z = np.zeros(N)\n",
" # To create N line segments, we need N+1 points",
" X = np.zeros(N+1)\n",
" Y = np.zeros(N+1)\n",
" Z = np.zeros(N+1)\n",
" \n",
" X[0] = x0\n",
" Y[0] = y0\n",
" Z[0] = z0\n",
" \n",
" for i in range(1,N):\n",
" [Bx,By,Bz] = myfield( X[i-1], Y[i-1], Z[i-1] ) # Evaluate the field at the previous point (i-1)\n",
" for i in range(N):\n",
" [Bx,By,Bz] = myfield( X[i], Y[i], Z[i] ) # Evaluate the field at the previous point i\n",
" # Normalise the vector:\n",
" magnitude = np.sqrt( Bx**2 + By**2 + Bz**2 )\n",
" Bnx = Bx / magnitude\n",
" Bny = # insert your code\n",
" Bnz = # insert your code\n",
" # Now evaluate the field line location at the current point (i)\n",
" X[i] = X[i-1] + Bnx*ds\n",
" Y[i] = # insert your code\n",
" Z[i] = # insert your code\n",
" # Now evaluate the field line location at the current point (i+1)\n",
" X[i+1] = X[i] + Bnx*ds\n",
" Y[i+1] = # insert your code\n",
" Z[i+1] = # insert your code\n",
" \n",
" return X, Y, Z # Return the coordinates of the field line"
]
Expand Down