<< Chapter < Page | Chapter >> Page > |
My version of the script is shown in Listing 1.
Listing 1 . Exercise on scale factors |
---|
<!-- File JavaScript01.html --><html><body><script language="JavaScript1.3">//Do the computations
var origLine = 100var lineA = 2 * origLine
var lineB = (25/100) * origLinevar lineC = (1 + 25/100) * origLine
var lineD = (1 - 25/100) * origLine//Display the results
document.write("Original line = "+ origLine + "</br>")
document.write("A = " + lineA + "</br>")
document.write("B = " + lineB + "</br>")
document.write("C = " + lineC + "</br>")
document.write("D = " + lineD + "</br>")</script></body></html> |
Screen output
When you copy the code from Listing 1 into an html file and open the file in your web browser, the output text shown in Figure 1 should appear in yourbrowser window.
Figure 1 . Screen output for Listing #1. |
---|
Original line = 100
A = 200B = 25
C = 125D = 75 |
Note that although they sound similar, specifications B and D above don't mean the same thing.
We talk about increasing or changing a value by some factor because we can often simplify a problem by thinking in terms of proportions.
A symbol for proportionality
Physics textbooks often use a character that doesn't appear on a QWERTY keyboard to indicate "is proportional to." That character isprobably not in the vocabulary of typical screen readers and is probably not compatible with Braille displays.
I will use a "$" character for that purpose because:
For example, I will write A $ B to indicate that A is proportional to B.
When we say that A is proportional to B, or
A $ B
we mean that if B increases by some factor, then A must increase by the same factor.
Circumference of a circle
Let's illustrate what we mean with a couple of examples. For the first example, we will consider the circumference of a circle. Hopefully, you know that thecircumference of a circle is given by the expression:
C = 2 * PI * r
where:
From this expression, we can conclude that
C $ r
If we modify the radius...
If we double the radius, the circumference will also double. If we reduce the radius by 25-percent, the circumference will also be reduced by 25-percent. Thisis illustrated by the script in Listing 2.
Listing 2 . Circumference is proportional to radius. |
---|
<!-- File JavaScript02.html --><html><body><script language="JavaScript1.3">var r = 10
var C = 2 * Math.PI * rdocument.write("r =" + r +
", C = " + C + "</br>")
//Multiply r by 2. Then display r and Cr = r * 2
C = 2 * Math.PI * rdocument.write("r =" + r +
", C = " + C + "</br>")//Reduce r by 25%, Then display r and C
r = r * (1 - 25/100)C = 2 * Math.PI * r
document.write("r =" + r +", C = " + C + "</br>")</script></body></html> |
Output from the script
When you open the script shown in Listing 2 in your browser, the text shown in Figure 2 should appear in your browser window.
Notification Switch
Would you like to follow the 'Accessible physics concepts for blind students' conversation and receive update notifications?