Coordinate Systems on a Line

The coordinates of a point on a line

Introduction

This lesson starts with a basic foundation,  the idea of a point on a line

Part 1   A simple number line

Labeled[

DynamicModule[{p1={-4,0},p2={-7,0},p3={0,0},p4={4,0}}, (*initial locations*)
loc1:=Locator[Dynamic[p1,(p1={#[[1]],0})&],None];
loc2:=Locator[Dynamic[p2,(p2={#[[1]],0})&],None];
loc3:=Locator[Dynamic[p3,(p3={#[[1]],0})&],None];
loc4:=Locator[Dynamic[p4,(p4={#[[1]],0})&],None];

(*locator location*)

Graphics[{
{Red,Opacity[0.5], PointSize[0.015], Point/@{{Dynamic[p1[[1]]],0}}},
loc1, (*put the locator above!*)
{Blue,Opacity[0.5], PointSize[0.015], Point/@{{Dynamic[p2[[1]]],0}}},
loc2, (*put the locator above!*)
{Green,Opacity[0.5], PointSize[0.015], Point/@{{Dynamic[p3[[1]]],0}}},
loc3, (*put the locator above!*)
{Magenta,Opacity[0.5], PointSize[0.015], Point/@{{Dynamic[p4[[1]]],0}}},
loc4 (*put the locator above!*)
}, 

PlotRange->{{-10,10}, {-2,2}}, 
Axes->{True, False},
Ticks->None,
AspectRatio->Automatic,
ImageSize->{1000, 200}]
],
Style["Points on a Line (drag to move)", Large, FontFamily->"Comic Sans MS"]
]

In this demonstration, we have 4 points located on a line.

You can click and drag to change the location of the points.

This isn’t very useful.

We can see where the points are, but there is no way to numerically describe where they are located .

Part 2  Add an origin

Labeled[

DynamicModule[{p1={-4,0},p2={-7,0},p3={0,0},p4={4,0}}, (*initial locations*)
loc1:=Locator[Dynamic[p1,(p1={#[[1]],0})&],None];
loc2:=Locator[Dynamic[p2,(p2={#[[1]],0})&],None];
loc3:=Locator[Dynamic[p3,(p3={#[[1]],0})&],None];
loc4:=Locator[Dynamic[p4,(p4={#[[1]],0})&],None];

(*locator location*)

Graphics[{
Text[Style[O, Large], {0,0}, {0,4}],
Line[{{0,-0.2},{0,0.2}}],
{Red,Opacity[0.5], PointSize[0.015], Point/@{{Dynamic[p1[[1]]],0}}},
loc1, (*put the locator above!*)
{Blue, Opacity[0.5],PointSize[0.015], Point/@{{Dynamic[p2[[1]]],0}}},
loc2, (*put the locator above!*)
{Green,Opacity[0.5], PointSize[0.015], Point/@{{Dynamic[p3[[1]]],0}}},
loc3, (*put the locator above!*)
{Magenta,Opacity[0.5], PointSize[0.015], Point/@{{Dynamic[p4[[1]]],0}}},
loc4 (*put the locator above!*)


}, 

PlotRange->{{-10,10}, {-2,2}}, 
Axes->{True, False},
Ticks->None,
AspectRatio->Automatic,
ImageSize->{1000, 200}]
],
Style["Points on a Line", Large, FontFamily->"Comic Sans MS"]
]

We can improve our system by adding an origin.

An origin is a fixed reference to measure from.

Almost always at 0,  often labeled with O

This is still not very useful.

We can describe the location of a point by saying  “ right of the origin”  or “left of the origin”,  but this still isn't enough to describe the location of a point precisely.

Part 3  Add a scale

Labeled[


DynamicModule[{p1={-4,0},p2={-7,0},p3={0,0},p4={4,0}}, (*initial locations*)

Manipulate[

loc1:=Locator[Dynamic[p1,(p1={If[grid===Integer,Round[#[[1]]],#[[1]]],0})&],None];
loc2:=Locator[Dynamic[p2,(p2={If[grid===Integer,Round[#[[1]]],#[[1]]],0})&],None];
loc3:=Locator[Dynamic[p3,(p3={If[grid===Integer,Round[#[[1]]],#[[1]]],0})&],None];
loc4:=Locator[Dynamic[p4,(p4={If[grid===Integer,Round[#[[1]]],#[[1]]],0})&],None];

(*locator location*)

Graphics[{
Text[Style[O, Large], {0,0}, {0,4}],
Line[{{0,-0.2},{0,0.2}}],
{Red,Opacity[0.5], PointSize[0.015], 
Point/@{{Dynamic[p1[[1]]],0}}},
loc1, (*put the locator above!*)
{Blue,Opacity[0.5], PointSize[0.015], 
Point/@{{Dynamic[p2[[1]]],0}}},
loc2, (*put the locator above!*)
{Green,Opacity[0.5], PointSize[0.015], 
Point/@{{Dynamic[p3[[1]]],0}}},
loc3, (*put the locator above!*)
{Magenta,Opacity[0.5], PointSize[0.015], 
Point/@{{Dynamic[p4[[1]]],0}}},
loc4, (*put the locator above!*)

If[Location,
(
{Text[Dynamic[p1[[1]]],{Dynamic[p1[[1]]],0.5},Background->Lighter[Yellow,.7]],
Text[Dynamic[p2[[1]]],{Dynamic[p2[[1]]],0.5},Background->Lighter[Yellow,.7]],
Text[Dynamic[p3[[1]]],{Dynamic[p3[[1]]],0.5},Background->Lighter[Yellow,.7]],
Text[Dynamic[p4[[1]]],{Dynamic[p4[[1]]],0.5},Background->Lighter[Yellow,.7]]}), 
Black]

}, 

PlotRange->{{-10,10}, {-2,2}}, 
Axes->{True, False},
Ticks->{Range[-10,10,2],None},
AspectRatio->Automatic,
ImageSize->{1000, 200}]
,{{grid,Open,"Snap?"},{Open->"open",Integer->"integer"}},{{Location,False, "Location?"},{False,True}}, ControlPlacement->Left, TrackedSymbols->{grid, Location}]],
Style["Points on a Line", Large, FontFamily->"Comic Sans MS"]
]

The addition of a scale is the final step required to describe the location of a point.

The scale establishes a distance from the origin.

The resolution (number of divisions on the line) will determine how accurately we can describe the location of a point.

In this demonstration the “open” and “integer” buttons control the snap.

I.E.   
if you select open,  you can drag the points anywhere on the line
selecting integer snaps the points to locations with "integer" coordinates

Part 4  Increasing resolution

Increasing the resolution helps to more accurately locate a point,  but there will be compromises with clutter as the number line displays more and more information.

Labeled[


DynamicModule[{p1={-4,0},p2={-7,0},p3={0,0},p4={4,0}}, (*initial locations*)

Manipulate[

loc1:=Locator[Dynamic[p1,(p1={If[grid===Integer,Round[#[[1]]],#[[1]]],0})&],None];
loc2:=Locator[Dynamic[p2,(p2={If[grid===Integer,Round[#[[1]]],#[[1]]],0})&],None];
loc3:=Locator[Dynamic[p3,(p3={If[grid===Integer,Round[#[[1]]],#[[1]]],0})&],None];
loc4:=Locator[Dynamic[p4,(p4={If[grid===Integer,Round[#[[1]]],#[[1]]],0})&],None];

(*locator location*)

Graphics[{
Text[Style[O, Large], {0,0}, {0,4}],
Line[{{0,-0.2},{0,0.2}}],
{Red,Opacity[0.5], PointSize[0.015], 
Point/@{{Dynamic[p1[[1]]],0}}},
loc1, (*put the locator above!*)
{Blue,Opacity[0.5], PointSize[0.015], 
Point/@{{Dynamic[p2[[1]]],0}}},
loc2, (*put the locator above!*)
{Green,Opacity[0.5], PointSize[0.015], 
Point/@{{Dynamic[p3[[1]]],0}}},
loc3, (*put the locator above!*)
{Magenta,Opacity[0.5], PointSize[0.015], 
Point/@{{Dynamic[p4[[1]]],0}}},
loc4, (*put the locator above!*)

If[Location,
(
{Text[Dynamic[p1[[1]]],{Dynamic[p1[[1]]],0.5},Background->Lighter[Yellow,.7]],
Text[Dynamic[p2[[1]]],{Dynamic[p2[[1]]],0.5},Background->Lighter[Yellow,.7]],
Text[Dynamic[p3[[1]]],{Dynamic[p3[[1]]],0.5},Background->Lighter[Yellow,.7]],
Text[Dynamic[p4[[1]]],{Dynamic[p4[[1]]],0.5},Background->Lighter[Yellow,.7]]}), 
Black]

}, 

PlotRange->{{-10,10}, {-2,2}}, 
Axes->{True, False},
Ticks->{Range[-10,10,20/divs],None},
AspectRatio->Automatic,
ImageSize->{1000, 200}]
,
{{grid,Open,"Snap?"},{Open->"open",Integer->"integer"}},{{Location,False},{False,True}},
{{divs, 10, "Divisions"}, {2,4,5,10,20,40}},
ControlPlacement->Left]],
Style["Points on a Line", Large, FontFamily->"Comic Sans MS"]
]

Summary

Locating a point on a line requires:

•	a direction (almost always increasing from left to right)
•	an origin,  O, located at 0
•	a scale

The coordinate  of any point P  to the right of the origin is the distance between O  and  P

The coordinate  of any point P  to the left of the origin is the negative of the distance between O  and  P

Example problem 1

What is the coordinate of the point shown below  (it is a whole number)

p1 = 7;
xmin = -10;
xmax = 10;
divs  = 4;


Graphics[{
Text[Style[O, Large], {0,0}, {0,4}],
Line[{{0,-0.2},{0,0.2}}],
{Red, PointSize[0.015], Point[{p1,0}]}
}, 

PlotRange->{{xmin,xmax}, {-2,2}}, 
Axes->{True, False},
Ticks->{Range[xmin,xmax,(xmax-xmin)/divs],None},
AspectRatio->Automatic,
ImageSize->{1000, 200}]

A solution

It’s less than half the distance between 5 and 10,  but certainly more than 6,   the point has a coordinate of 7

Example problem 2

Give a reasonable estimate for the coordinate of the point shown below  (it is a whole number)

p1 = -27;
xmin = -30;
xmax = 30;
divs  = 4;


Graphics[{
Text[Style[O, Large], {0,0}, {0,4}],
Line[{{0,-0.2},{0,0.2}}],
{Red, PointSize[0.015], Point[{p1,0}]}
}, 

PlotRange->{{xmin,xmax}, {-2,2}}, 
Axes->{True, False},
Ticks->{Range[xmin,xmax,(xmax-xmin)/divs],None},
AspectRatio->Automatic,
ImageSize->{1000, 200}]

A solution

A reasonable estimate would be -26  to  -28 .

The location I used was -27

The farther apart the divisions, the less accurate of an estimate can be made.

Example problem 3

Give a reasonable estimate for the coordinate of the point shown below  (it is a whole number)

p1 = -11;
xmin = -16;
xmax = 16;
divs  = 4;


Graphics[{
Text[Style[O, Large], {0,0}, {0,4}],
Line[{{0,-0.2},{0,0.2}}],
{Red, PointSize[0.015], Point[{p1,0}]}
}, 

PlotRange->{{xmin,xmax}, {-2,2}}, 
Axes->{True, False},
Ticks->{Range[xmin,xmax,(xmax-xmin)/divs],None},
AspectRatio->Automatic,
ImageSize->{1000, 200}]

A solution

It looks a bit less than half the distance between -8  and  -16.

So just less than -12

The location I used was -11