[Date Index]
[Thread Index]
[Author Index]
Re: How to plot divergence of gradient as contour
*To*: mathgroup at smc.vnet.net
*Subject*: [mg124040] Re: How to plot divergence of gradient as contour
*From*: Murray Eisenberg <murray at math.umass.edu>
*Date*: Sat, 7 Jan 2012 05:16:20 -0500 (EST)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*References*: <201201060917.EAA26871@smc.vnet.net>
*Reply-to*: murray at math.umass.edu
So this proposed solution looks weird to me from a mathematical
perspective. In the definitions of grad and div, there's no 'x' or 'y'
on the left of the SetDelayed ( := ), yet both 'x' and 'y' appear on the
right.
The difficulty here is that the 'f' on the left is not a function (in
the mathematical sense) per se, but rather an "expression in x and y".
Surely there should be an easy way to represent in Mathematica grad and,
more generally, other differential (and more general) operators upon
functions, so that the result of something like grad[f] would be another
function.
Here's a start:
grad[phi_[x_, y_]] :=
{Derivative[1, 0][phi[x, y]], Derivative[0, 1][phi[x, y]]}
psi[x_, y_] := Sin[x + y]
grad[psi]
{Cos[#1 + #2] &, Cos[#1 + #2] &}
On 1/6/12 4:17 AM, Alexei Boulbitch wrote:
> Hi, Szymon,
>
> In principle there is a special package, VectorAnalysis for that, but in this case it may be faster to make it "by hands". If I understand you right, you would like to make 2D vector operations. Let us first define the 2D gradient and divergence:
>
> grad[f_] := {D[f, x], D[ f, y]};
>
> div[{f_, g_}] := D[f, x] + D[ g, y];
>
> and now define your function and plot. Try this:
>
> f = div[grad[Sin[x + y]]];
>
> ContourPlot[f, {x, -5, 5}, {y, -5, 5}]
>
> Hope this helps. Have fun. Alexei
>
> 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?
>
> Best regards,
>
> Szymon Roziewski
>
> Alexei BOULBITCH, Dr., habil.
>
> IEE S.A.
>
> ZAE Weiergewan,
>
> 11, rue Edmond Reuter,
>
> L-5326 Contern, LUXEMBOURG
>
> Office phone : +352-2454-2566
>
> Office fax: +352-2454-3566
>
> mobile phone: +49 151 52 40 66 44
>
> e-mail: alexei.boulbitch at iee.lu<mailto:alexei.boulbitch at iee.lu>
>
>
>
>
>
>
--
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
Prev by Date:
**Re: SortBy won't order irrationals**
Next by Date:
**FindFit for the 4-parameter beta distribution**
Previous by thread:
**Re: How to plot divergence of gradient as contour plot**
Next by thread:
**Re: How to plot divergence of gradient as contour plot**
| |