The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Any way to get gradient lines as well as contour lines?
Replies: 4   Last Post: Feb 4, 2013 1:25 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Christopher O. Young

Posts: 182
Registered: 2/13/11
Re: Any way to get gradient lines as well as contour lines?
Posted: Feb 4, 2013 1:25 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Feb 3, 2013, at 2:18 PM, Bob Hanlon <> wrote:

> Grad[Sin[x + y^2], {x, y}]
> {Cos[x + y^2], 2*y*Cos[x + y^2]}
> Plot3D[Sin[x + y^2], {x, -Pi, Pi}, {y, -2, 2},
> MeshFunctions -> {
> Cos[#1 + #2^2] &,
> 2 #2 Cos[#1 + #2^2] &},
> Mesh -> {10, 20},
> PlotPoints -> 35]
> Bob Hanlon

Thanks, I'm getting the contour lines with this but the other mesh lines
aren't in general at right angles to the contour lines.

I'm wondering if the mesh complex functions could be used to get both
contour lines and gradient lines in some cases.

In the cases shown, though, they're not quite contours and gradients,
although they are conjugate sets of curves, i.e., at right angles to
each other.

$TrigFunctions =
Sin, Cos, Sec, Csc, Tan, Cot,
ArcSin, ArcCos, ArcSec, ArcCsc, ArcTan, ArcCot,

Sinh, Cosh, Sech, Csch, Tanh, Coth,
ArcSinh, ArcCosh, ArcSech, ArcCsch, ArcTanh, ArcCoth

plots = Table[
Abs[f[x + I y]],

{x, -2, 2}, {y, -2, 2},

MeshFunctions ->
Function @@@ {
{{x, y, z}, Re[f[x + I y]]},
{{x, y, z}, Im[f[x + I y]]}},

MeshStyle -> {Orange, Green},
PlotLabel -> f,
Ticks -> None

{f, $TrigFunctions}

Chris Young

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.