Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Can anyone help me out with this?

I am trying to get Mathematica to evaluate curl of a vector field. The vector field is

(y + cos[z]) + (z + cos[x]) + (x + cos[y])

The path from (0,0,0) to (1,1,1) of the arc of the curve that I am trying to graph is (t, t^2, t^3).

Now I know there are curl commands in Mathematica, but I am not very familar with them. Can anyone help me set this up so Mathematica will evaluate it?

share|improve this question
2  
Try to write your code in proper mathematica syntax –  belisarius Jun 17 at 23:22
    
Please post your Mathematica expressions using correct Mathematica syntax. You can't expect to get anywhere with Mathematica if you don't take the time to learn the basics of its syntax. –  m_goldberg Jun 17 at 23:43
1  
Take a closer look at this post Using the epsilon tensor in Mathematica where you can find a simple picture what the curl operator does with clear relations to contraction of tensors and the Levi-Civita symbol. –  Artes Jun 17 at 23:44

1 Answer 1

It is good to express a vector field so that its vectorial nature is unambiguous, i.e., that the vector field is indeed a vector with three independent components at all positions (x, y, z). The three components of a vector field should multiply unit vectors or be given as three entries in a list. I had to guess what vector field you meant.

It is not entirely clear to me what you want to do with this vector field along the specified curve. I arrived at two interpretations: (1) compute the line integral of the curl of the vector field along the specified curve, and (2) compute the line integral of the vector field itself along the specified curve. The exact form of either line integral is not simple, so I resorted to a numerical approximation in both cases. Neither interpretation gives a result that seems typical of a problem assigned in a first course on vector calculus. Perhaps I misunderstood the parametric curve you provided.

It could be that you intended an entirely different calculation from the two that are performed below. The fact that both calculations gave such complicated exact answers, made me draw the two 3D plots below that at least confirm that the signs of the two line integrals are correct (positive: field and line element vectors tend to be "more parallel" along the curve; negative: field and line element vectors tend to be "more anti-parallel" along the curve), even if neither of my interpretations is what you intended.

You can see the two 3D plots by removing the semicolon at the end of each of the two Show[] expressions and then revaluating the two cells. I just learned how to include plots in an answer--I hope this works. You can learn a lot by removing semicolons in someone else's Mathematica code. If you decide to run this code, be sure to remove every instance of In[1]:= and Out[1]= , etc. that Mathematica put in this notebook.

vecField = {y + Cos[z], z + Cos[x], x + Cos[y]}
(* {y + Cos[z], z + Cos[x], x + Cos[y]} *)

curlVecField = Curl[vecField, {x, y, z}]
(* {-1 - Sin[y], -1 - Sin[z], -1 - Sin[x]} *)

curve = {t, t^2, t^3}
(* {t, t^2, t^3} *)

lineElement = D[curve, t]
(* {1, 2 t, 3 t^2} *)

coordTransRules = {x -> t, y -> t^2, z -> t^3}
(* {x -> t, y -> t^2, z -> t^3} *)

integrand1 = (curlVecField /. coordTransRules).lineElement
(* -1 + 3 t^2 (-1 - Sin[t]) - Sin[t^2] + 2 t (-1 - Sin[t^3]) *)

Integrate[integrand1, {t, 0, 1}]
(* 1/6 (18 - 18 Cos[1] - 2 I ExpIntegralE[1/3, -I] + 
         2 I ExpIntegralE[1/3, I] - 
         3 Sqrt[2 π] FresnelS[Sqrt[2/π]] - 2 Sqrt[3] Gamma[2/3] - 
         36 Sin[1]) *)

NIntegrate[integrand1, {t, 0, 1}]
(* -4.35066  *)

Now:

curvePlot1 = 
            ParametricPlot3D[curve, {t, 0, 1}, AxesLabel -> {"x", "y", "z"}, 
            PlotRange -> {{-0.2, 1.3}, {-0.2, 1.3}, {-0.2, 1.3}}, 
            PlotStyle -> Darker[Blue]];

vecFieldArrowPlot1 = 
            Graphics3D[
            Table[{Darker[Red, 0.5], Arrowheads[0.02], 
            Arrow[{curve, curve + 0.10 (curlVecField /. coordTransRules)}], 
            Point[curve]}, {t, 0, 1, 0.1}]];

lineElementArrowPlot1 = 
            Graphics3D[
            Table[{Darker[Blue, 0.5], Arrowheads[0.02], 
            Arrow[{curve, curve + 0.10 (lineElement /. coordTransRules)}], 
            Point[curve]}, {t, 0, 1, 0.1}]];

            Show[curvePlot1, vecFieldArrowPlot1, lineElementArrowPlot1];

What you will see if you remove the semicolon from the right end of the above Show.

integrand2 = (vecField /. coordTransRules).lineElement
(* t^2 + 2 t (t^3 + Cos[t]) + 3 t^2 (t + Cos[t^2]) + Cos[t^3] *)

Integrate[integrand2, {t, 0, 1}]
(* 1/60 (-31 + 120 Cos[1] - 10 ExpIntegralE[2/3, -I] - 
              10 ExpIntegralE[2/3, I] - 
              45 Sqrt[2 π] FresnelS[Sqrt[2/π]] + 10 Sqrt[3] Gamma[1/3] + 
              210 Sin[1]) *)

NIntegrate[integrand2, {t, 0, 1}]
(* 3.97539 *)

curvePlot2 = 
             ParametricPlot3D[curve, {t, 0, 1}, AxesLabel -> {"x", "y", "z"}, 
             PlotRange -> {{-0.2, 1.3}, {-0.2, 1.3}, {-0.2, 1.3}}, 
             PlotStyle -> Darker[Blue], BaseStyle -> 14];

vecFieldArrowPlot2 = 
             Graphics3D[
             Table[{Darker[Red, 0.5], Arrowheads[0.02], 
             Arrow[{curve, curve + 0.10 (vecField /. coordTransRules)}], 
             Point[curve]}, {t, 0, 1, 0.1}]];

lineElementArrowPlot2 = 
             Graphics3D[
             Table[{Darker[Blue, 0.5], Arrowheads[0.02], 
             Arrow[{curve, curve + 0.10 (lineElement /. coordTransRules)}], 
             Point[curve]}, {t, 0, 1, 0.1}]];

Show[curvePlot2, vecFieldArrowPlot2, lineElementArrowPlot2];

What you see if the semicolon if removed from the right end of the above Show.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.