This is a how to question --- the example is without importance. I want to manipulate the plot of say a x^2 + b y^2 for (a,b) belonging to a specific set, but a + b > 0. Is it possible to make appear the sum a+b at a specific position in the plot ?

  • $\begingroup$ Notihing I have no idea how to begin. I know how to dispose two image side by side with Row but I don't know how to do what I want. $\endgroup$ – cyrille.piatecki Apr 27 '16 at 7:12

I am posting the answer based on taking the phrase "the example is without importance" on face value (i.e. not a homework or similar).

I am not exactly I understand the aim.

So, with these caveats and to motivate clarification:

f[a_, b_, x_, y_] := {a, b}.{x^2, y^2} /; a + b > 0
f[a_, b_, x_, y_] := Null
   Row[{"a+b= ", a + b}, BaseStyle -> {FontFamily -> "Arial", 20}],
   Row[{ContourPlot[Evaluate@f[a, b, x, y], {x, -1, 1}, {y, -1, 1}, 
      PerformanceGoal -> "Quality", ImageSize -> 300],
     Plot3D[Evaluate@f[a, b, x, y], {x, -1, 1}, {y, -1, 1}, 
      MeshFunctions -> (#3 &), Mesh -> {{0.1, 0.2, 0.5}}, 
      MeshStyle -> Red, PerformanceGoal -> "Quality", 
      ImageSize -> 300]}]
   }, Alignment -> Center],
 {a, -1, 1, Appearance -> "Labeled"}, {b, -1, 1, 
  Appearance -> "Labeled"}]

enter image description here

  • $\begingroup$ Nearly what I was expecting but is it possible with a+b over the contour plot and if possible with --- Latex fonts $\endgroup$ – cyrille.piatecki Apr 27 '16 at 8:21
  • 1
    $\begingroup$ @cyrille.piatecki I am not sure whether you asking me a cosmetic change or if I misunderstand your aim. The contours are values of $a x^2+b y^2$. In either situation, I suggest you adapt the code above or just use it as a launching point for your own code. The best way to learn Mathematica is playing around. Good luck. :) $\endgroup$ – ubpdqn Apr 27 '16 at 8:25
  • $\begingroup$ The only thing is that I want the condition inside the plot. $\endgroup$ – cyrille.piatecki Apr 30 '16 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.