Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working with implicit functions in Mathematica

Can I plot and deal with implicit functions in Mathematica?

for example :-

x^3 + y^3 = 6xy

Can I plot a function like this?

like image 946
Omar Osama Avatar asked Jan 11 '12 22:01

Omar Osama


2 Answers

ContourPlot[x^3 + y^3 == 6*x*y, {x, -2.7, 5.7}, {y, -7.5, 5}]

Two comments:

  1. Note the double equals sign and the multiplication symbols.
  2. You can find this exact input via the WolframAlpha interface. This interface is more forgiving and accepts your input almost exactly - although, I did need to specify that I wanted some type of plot.

enter image description here

like image 132
Mark McClure Avatar answered Sep 21 '22 08:09

Mark McClure


Yes, using ContourPlot.

And it's even possible to plot the text x^3 + y^3 = 6xy along its own curve, by replacing the Line primitive with several Text primitives:

ContourPlot[x^3 + y^3 == 6 x y, {x, -4, 4}, {y, -4, 4}, 
 Background -> Black, PlotPoints -> 7, MaxRecursion -> 1, ImageSize -> 500] /. 
{
 Line[s_] :> 
 Map[
  Text[Style["x^3+y^3 = 6xy", 16, Hue[RandomReal[]]], #, {0, 0}, {1, 1}] &, 
  s]
}

Mathematica graphics

Or you can animate the equation along the curve, like so:

res = Table[ Normal[
 ContourPlot[x^3 + y^3 == 6 x y, {x, -4, 4}, {y, -4, 4}, 
  Background -> Black, 
  ImageSize -> 600]] /. 
 {Line[s_] :> {Line[s], 
   Text[Style["x^3+y^3 = 6xy", 16, Red], s[[k]], {0, 0}, 
    s[[k + 1]] - s[[k]]]}},
  {k, 1, 448, 3}];

ListAnimate[res]

Mathematica graphics

like image 25
Arnoud Buzing Avatar answered Sep 18 '22 08:09

Arnoud Buzing