Re: How to plot divergence of gradient as contour plot

*To*: mathgroup at smc.vnet.net*Subject*: [mg124164] Re: How to plot divergence of gradient as contour plot*From*: Murray Eisenberg <murray at math.umass.edu>*Date*: Wed, 11 Jan 2012 04:26:54 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com

My issue is not that Div, Curl, Grad use a default coordinate system that's Cartesian and in which the variables are named Xx, Yy, and Zz. In fact, given the paradigm used for these functions, one is essentially forced to adopt such a convention lest the variables in these functions be confused with ordinary x, y, z which one may want to reserve for other purposes without interference. And that paradigm I fault is that Div, Curl, and Grad do not operate upon functions -- which are independent of coordinate systems -- but rather operate upon functional expressions of variables. That's what I indicated in my earlier post that you quote. On 1/10/12 6:00 AM, Szymon Roziewski wrote: > Hello once again, > > Thank you very much for your ideas! > I haven't used that package before, so it's new to me. > It's weird that Div, Grad, Curl don't operate on x,y,z but on Xx,Yy,Zz. > It seems to be a programmer trick. > > All best, > Szymon Roziewski > > 2012/1/6 Murray Eisenberg<murray at math.umass.edu> > >> You need to use the VectorAnalysis package (carefully!), remembering that: >> >> (i) the default coordinate system is Cartesian[Xx, Yy, Zz]; and >> (ii) the result of using that package's Grad, Div, Curl is _not_ >> really a "function" of the variables (more about this later). >> >> In your example: >> >> >> Div[Grad[Sin[Xx + Yy]]] >> -2 Sin[Xx + Yy] >> >> >> ContourPlot[ >> Div[Grad[Sin[Xx + Yy]]] /. {Xx -> x, Yy -> y}, >> {x, -5, 5}, {y, -5, 5}] >> >> (* or first define a function *) >> >> f[x_, y_] := Div[Grad[Sin[Xx + Yy]]] /. {Xx -> x, Yy -> y} >> ContourPlot[f[x, y], {x, -5, 5}, {y, -5, 5}] >> >> I find the whole paradigm of the VectorAnalysis package to be >> aggravatingly annoying. After all, from a mathematical perspective, if >> you're given a scalar-valued function with vector inputs, then its >> gradient is just a well-defined vector field -- and that has nothing >> whatsoever to do with so-called "coordinate systems". That is, one ought >> to be able to do something like this -- just like any standard modern >> text on multivariable calculus would show: >> >> phi[x_, y_] := Sin[x + y] >> Div[Grad[phi[x, y]]] >> >> In Mathematica, with the VectorAnalysis defaults, you'd get 0 as result >> there, since you didn't override the default variable names Xx, Yy, Zz. >> >> Then there's the whole nonsense of the gradient other coordinate >> systems. That, to my mind, is a very odd way to think about things. >> Mathematically, given a scalar field, it has an associated gradient >> vector field. Period. If you want to "express the gradient in terms of" >> another coordinate system, you're no longer finding that gradient; >> you're finding a composite of functions where you go first from that >> other coordinate system to cartesian coordinates, next take the >> gradient, and finally go back from cartesian coordinates in the result >> to the other coordinate system. >> >> (I trust others will disagree with the preceding argument!) >> >> >> On 1/5/12 6:00 AM, Szymon Roziewski wrote: >>> Hello there, >>> >>> I am concerning to plot something like that. >>> >>> ContourPlot[Divergence[Gradient[Sin[x + y]]], {x, -5, 5}, {y, -5, 5}] >>> >>> Plotting divergence of gradient scalar field. >>> How can I manage to do that? >> >> -- >> Murray Eisenberg murray at math.umass.edu >> Mathematics& Statistics Dept. >> Lederle Graduate Research Tower phone 413 549-1020 (H) >> University of Massachusetts 413 545-2859 (W) >> 710 North Pleasant Street fax 413 545-1801 >> Amherst, MA 01003-9305 >> >> > > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305

**Re: Memory usage of a Sierpinski triangle algorithm**

**How to create palette buttons with tooltips?**

**Re: How to plot divergence of gradient as contour**

**JordanDecompose[]**