How to plot divergence of gradient as contour plot

Discussion in 'Mathematica' started by Szymon Roziewski, Jan 5, 2012.

  1. 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
    Szymon Roziewski, Jan 5, 2012
    1. Advertisements

  2. Szymon Roziewski

    wood43 Guest

    << VectorAnalysis`

    SetCoordinates[Cartesian[x, y, z]];

    ContourPlot[Evaluate[Div[Grad[Sin[x + y]]]], {x, -5, 5}, {y, -5, 5}]

    Div[Grad[Sin[x + y], Cartesian[x, y, z]]]
    wood43, Jan 6, 2012
    1. Advertisements

  3. Try this:

    SetCoordinates[Cartesian[x,y,z]] (*usual cartesian coordinates *)

    ContourPlot[[email protected]@Grad[Sin[x+y]],{x,-5,5},{y,-5,5}]

    You need to include Evaluate, dew to the way Plot works.
    Peter Breitfeld, Jan 6, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.