We start by loading the "linalg" package:
with(linalg):
Now let's define G and work out the line integral:
G:=vector([(1+x)*exp(x+y),x*exp(x+y)+2*z,-2*y]);
G := [(1 + x) exp(x + y), x exp(x + y) + 2 z, -2 y]
x:=(1-t)*exp(t);
x := (1 - t) exp(t)
y:=t;
y := t
z:=2*t;
z := 2 t
R:=vector([x,y,z]);
R := [(1 - t) exp(t), t, 2 t]
dR:=map(diff,R,t);
dR := [-exp(t) + (1 - t) exp(t), 1, 2]
dR:=map(simplify,dR);
dR := [-exp(t) t, 1, 2]
intgr1:=dotprod(G,dR);
intgr1 := (-1 - exp(t) + exp(t) t) exp(x + y) exp(t) t
+ exp(t) exp(x + y) - exp(t) exp(x + y) t + 4 t - 4 y
intgr1:=simplify(intgr1);
intgr1 := -2 t exp(exp(t) - exp(t) t + 2 t)
- t exp(exp(t) - exp(t) t + 3 t)
2
+ t exp(exp(t) - exp(t) t + 3 t) + exp(exp(t) - exp(t) t + 2 t)
Pretty horrendous looking!!!
int(intgr1,t=0..1);
-exp(1)
Nice simple answer though.
This confirms the answer obtained by using the potential method. Obviously the potential method is a whole lot easier than trying to evaluate the above horrendous integral by hand!