# 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:

• Nothing happens in the before or after loop code.
• The program does not animate. Note the stop command at the end of the loop code.
• The section of the x-axis over which the design is drawn is bounded by x1 and x2.
• The top and bottom line segment endpoint coordinates are given by y1 and y2.
• A for loop draws the design.
• The for loop runs the values for the variable x from the left bound to the right bound one unit at a time.
• It does this in the control section of the loop.
• A vertical line segment has the same x-coordinate for both of its endpoints.
• As the for loop runs this x-coordinate is held by the variable x.
• During each cycle of the for loop a vertical line is drawn at the new x-coordinate given by the variable x.

### The example program

0ptions

Go on input

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

Edit: Runtime          View: Starter Suggestion

To runtime:

Storage:

Editor width: Normal Wide

### Experiments

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)`

### And....

Next tutorial: The circle

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

### Other sites you may find interesting

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.

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.

Custom Search

Name:
Domain:

Name
0

Name:
Name
0