Home > Functions Math -> Implicit Functions



EXAMPLES ON MY SAGE PAGE: Implicit Functions 2D and 3D Plot


  • An implicit function is a function that is not solved explicitly for one of its variables.
    • A circle is an example of a 2d implicit function: $x^2+y^2=9$.
    • An ellipsoid is an example of a 3d implicit function: $x^2+4y^2+9z^2=36$
  • In sage, you must use DOUBLE EQUALS == to define an implicit function!
  • See below (ex.2 and ex.4) how to define an object as an implicit function.

Define and plot a 2d implicit function

Step 1: Declare the variables - all of them
Step 2: Use implicit_plot directly with implicit function defined inside:
    implicit_plot(implicit function with double equals, (x,xmin, xmax),(y,ymin,ymax), 2d options)

or
Step 1: Declare the variables - all of them
Step 2: Define an object as the implicit function.
Step 3: Use implicit_plot with name of object.

Example 1 - circle $x^2+y^2=9$ and 2D plot

var ('x y')
implicit_plot(x^2+y^2==4, (x,-2,2), (y,-2,2), figsize=4, axes="true" )

Example 2 - $e^x=y^2$ and 2D plot (the blanks in the definition of the object imp are for clarity, but the code should work with or without them).

var ('x y')
imp= exp(x)==y^2
implicit_plot(imp, (x,-2,2), (y,-3,3), figsize=4, axes="true", aspect_ratio=1, linestyle="--")



Example 1

Example 2

implicit_plot1.png
blank15.png
implicit_plot2.png

Define and plot a 3d implicit function

Step 1: Declare the variables - all of them
Step 2: Use implicit_plot3d directly with implicit function defined inside:
    implicit_plot3d(implicit function with double equals, (x,xmin, xmax), (y,ymin,ymax), (z,zmin,zmax), 3d options)
or
Step 1: Declare the variables - all of them
Step 2: Define an object as the implicit function.
Step 3: Use implicit_plot3d with name of object.

Example 3 - ellipsoid $x^2+4y^2+9z^2=36$ and 3D plot

var ('x y z')
implicit_plot3d(x^2+4*y^2+9*z^2==36, (x,-6,6), (y,-6,6), (z,-6, 6), color="red", figsize=4, opacity=.3, axes="true" )

Example 4 - $e^x=y^2$ and the x-y plane in a 3D plot

var ('x y z')
imp= exp(x)+exp(y)==z^2
S1=implicit_plot3d(imp, (x,-2,2), (y,-3,3), (z,-4,4),color=(0,.6,0))
S2=implicit_plot3d(z==0, (x,-2,2), (y,-3,3), (z,-4,4),color=(0.6,0.6,0), opacity=0.3)
show(S1+S2, figsize=4, aspect_ratio=[1,1,1])



Example 3

Example 4

implicit_plot3.png
blank15.png
implicit_plot4.pngblank15.png
Keywords: functions, implicit, symbolic expressions, implicit_plot, implicit_plot3d