Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Partial differentiation Date: Fri, 17 Dec 2010 04:19:20 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 32 Message-ID: <ieeoc8$mit$1@fred.mathworks.com> References: <iebrc7$17f$1@fred.mathworks.com> <iedsbg$j7r$1@fred.mathworks.com> <ieehar$md1$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-02-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1292559560 23133 172.30.248.37 (17 Dec 2010 04:19:20 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Fri, 17 Dec 2010 04:19:20 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:696253 "Dean " <dchesterfield@hotmail.com> wrote in message <ieehar$md1$1@fred.mathworks.com>... > Thanks for your feedback Roger. > > You are correct, I did make an error in stating "F(x), R^3-->R", as F does not map all of R^3 to R, just the subset of (x,y,z) that satisfies the constraints x+y+z=1 and x>=0, y>=0, z>=0. The x, y and z in my case represent mole fractions in a liquid, hence the constraints. > > I understand that because of the constraints, the domain of valid coordinates is a two-dimensional plane, and therefore only two independent variables are required to define position in the plane. In my case, I just use x and y to define position, and when in future I work out Grad(F), I will just use the first two elements, ie. 2D gradient given by (dF/dx,dF/dy). > > My main problem lay in the actual evaluation of dF/dx and dF/dy. F is a function in x, y and z. So in the process of evaluating the partial derivative of F with respect to x, say, I come across a term in F which contains y or z, and am faced with the question of "What does dy/dx and dz/dx equal?". Do they equal 0, or because of the constraint x+y+z=1, do they equal -1? > > I appreciate the time you have taken to reply to my post. > > Dean - - - - - - - - - - - Your statement that "F is a function in x, y and z" would seem to hint that you might actually have a relationship between F and the quantities x, y, and z that makes sense even when their sum is not restricted to 1. If that is the case, you might be able to make a sensible evaluation of the 3D gradient [dF/dx,dF/dy,dF/dz] which temporarily ignores that constraint. The main point of what I was trying to tell you earlier is that however you define a planar set of coordinates, if they preserve the metric of the original x,y,z metric, then the 2D gradient using those coordinates will always be just the orthogonal projection of the 3D gradient. In other words you don't need to invent a set of planar coordinates and take their partial derivatives to get such a 2D gradient. Just project the known 3D gradient orthogonally onto the plane. It is a natural way to obtain a 2D gradient from a 3D gradient. For your constraint this is particularly easy to do. If your 3D gradient is [Fx,Fy,Fz], then the projected 2D gradient is simply [(2*Fx-Fy-Fz)/3,(2*Fy-Fz-Fx)/3,(2*Fz-Fx-Fy)/3] (1) It is easy to show that this is a vector parallel to the plane since the sum of its components is zero, which is to say that it is orthogonal to the plane's particular normal direction. Formula (1) comes from the general formula for orthogonal projection of a vector onto a plane: Vp = V - dot(N,V)*N (2) where N is a unit normal vector to the plane, V is the vector to be projected onto the plane, and Vp is its projection within the plane. In your case V = [Fx,Fy,Fz] and N = [1/sqrt(3),1/sqrt(3),1/sqrt(3)] which quickly lead to formula (1). It seems to me that arbitrarily selecting x and y as your independent variables and restricting z to 1-x-y might tend to bias the resulting gradient by that particular molar fraction selection. Choosing a different pair of fractions could give different results. Roger Stafford