Formula plotting-drawings

From Algebra.Com's Help
Jump to: navigation, search

Drawings are useful in a variety of mathematical contexts. For example, they are useful in geometry or solving various word problems. They are indispensable in physics.

Conceptually, a drawing as it could be done on this site is a picture with defined dimensions, virtual coordinate system, and one or more elements placed on the virtual coordinates.

Drawings are defined as a drawing() function:

 drawing( 300, 300, 
          0, 10,
          0, 10,
          red( circle( 5, 5, 3 ) ),
          locate( 5, 5, X )
 )

The arguments to drawing() are:

  • x and y dimensions in pixels
  • xmin, xmax, ymin and ymax coordinates of the virtual coordinate system. Point (xmin, ymin) is the left lower corner, and point (xmax, ymax) is the right upper corner.
  • one or (usually) several graphical elements.

The following elements are defined now:

  • line( x1, y1, x2, y2 ) -- draws a line
  • circle( x1, y1, r ) -- draws a circle
  • ellipse( x, y, Rx, Ry ) -- draws an ellipse in center (x, y) and radii Rx and Ry
  • arc( x, y, Rx, Ry, from, to ) -- draws an arc -- a fragment of an ellipse in center (x, y) and radii Rx and Ry, from "from" degree to "to" degrees of arc (360 drgeees in complete arc)

You can also place elements such as Sprite (picture), as well as regular math formulae onto the coordinate system. The two functions for doing so are:

  • locate( x, y, expression ) -- locates the left upper corner of expression in point x, y
  • locate_center( x, y, expression ) - locates center of the expression in point x, y.