Solution

> r_i,r_f;

[2, 2, 1], [-2, 0, 1]

> r_1:=[2,-2,1];

r_1 := [2, -2, 1]

> r_tp1:=evalm(r_i+(r_1-r_i)*t);

r_tp1 := vector([2, 2-4*t, 1])

> r_2:=[-2,-2,1];

r_2 := [-2, -2, 1]

> v_tp1:=map(diff,r_tp1,t);

v_tp1 := vector([0, -4, 0])

> r_tp2:=evalm(r_1+(r_2-r_1)*t);

> v_tp2:=map(diff,r_tp2,t);

r_tp2 := vector([2-4*t, -2, 1])

v_tp2 := vector([-4, 0, 0])

> r_tp3:=evalm(r_2+(r_f-r_2)*t);

> v_tp3:=map(diff,r_tp3,t);

r_tp3 := vector([-2, -2+2*t, 1])

v_tp3 := vector([0, 2, 0])

Now we are ready to calculate the work integral.

> Work1:=int(dotprod(subs(x=r_tp1[1],y=r_tp1[2],z=r_tp1[3],F),v_tp1),t=0..1);

Work1 := 4

> Work2:=int(dotprod(subs(x=r_tp2[1],y=r_tp2[2],z=r_tp2[3],F),v_tp2),t=0..1);

Work2 := 44/3

> Work3:=int(dotprod(subs(x=r_tp3[1],y=r_tp3[2],z=r_tp3[3],F),v_tp3),t=0..1);

Work3 := 4

> evalf(Work1+Work2+Work3);

22.66666667

>