Color Contour Plots for Varying Gamma Values in a Simple Equation

  • Context: Mathematica 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Color Plots
Click For Summary

Discussion Overview

The discussion revolves around generating color contour plots for varying values of the parameter ##\gamma## in a specific mathematical equation. Participants explore methods for visualizing these plots using software tools, focusing on the representation of different gamma values with distinct colors.

Discussion Character

  • Technical explanation
  • Exploratory

Main Points Raised

  • One participant inquires about how to assign different colors to contour plots for various gamma values.
  • Another participant provides a link to a resource that may assist with color functions in contour plotting.
  • A third participant suggests a method to manually create contour plots for each gamma value, detailing a function and showing how to apply different colors to each plot.
  • A participant expresses gratitude for the suggestions and indicates a willingness to share further findings if a more efficient method is discovered.

Areas of Agreement / Disagreement

There is no consensus or disagreement noted, as participants are sharing methods and resources without contesting each other's contributions.

Contextual Notes

Participants have not specified any limitations or assumptions regarding the mathematical model or the plotting software being used.

Who May Find This Useful

This discussion may be useful for individuals interested in mathematical visualization, particularly those working with contour plots in relation to varying parameters in equations.

member 428835
Hi PF!

I'm wondering if anyone knows how to make each plot for ##\gamma## a different color. What I have so far is
Code:
\[Gamma] = {0.01, 0.05, 0.1, 0.5, 1, 2};
ContourPlot[(1 + 2 \[Gamma]) \[Sigma]^2 +
   4 \[Gamma] Cos[k\[CapitalDelta]x] \[Sigma] - (1 - 2 \[Gamma]) ==
  0, {k\[CapitalDelta]x, 0, \[Pi]}, {\[Sigma], -1, 1},
 FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"}]
 
Physics news on Phys.org
I don't know a neat way to condense it, but you can do it "by hand" using
Code:
f[\[Gamma]_,
  k\[CapitalDelta]x_, \[Sigma]_] := (1 + 2 \[Gamma]) \[Sigma]^2 +
  4 \[Gamma] Cos[k\[CapitalDelta]x] \[Sigma] - (1 - 2 \[Gamma])

Show[ContourPlot[
  f[0.01, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Black],
ContourPlot[
  f[0.05, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Orange],
ContourPlot[
  f[0.1, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Green],
ContourPlot[
  f[0.5, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Yellow],
ContourPlot[
  f[1, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Red],
ContourPlot[
  f[2, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Blue]]
 
Thank you both; I'll post if I find a quicker way.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K