User Tools

Site Tools


howto:hambasics:sections:mathbasics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howto:hambasics:sections:mathbasics [2020/12/17 13:06] va7fihowto:hambasics:sections:mathbasics [2023/02/17 11:35] (current) – [Binary Numbers (Optional)] va7fi
Line 1: Line 1:
-~~NOTOC~~ 
- 
 ====== Metric Prefix ====== ====== Metric Prefix ======
  
Line 41: Line 39:
 |  1 000 000 =|10<sup>6</sup> |6 | |  1 000 000 =|10<sup>6</sup> |6 |
 </WRAP> </WRAP>
 +
 +If your math is a little rusty, notice how the exponent counts the number of zeros after the one (1 000 000 has 6 zeros so it's equal to 10<sup>6</sup>)
  
 For now, let's call the exponent a "bel" (not decibel yet).  For example: For now, let's call the exponent a "bel" (not decibel yet).  For example:
Line 69: Line 69:
 </WRAP> </WRAP>
  
-In addition to being more convenient to represent big numbers, decibels also allow us to multiply big (or small) numbers more easily by adding the dB instead.  For example, look at:+In addition to being more convenient to represent big numbers, decibels also allow us to <fc #ff0000>multiply</fc> big (or small) numbers more easily by <fc #ff0000>adding</fc> the dB instead.  For example, look at:
   * 100 x 1000 = 100,000   * 100 x 1000 = 100,000
  
-Notice how the exponents add here:+Let's write the same thing again in powers of 10:
   * 10<sup>2</sup> x 10<sup>3</sup> = 10<sup>5</sup>   * 10<sup>2</sup> x 10<sup>3</sup> = 10<sup>5</sup>
  
-So 100 <fc #ff0000>x</fc> 1000 is the same as saying 20 dB <fc #ff0000>+</fc> 30 dB = 50 dB.  That is, adding the dB representation of numbers, is the same as multiplying those numbers. Here's Dave explaining this in more details:+Notice that while the numbers are multiplying (100 x 1000), the exponents are adding (2 + 3).  So 100 <fc #ff0000>x</fc> 1000 is the same as saying 20 dB <fc #ff0000>+</fc> 30 dB = 50 dB.  That is, adding the dB representation of numbers, is the same as multiplying those numbers. 
 + 
 +Look back at the previous table; if you double the power, three times in a row: 
 +  * The final power is 2 x 2 x 2 = 8 times more powerful than the original. 
 +  * In terms of dB, we can instead add 3dB three times: 3dB + 3dB + 3dB = 9dB. 
 + 
 +Here's a quick exercise: Using only the table above, what is the dB representation of 4000? 
 +<hidden> 
 + 
 +A 4000 fold increase is the same as a 1000 fold followed by two doubling.  That is: 
 +  * 1000 x 2 x 2 = 4000 
 + 
 +Which means: 
 +  * 30dB + 3dB + 3dB = 36dB 
 + 
 +Quick calculator check: 10<sup>3.6</sup> = 3981 ≈ 4000 
 + 
 +So the only thing to memorize with decibels is that: 
 +  * a bel (10 dB) is the number of zeros after the 1.  So that takes care of knowing 10dB, 20dB, 30dB, ... 
 +  * 3dB is one doubling. 
 + 
 +With these two things, we can now estimate a bunch of in between numbers like 36dB (30dB + 3dB + 3dB), or 13dB (10dB + 3dB) 
 +</hidden> 
 +\\ 
 + 
 +Here's Dave explaining this in more details:
  
 {{ youtube>3Dry9HUSkTo }} {{ youtube>3Dry9HUSkTo }}
Line 96: Line 121:
 </WRAP> </WRAP>
  
-I personally prefer the //implicit// definition because I find it easier to picture the dB in terms of powers of 10, where as I can't really picture the log function that well.  But these two formulations are equivalent, so use the one you like most.((These two definitions are the same because the log function is the inverse of the power function.  That is, it helps us find the exponent when we know the other quantities.  Mathematically, it is defined such that if \$a = 10^b\$, then \$b = \log(a) \$))+While the two are definitions are mathematically equivalent((These two definitions are equivalent because the log function is the inverse of the power function.  That is, it helps us find the exponent when we know the other quantities.  Mathematically, we say that\$a = 10^b \quad \Leftrightarrow \quad b = \log_{10}(a) \$))
 +I personally prefer the //implicit// definition because I find it easier to picture the dB in terms of powers of 10, where as I can't really picture the log function that well.  But they are equivalent, so use the one you like most.
  
  
Line 102: Line 128:
 A related measurement is the dBm.  While the decibel (dB) is a ratio between two quantities (saying "20 dB" is the same as saying "100 times more"), the dBm is a ratio between one quantity and 1 mW.  That is, it's a measures of how much stronger (or weaker) the power of something is compared to 1 milliwatt. A related measurement is the dBm.  While the decibel (dB) is a ratio between two quantities (saying "20 dB" is the same as saying "100 times more"), the dBm is a ratio between one quantity and 1 mW.  That is, it's a measures of how much stronger (or weaker) the power of something is compared to 1 milliwatt.
  
-For example, a typical fibre optic light signal to a house for internet has a light level of -15 dBm (or 0.03 mW)+For example, a typical fibre optic light signal to a house for internet has a light level of -16 dBm.  Before we go through the math, recall that 16 dB = 10 dB + 3 dB + 3 dB.  Which means, the ratio is 10 × 2 × 2 = 40.  Let's now see why -16 dBm is equal to a power of 25 μW (microwatts):
 <WRAP centeralign> <WRAP centeralign>
-\$$-15 \text{ dBm} = 10^{-1.5} \text{ mW} \approx 0.03 \text{ mW} \$$+\$$-16 \text{ dBm} = 1 \text{ mW} \div 10^{1.6 \approx 1 \text{ mW} \div 40 = 0.025 \text{ mW} = 25~\mu \text{W} \$$
 </WRAP> </WRAP>
  
-[[wavemodulation |{{/back.png }}]] [[codes |{{  /next.png}}]]+Notice how the minus sign in front of the dBm means that the power is less (not more) so it's divides (not multiply).
  
 +====== Binary Numbers ======
 +
 +===== Base 10 =====
 +It's kind of weird explaining how to count in base 10 because we're so used to it.  But to understand other bases, it helps to understand how base 10 really works first.
 +
 +So base 10 means we have 10 different symbols to represent numbers, and when we need more, we just add more digits to the number.  For example, let's count and pay close attention to what we're really doing:
 +
 +  * With one digit, we can count to nine because we have ten symbols: \$$0, 1, 2, 3, 4, 5, 6, 7, 8, 9\$$
 +
 +  * To continue past nine, we need to add a new digit in front of the "counting digit", and then we just do what we did above again: \$$10, 11, 12, 13, 14, 15, 16, 17, 18, 19\$$
 +
 +  * And that new digit will increase in the same way until we run out of symbols: \$$20, 21, 22, 23, 24, 25, 26, 27, 28, 29\$$     \$$ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39\$$    \$$\vdots \$$    \$$ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 \$$
 +
 +  * At which point we need to add a third digit (and so on).
 +
 +It's strange to think about this but the ability to count is completely separate from having a sense of how big the numbers are.  What I mean is: if you know how to change the symbols (from 0 to 1, and 1 to 2, and 2 to 3, etc) and how to add new digits (9 to 10, 99 to 100, ...) you can count forever without having a "number sense" In base 10, it's hard to imagine not knowing how big a number is, but we'll actually do this in base 2 in a moment.  You'll see, it's a weird feeling!
 +
 +But first, here's another weird way to think of numbers.  Take 234 for example.  Let's "decompose" it into its powers of 10:
 +
 +\begin{align*}
 +{\color{teal}{234}} &= {\color{teal}2}\times 100 + {\color{teal}3}\times 10 + {\color{teal}4}\times 1 \\
 +    &= {\color{teal}2}\times 10^2 + {\color{teal}3}\times 10^1 + {\color{teal}4}\times 10^0
 +\end{align*}
 +
 +This is a very tedious way of expressing a simple number, but I promise it'll be invaluable when we try to convert from base 2 to base 10 in a moment (can you think of why?).
 +
 +===== Base 2 =====
 +Now let's do the same thing again in base 2.  Imagine we only have two symbols we can use to count: 0 and 1.  Let's see what counting to thirteen looks like starting at zero:
 +
 +<WRAP centeralign>
 +0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101
 +</WRAP>
 +
 +Do you see the pattern?  Here's another way of writing it with leading zeros and keeping track of where we are in base 10:
 +<WRAP prewrap center 10em>
 +^Base 2 ^ Base 10 |
 +|0000   | 0       |
 +|0001   | 1       |
 +|0010   | 2       |
 +|0011   | 3       |
 +|0100   | 4       |
 +|0101   | 5       |
 +|0110   | 6       |
 +|0111   | 7       |
 +|1000   | 8       |
 +|1001   | 9       |
 +|1010   | 10      |
 +|1011   | 11      |
 +|1100   | 12      |
 +|1101   | 13      |
 +</WRAP>
 +
 +You see what I mean about being able to count without knowing how big the number is?  If we wanted, we could count to 1001010011010 and have no idea of how big that number is unless we kept track of it in base 10.  That's because over the years, we developed a number sense for base 10 numbers, but we didn't for base 2 numbers since we don't typically use them.
 +
 +===== Conversion =====
 +Now let's look at how to convert from one base to the other without counting.
 +
 +==== Base 2 to Base 10 ====
 +We'll use our example of 1101 in base 2 since we already know it's 13 in base 10.  Before we do this, however, let's use subscripts to denote the base.  For example, we'd write:
 +
 +\$$ 1101_2 = 13_{10} \$$
 +
 +Now let's see how we convert from base 2 to base 10 without counting.  In the same way that each position in base ten is a factor of 10, each position in base 2 is a factor of 2:
 +
 +\begin{align*}
 +{\color{teal}{1101}}_2 &= {\color{teal}1}\times 2^3 + {\color{teal}1}\times 2^2 + {\color{teal}0}\times 2^1 + {\color{teal}1}\times 2^0 \\
 +       &= {\color{teal}1}\times 8 + {\color{teal}1}\times 4 + {\color{teal}0}\times 2 + {\color{teal}1}\times 1 \\
 +       &= 8 + 4 + 0 + 1 \\
 +       &= 13_{10}
 +\end{align*}
 +
 +Let's try that again with the crazy number I mentioned earlier: 1001010011010.  Skipping the powers with a coefficient of 0 (to save space):
 +\begin{align*}
 +1001010011010_2 &= 2^{12} + 2^9 + 2^7 + 2^4 + 2^3 + 2^1 \\
 +&= 4096 + 512 + 128 + 16 + 8 + 2 \\
 +&= 4762_{10}
 +\end{align*}
 +
 +
 +==== Base 10 to Base 2 ====
 +Converting the other way around is a bit different, but kind of makes sense if you think about it.  Here are the steps to convert \$ 13_{10} \$ back to \$1101_2\$ and I'll explain a bit more after:
 +
 +<WRAP prewrap center 35em>
 +^ Division by 2 ^In Decimal ^As fraction           ^ Quotient ^ Remainder ^
 +|13÷2            | 6.5       |6 + \$\frac{1}{2}\$  | 6        | 1         |
 +|6÷2             | 3.0       |3 + \$\frac{0}{2}\$  | 3        | 0         |
 +|3÷2             | 1.5       |1 + \$\frac{1}{2}\$  | 1        | 1         |
 +|1÷2             | 0.5       |0 + \$\frac{1}{2}\$  | 0        | 1         |
 +</WRAP>
 +
 +Now we read the remainders from the bottom up: 1101.
 +
 +Recall that the remainder is what's left of a division; it's not the decimal portion.  For example:
 +
 +\begin{align*}
 +22 \div 5 &= 4.4 \\
 +          & 4 \tfrac{2}{5} \\
 +          & 4 \text{ remainder 2 (of 5)}
 +\end{align*}
 +
 +In our case, the remainder is what's left after we divided by 2.  So why does this method work?
 +
 +What we really want to do is decompose 13 into the sum of its powers of 2.  That is:
 +\begin{align*}
 +13_{10} &= \; 8 + 4 + 0 + 1 \\
 +        &= \; 2^3 + 2^2 + 0 + 2^0 \\
 +        &= (1 \quad \ \  1 \quad \ \ \, 0 \quad \ 1)_2
 +\end{align*}
 +
 +When we have a non-zero power of 2, we represent that position with a 1, when we have a zero power of 2, we write 0.
 +
 +What the table above is doing is systematically dividing by 2 to see if the result is a whole number or not.  If it is, it means that that position is 0 because the factor of two can be absorbed further up the chain.  For example, the fact that 13 ÷ 2 = 4.5 means that the first digit has to be 1.
 +
 +Let's look at a trivial example converting 2037 from base 10 to base 10 (trivial indeed!):
 +
 +<WRAP prewrap center 35em>
 +^ Division by 10 ^In Decimal   ^As fraction             ^ Quotient ^ Remainder  ^
 +|2037÷10         |203.7        |203 + \$\frac{7}{10}\$  | 203      | 7          |
 +|203÷10          |20.3         |20 + \$\frac{3}{10}\$   | 20       | 3          |
 +|20÷10           |2            |2 + \$\frac{0}{10}\$    | 2        | 0          |
 +|2÷10            |0.2          |0 + \$\frac{2}{10}\$    | 0        | 2          |
 +</WRAP>
 +
 +==== Other Bases? ====
 +There are other useful bases such as hexadecimal (base 16).  Here's an example of counting to twenty in hex:
 +<WRAP centeralign>
 +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, 13, 14
 +</WRAP>
 +
 +The convention to denote a hexadecimal number is to use either \$ 14_{16} \$ or 0x14.
 +
 +The same logic applies to convert between hexadecimal and base 10:
 +
 +\begin{align*}
 +\text{F61B}_{16} &= 15 \times 16^3 + 6 \times 16^2 + 1 \times 16^1 + 11 \times 16^0 \\
 +          &= 15 \times 4096 + 6 \times 256 + 1 \times 16 + 11 \\
 +          &= 63003_{10}
 +\end{align*}
 +
 +[[wavemodulation |{{/back.png }}]] [[codes |{{  /next.png}}]]
howto/hambasics/sections/mathbasics.1608239217.txt.gz · Last modified: 2020/12/17 13:06 by va7fi