Re: Question on Integrate[ F . Dt[r], ?]
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: Question on Integrate[ F . Dt[r], ?]
- From: John Lee <lee at math.washington.edu>
- Date: Fri, 7 Feb 92 17:02:52 -0800
To compute a potential from a form such as u[x,y]Dt[x]+v[x,y]Dt[y], you need to integrate u w.r.t. x AND v w.r.t. y. More precisely, if V is the potential, set intu = Integrate[u,x] and intv = Integrate[v,y]. Start with the equations (1) D[V,x] = u (2) D[V,y] = v Integrating the first with respect to x, you get V = intu + f[y] (* the "constant of integration" can depend on y *) Then, differentiating w.r.t. y and using (2), v = D[V,y] = D[intu,y] + f'[y] Finally, integrating w.r.t. y and solving for f gives f[y] = intv - Int[ D[intu,y], y]. Plugging this in above, we get a formula for u. Of course, this only works if the vector field (u,v) is conservative, i.e. D[u,y] = D[v,x]. Here is a simple Mathematica function that implements this algorithm. In[1]:= Literal[Potential[ u_ Dt[x_] + v_ Dt[y_] ]] := Module[{intu,intv}, If[ Expand[D[u,y] - D[v,x] ] =!= 0, (*then*) Print[ "Error: ",u Dt[x] + v Dt[y]," is not conservative" ]; Return[Null], (*else*) intu = Integrate[u,x]; intv = Integrate[v,y]; Return[ intu + intv - Integrate[ D[ intu, y ], y]] ]]; In[2]:= Potential[x Dt[x] + y Dt[y]] 2 2 x y Out[2]= -- + -- 2 2 In[3]:= Potential[ x Dt[y] + y Dt[x]] Out[3]= x y In[4]:= Potential[ x y Dt[x] + y Dt[y]] Error: x y Dt[x] + y Dt[y] is not conservative In[5]:= dV = (x^2-y^2) Dt[x] - 2 x y Dt[y]; In[6]:= Potential[dV] 3 x 2 Out[6]= -- - x y 3 You can probably find a fuller explanation of the mathematics in any advanced calculus text. Jack Lee Dept. of Mathematics Univ. of Washington Seattle, WA