We know from theory that a vector field is conservative if there exists a function
such that
. Further, we know that fields defined on suitably nice regions are conservative if they are irrotational.
We can check whether a field is conservative with the curl function in the vect package. For example, let's check the field
.
Since the curl is not zero, the field is not conservative. How about
Since the curl is zero, this field is conservative. So the function satisfying
exists. We can find the scalar potential
in Maxima with the potential function (also in the vect package).
Note, however, that because of a bug in Maxima at the time of this writing we need to do a little fancy footwork. We cannot use the letter x in the function call; instead we will change it to another letter. When we do that, we must follow it by a call to scalefactors.
We can easily check that
satisfies
. The fundamental theorem for line integrals now allows us to compute line integrals that look like
All of the above can be done in three dimensions, too. We need only to do scalefactors([x,y,z]) and scalefactors([u,v,w]), when appropriate.
G. Jay Kerns 2009-12-01