POV-Ray Raytracer descriptions by Friedrich A. Lohmueller
    deutsche Version

system of coordinates grids overview back to tutorials overview

Visualization of Mathematical Functions
in a System of Coordinates

Classical plotting of mathematical functions presentated with POV-Ray

Objects:    "plane, cylinder, cone, sphere"
Methods: "color_map, layered textures, #macro, #while"

For the visualization of mathematical functions we take the squared plane with coordinate 2d axes as a background. For getting a quadratic field of view we have to use a resolution like
[600x600, No AA, mosaic]
width="600" 
height="60" 0
Antialias=Off
+SP16
+B1024
in our quickres.ini file for povray.

For plotting a funktion like "f(x) = 0.5*x + 3" we use small spheres added together by a while loop:
#declare Ball1 = 
 sphere{ <0,0,0>,0.025 
         translate<0,0,-0.015>
	 texture{ pigment{color rgb<1.0, 0.65, 0.0>}
                 finish {ambient 0.15 diffuse 0.85 phong 1}
               } // end of texture
       } // end of sphere

union{ 
 #declare X   = -5.5; // start X    attention: x != X
 #declare EndX = 5.5; // end   X    
 #while ( X < EndX ) 

   object{Ball1 translate< X,0.5*X+3, 0>} 

 #declare X = X + 0.001;  // next Nr
 #end // --------------- end of loop 
} // end of union
//--------------------------------------------------- end
Attention: Write "X" (capital!) and not "x".
( "x" is a reserved keyword abbreviation for the vector "<1,0,0;>"!)
POVRay version 3.1, 3.5:
Write "X*X" for "x2", or "(X-2)*(X-2)*(X-2)" for "(x-2)3".

 
If we want to plott a function with terms in which a division by zero error meight occur, we have to prevent the loop from this error by an #if statement. Sample:

union{ 
 #declare X   = -5.5; // start X    attention: x != X
 #declare EndX = 5.5; // end   X    
 #while ( X < EndX ) 

  #if ( (X - 2 != 0) )
  object{Ball5 translate< X, 1/4*3/(X-2)-3, 0>}
  #end
 #declare X = X + 0.001;  // next Nr
 //  enhance this value to i.e. X + 0.005 if you have not enough RAM!
 #end // --------------- end of loop 
} // end of union
//--------------------------------------------------- end
Mathematical functions - 1:
Sample mathematical functions 700x700

Mathematical functions - 2:
Sample mathematical functions 700x700

Mathematical functions - 3:
Sample mathematical functions 700x700

Mathematical functions - 4:
Sample mathematical functions 700x700
Mathematical functions - 5:
Sample mathematical functions 700x700
Mathematical functions - 6:
Sample mathematical functions 700x700

Description of mathematical functions - scenery file for POV-Ray:
sample 1
sample 2
sample 3
sample 4
sample 5
sample 6



system of coordinates grids overview back to tutorials overview
        Besucher: counter
since 08-May-1999.   Thanks for your visit!

© Friedrich A. Lohmüller, 2003     email email: (legacy email redacted)