EZ Math Movie, Tutorials, Designs, Patterned Points and Line Segments

One step at a time across the x-axis

Here we are going to draw a group of vertical lines across the (x, y) graph using a loop. We will start at the left where x = -9 and draw a vertical line there. Then we will move over one unit to the right where x = -8 and draw another vertical line. We will continue looping till we get to x = 9. At that position we will draw a vertical line and quit the loop.

Running the example program

Be sure to note the following:

The example program

Angle measurement: Degrees Radians

Go on input

Sorry, apparently this browser does not support HTML 5 canvas tag graphics.

Edit: Runtime          View: Starter Suggestion

To runtime:


Editor width: Normal Wide








Try drawing over a different extent of the x-axis. Do this by changing the values for x1 and x2. For example, this would draw the line segments only on the right side of the graph:

x1 = 1;
x2 = 9;

Try drawing shorter line segments by changing y1 and y2, perhaps like this:

y1 = -2;
y2 =  2;

Make the line segments closer together or farther apart. This would be done by changing the control statement of the for loop. Here is the start of a for loop that would make many more line segments and place the them much closer to one another:

for(x = x1; x <= x2; x += 0.25)


Next tutorial: The circle


Here are some links to related articles at EZ Programing Demos:

Patterned points

Patterned lines

All contents of EZ Math Movie are copyrighted: Copyright 2011, Edward A. Zobel. All rights reserved.

Other sites you may find interesting

Zona Land Education Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner.

Here is the link: zonalandeducation.com

EZ Programing Demos Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.

Here is the link: ezprogramingdemos.com

Custom Search