Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7607

Re: How to plot divergence of gradient as contour plot

From Alexei Boulbitch <Alexei.Boulbitch@iee.lu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to plot divergence of gradient as contour plot
Date 2012-01-06 09:19 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <je6ea9$q9b$1@smc.vnet.net> (permalink)

Show all headers | View raw


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@iee.lu<mailto:alexei.boulbitch@iee.lu>





Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: How to plot divergence of gradient as contour plot Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2012-01-06 09:19 +0000

csiph-web