<< Chapter < Page | Chapter >> Page > |
NewWeight / BirthWeight = 2
where the slash character "/" indicates division.
Percentage increases
It is also common for us to talk about something increasing or decreasing by a given percentage value. For example, we might say that a colt increased itsweight by 50-percent in one year. This is equivalent to saying:
NewWeight = BirthWeight * (1 + 50/100)
This assumes that when evaluating a mathematical expression:
This is typical behavior for computer programs and spreadsheets, but not necessarily for hand calculators.
Percentage decreases
In my dreams, I might say that I went on a diet and my weight decreased by 25-percent in one year. This would be equivalent to saying:
NewWeight = OldWeight * (1 - 25/100)
Exercise on scale factors
Write a script that has the following behavior. Given a chalk line that is 100 inches long, draw other chalk lines that are:
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 your browser 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."
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
Notification Switch
Would you like to follow the 'Game 2302 - mathematical applications for game development' conversation and receive update notifications?