Re: How to plot divergence of gradient as contour plot
- To: mathgroup at smc.vnet.net
- Subject: [mg124029] Re: How to plot divergence of gradient as contour plot
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Fri, 6 Jan 2012 04:17:03 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
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>
- Follow-Ups:
- Re: How to plot divergence of gradient as contour
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: How to plot divergence of gradient as contour