MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Magnetic field for a straight conductor with finite length -

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91687] Re: Magnetic field for a straight conductor with finite length -
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 5 Sep 2008 07:13:35 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <g9qimb$4fg$1@smc.vnet.net>

robert prince-wright wrote:

> I am trying to create a plot which shows the magnetic field around a straight line of finite length. I started by looking online at Michael Trott's Mathematica Guidebook for Numerics which gives an example of how Mathematica can solve the Biot-Savart equation for the case of an infinite line running along the Z-axis:  
> 
> infiniteWire[t_] = {0, 0, t};
> sol1 = Integrate[
>  Cross[D[infiniteWire[t], t], {x, y, z} - infiniteWire[t]]/
>   Norm[{x, y, z} - infiniteWire[t]]^3, {t, -Infinity, Infinity}, 
>  GenerateConditions -> False]
> 
> 
> However, if you evaluate the expression above using Mathematica 6 the output is different to the book in that it includes Im[] terms. Can someone explain why, and how do I get rid of them? I tried Re[] but result is left unevaluated if expr is not a numeric quantity. Note I have used the built in Norm[] function, not a user defined function like Michael. 

You could use *Assuming[]* and tell Mathematica that the imaginary part 
of x, y, and z is zero. For instance,

In[1]:= infiniteWire[t_] = {0, 0, t};
sol1 = Assuming[{Im[x] == 0, Im[y] == 0, Im[z] == 0},
   Integrate[Cross[D[infiniteWire[t], t], {x, y, z} - infiniteWire[t]]/
     Norm[{x, y, z} - infiniteWire[t]]^3, {t, -Infinity, Infinity},
    GenerateConditions -> False]]


Out[2]=

      2 y       2 x
{-(-------), -------, 0}
     2    2    2    2
    x  + y    x  + y

> Ultimately, what I need is the solution for the Integral below:
> 
> 
> sol2 = Integrate[
>   Cross[D[infiniteWire[t], t], {x, y, z} - infiniteWire[t]]/
>    Norm[{x, y, z} - infiniteWire[t]]^3,
>   {t, 0, L},
>   GenerateConditions -> False]
> 
> 
> This corresponds to the case where current flows in a straight line from the origin in x-y-z space to a point at a distance L along the Z axis.

Here, you may want to add some condition on L. For instance,

In[6]:= sol2 = Assuming[{Im[x] == 0, Im[y] == 0, Im[z] == 0, L >= 0},
   Integrate[Cross[D[infiniteWire[t], t], {x, y, z} - infiniteWire[t]]/
     Norm[{x, y, z} - infiniteWire[t]]^3, {t, 0, L},
    GenerateConditions -> False]]

Out[6]=

                            2    2
                           x  + y              2    2    2
               y (Sqrt[1 + --------] z - Sqrt[x  + y  + z ])
                                  2
                           (L - z)
{Piecewise[{{-----------------------------------------------,
                                  2    2
                2    2           x  + y          2    2    2
              (x  + y ) Sqrt[1 + --------] Sqrt[x  + y  + z ]
                                        2
                                 (L - z)

      L > 0 && z >= 0}, {-(

                       2    2
                      x  + y              2    2    2
          y (Sqrt[1 + --------] z + Sqrt[x  + y  + z ])
                             2
                      (L - z)
         -----------------------------------------------), L > 0 && z < 0}
                             2    2
           2    2           x  + y          2    2    2
         (x  + y ) Sqrt[1 + --------] Sqrt[x  + y  + z ]
                                   2
                            (L - z)

                                      2    2
                                     x  + y              2    2    2
                         x (Sqrt[1 + --------] z - Sqrt[x  + y  + z ])
                                            2
                                     (L - z)
      }], Piecewise[{{-(-----------------------------------------------),
                                            2    2
                          2    2           x  + y          2    2    2
                        (x  + y ) Sqrt[1 + --------] Sqrt[x  + y  + z ]
                                                  2
                                           (L - z)

                                       2    2
                                      x  + y              2    2    2
                          x (Sqrt[1 + --------] z + Sqrt[x  + y  + z ])
                                             2
                                      (L - z)
      L > 0 && z >= 0}, {-----------------------------------------------,
                                             2    2
                           2    2           x  + y          2    2    2
                         (x  + y ) Sqrt[1 + --------] Sqrt[x  + y  + z ]
                                                   2
                                            (L - z)

      L > 0 && z < 0}}], 0}


Regards,
-- Jean-Marc


  • Prev by Date: Re: Help on Collecting Integers
  • Next by Date: Part Error
  • Previous by thread: Re: Help on Collecting Integers
  • Next by thread: Mapping and AppendTo