# Line Integral Help?

This forum has been an amazing resource as I learn Mathematica. I could use some help in putting together a simple program for line integrals. I'm especially puzzled by ones you have to reparametrize with trig functions.

For example, I solved the following problem manually, but I can't figure out how to do this in Mathematica, and in a way the script can be used for additional similar problems.

Here's the problem. I'm only interested in the (b) part, as (a) is easy. I understand the exact process mathematically to solve this, but I can't seem to find out the code to automatically re-parameterize the vector field and then take the integral of the dot product, with the integral ranging from 0 to pi. All of that brings me up gobbledygook.

Here's the code I've been trying this out with.

Clear[F,x,y,t,R]
x[t_]:= Cos[t[;
y[t_]:=-sqrt(5/2) Sin[t];
R[t_]:={x[t],y[t]};
F[t_]:={-y[t]/(5 x[t]^2 + 2 y[t]^2), x[t]/(5 x[t]^2 + 2 y[t]^2)}


x[t_] := Cos[t];
y[t_] := -Sqrt[5/2] Sin[t];
R[t_] := {x[t], y[t]};
F[t_] := {-y[t]/(5 x[t]^2 + 2 y[t]^2), x[t]/(5 x[t]^2 + 2 y[t]^2)}
Integrate[F[t] . R'[t], {t, 0, 2 π}]


-Sqrt[(2/5)] π

Since

Curl[{-y/(5 x^2 + 2 y^2), x/(5 x^2 + 2 y^2)}, {x, y}] // Simplify


0

So we can also integrate the line integral by using arbitrary parametric curve which enclose the singular point $$(0,0)$$

F[x_, y_] := {-y/(5 x^2 + 2 y^2), x/(5 x^2 + 2 y^2)};
r[t_] := {Cos[t], -Sin[t]};
Integrate[(F[x, y] /. Thread[{x, y} -> r[t]]) .
D[{x, y} /. Thread[{x, y} -> r[t]], t], {t, 0, 2 π}]


-Sqrt[(2/5)] π

The following two example use anti-clock,the sign is positive. Since the two integral is not easy to calculate, here we use NIntegrate .

Clear[r, F];
r[t_] := With[{a = 7,
b = 1}, {(a + b) Cos[t] - b*Cos[((a + b) t)/b], (a + b) Sin[t] -
b*Sin[((a + b) t)/b]}]; ParametricPlot[r[t], {t, 0, 2 π}]
F[x_, y_] := {-y/(5 x^2 + 2 y^2), x/(5 x^2 + 2 y^2)};
NIntegrate[(F[x, y] /. Thread[{x, y} -> r[t]]) .
D[{x, y} /. Thread[{x, y} -> r[t]], t], {t, 0, 2 π}]


1.98692

Clear[r, F];
r[t_] := {Cos[t]^3, Sin[t]^3};
ParametricPlot[r[t], {t, 0, 2 π}]
F[x_, y_] := {-y/(5 x^2 + 2 y^2), x/(5 x^2 + 2 y^2)};
NIntegrate[(F[x, y] /. Thread[{x, y} -> r[t]]) .
D[{x, y} /. Thread[{x, y} -> r[t]], t], {t, 0, 2 π}]


1.98692 • Thanks. Really helpful. Am I correct in thinking that only your third method depends on the curl = 0, in which you can use an arbitrary curve. Looks like you used the actual curve in first two methods. Right/ – Abcderia Dec 16 '20 at 5:27
• Can I ask for the understanding of method two. What does the /. symbole mean and how does it relate to "Thread"? Then there is a ". D[{Cos........" How does that derivative operator, D, fit into your syntax? – Abcderia Dec 16 '20 at 5:46
• @user27847 for example, {x+y,x-y}/.{x->p,y->q} and {x+y,x-y}/.Thread[{x,y}->{p,q}] get {p+q,p-q} . – cvgmt Dec 16 '20 at 7:36