Python Forum
Code for a circular wire??
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code for a circular wire??
#11
Here is the stated problem:
A circular loop of radius one unit is carrying 1 unit of current. The center of the loop is at
(0,0,0) and it is flat in X–Y plane. Compute magnetic field on domain (−2, −2, −2) to (2, 2, 2)
using Biot–Savert law. Plot your results as vector field.

Currently I'm trying to define a 3 dimensional vector that will be used for calculating this problem.
This will probably look quite ugly(and wrong) but this is where I need help. I need this vector to encompass all points from (−2, −2, −2) to (2, 2, 2).

def radial_vector(x, y, z):
i=-2
while i <= 2:
x = i
x[i] = x
return x
j=-2 #errors for sure defining the radial_vector
while j <= 2:
y[j] = j
y[j] = y
return y
k=-2
while k <= 2:
z[k] = k
z[k] = z
return z
V=vec(3)
V[0]=x
V[1]=y
V[2]=z
radial_vector = V
return radial_vector
print radial_vector
[/i]
Reply
#12
Is this what you mean by a "vector field"? If so, it looks like you'll need to do this (or similar).

You need to figure out how to bridge the gap. You have your assignment, and you have a graph image of a vector field as the beginning and end. You also have some code that is closer to the beginning, and I've linked code that it closer to the end. You need to bring those together.

We're Python programmers, but we're not necessarily familiar with the math or specific modules in your project. I suspect I could figure it out, but it would be time consuming, so you'll get the best help if you can make your next post as specific and precise a problem / question as possible, ideally hard-coding anything that isn't directly relevant to the blocking problem. Documentation for the module I linked to should help bridge the gap between math and Python, and if you can keep questions here Python-specific with as little math as possible, that would also help us to help you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating a circular matrix with one input omnisierra 18 5,593 Oct-02-2020, 01:51 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020