Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Magnetic field from a coil (on Mathematica)

  1. Sep 20, 2013 #1
    Hello guys,

    I'm trying to find the configuration of two circular coils in a configuration similar to Helmholtz coils that would homogenize the magnetic field best at a volume between them.

    So the first thing step I took in that is use the Biot-Savart law to calculate the magnetic field produced at each point through that coil. The coordinate system is Cylinderical coordinates, and the coil is placed on the xy-plane, its center matches the origin (0,0,0).

    The function is

    dl = \sqrt {d{x^2} + d{y^2}} = Rd\theta \\
    B\left( {\overrightarrow r } \right) = \frac{{{\mu _0}I}}{{4\pi {R^3}}}\int\limits_0^{2\pi } {\left( {\overrightarrow {dl} \times \left( {\overrightarrow r - \overrightarrow R } \right)} \right)d\theta } \\
    B\left( {x,y,z} \right) = \frac{{{\mu _0}I}}{{4\pi {R^3}}}\int\limits_0^{2\pi } {\left( {\left( { - R\sin \theta ,R\cos \theta ,0} \right) \times \left( {x - R\cos \theta ,y - R\sin \theta ,z} \right)} \right)d\theta }

    where r(x,y,z) is the position vector from origin to the point, at which the magnetic field is to be calculated; R is the radius of the coil.

    I wrote a Mathematica script to do this integral, but it always gives a single number (representing a 2 pi R^2 constant result from the cross product and the integral), no matter how I change x,y and z. This is the function I'm using.

    FieldAtPoint[x_, y_, z_] :=
    (u0 i)/(4 Pi r^2)
    Cross[r{-Sin[t], Cos[t], 0}, ({x - r Cos[t], y - r Sin[t], z})], {t,
    0, 2 Pi}]
    Do you find anything wrong within my calculations? Please advise. How do I do this correctly?

    Thank you for any efforts.
    Last edited: Sep 20, 2013
  2. jcsd
  3. Sep 21, 2013 #2
    You need this term in the denominator: |x(obs) - x(coil)|3

    The R3 term is an error -- it's |x(coil)|3
  4. Sep 21, 2013 #3
    @lpetrich Thanks a lot! what a stupid mistake!
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Magnetic field from a coil (on Mathematica)
  1. Magnetic field coil (Replies: 3)