MuPAD Pro Computing Essentials, 2nd Edition

Example 8.5 Class Implicit2d

In this example I show how to use the Implicit2d class with Contours parameter. This way, one implicit plot produces a family of curves.

ColFun := proc(x,y)
begin
   if x^2-y^2-1 <2 then 
      return(RGB::Red)
   elif x^2-y^2-1 <5 then 
      return(RGB::Blue)
   else 
      return(RGB::Green) 
   end_if
end:
 
R := 10:
 
H1 := plot::Implicit2d(
   x^2-y^2-1, x = -R..R, y = -R..R,
   Mesh = [5,5],
   Contours = [1,4,9],
   LineColorFunction = ColFun,
   LineWidth = 0.30
):
 
As1 := plot::Function2d(
    x, x = -R..R, 
    LineWidth = 0.50
):
 
As2 := plot::Function2d(
    -x, x = -R..R, 
    LineWidth = 0.50
):
 
plot(
   H1, As1, As2,
   Scaling = Constrained   
):

 

© Miroslaw Majewski, Abu Dhabi,  Update  26-10-2004