|
|
Line 1: |
Line 1: |
| [[Image:Binary logarithm plot.png|thumbnail|right|200px|Plot of log<sub>2</sub> ''n'']]
| | This is really important. If you make half-hearted efforts to get rid of fat, we are not truly going to succeed. So develop a strong determination, that this might be what you want plus you will do anything it takes to achieve your goal.<br><br>When I'm struggling to get rid of weight, I eat my last meal at 5:30pm thus, by the time 6pm rolls around, I've completed eating for the day. Stopping eating at 6pm gives the body time to burn the calories you've consumed during the day. But, if you eat following 6pm, most of those calories will likely not be burned off plus is turned into fat while we sleep. If you stop eating at 6pm, you'll even find you can eat slightly more during the day and nevertheless lose weight fast.<br><br>In regards to the quickest method to lose weight, rest is an often overlooked component. People simply talk about eating plus working out to lose weight. Not everybody ever claims sleeping is important for fat reduction. Yet somehow, this truly is one of the many crucial components inside the weight-loss equation.<br><br>First of all, various folks mistakenly think that HCG is only another fancy designer drug. In truth, HCG is a hormone that occurs naturally in all of the bodies. Whenever women are expecting, they have a quite large supply of this hormone. Because of this, whenever a woman takes a pregnancy test, if a certain concentration of HCG is found inside the circulation, then the female is considered positive for the test.<br><br>6 Eat vegetable soups and fish ready without fat, no salt, and [http://safedietplansforwomen.com/how-to-lose-weight-fast lose weight fast] no spices. This was how 1 celebrity lost a great 20-30 pounds. Fish is a better choice than red meat.<br><br>Ever wonder why Brazilians are perpetually slim? They seem to enjoy their traditional dish thus much which they have it with merely regarding every meal. The dish consists of rice plus beans that lowers the risk of gaining excess fat. The dish is high in fiber and low inside fat. Hence, the blood sugar levels are stabilized along with a beach-ready body is the final result. On the other hand, eating breakfast is a daily habit of 75 percent of Germans. Breakfast signifies whole-grain cereals, fruit and breads. Skipping breakfast has constantly been advised against by all nutritionists. So if you are into shedding pounds, you need to eat breakfast like the Germans.<br><br>You are able to adopt different kinds of diets like Atkins diet, low-carb diet, high-protein diet, etc., and include the above-mentioned foods inside your diet to gain maximum benefits. All the greatest with your endeavor! |
| | |
| In [[mathematics]], the '''binary logarithm''' (log<sub>2</sub> ''n'') is the [[logarithm]] to the [[Binary numeral system|base 2]]. It is the [[inverse function]] of ''n'' ↦ 2<sup>''n''</sup>. The binary logarithm of ''n'' is the power to which the number 2 must be raised to obtain the value ''n''. This makes the binary logarithm useful for anything involving [[powers of 2]], i.e. doubling. For example, the binary logarithm of 1 is 0, the binary logarithm of 2 is 1, the binary logarithm of 4 is 2, the binary logarithm of 8 is 3, the binary logarithm of 16 is 4 and the binary logarithm of 32 is 5.
| |
| | |
| ==Applications==
| |
| ===Information theory===
| |
| The binary logarithm is often used in [[computer science]] and [[information theory]] because it is closely connected to the [[binary numeral system]]. It is frequently written '''ld ''n''''', from [[Latin]] ''[[wikt:en:logarithmus#Latin|logarithmus]] [[wikt:en:dualis#Latin|duālis]]'', or '''lg ''n''''', although the [[ISO 31-11|ISO specification]] is that it should be '''lb (''n'')''', lg (''n'') being reserved for log<sub>10</sub> ''n''. The number of digits ([[bit]]s) in the binary representation of a positive integer ''n'' is the [[Floor and ceiling functions|integral part]] of 1 + lb ''n'', i.e.
| |
| | |
| :<math> \lfloor \operatorname{lb}\, n\rfloor + 1. \, </math> | |
| | |
| In information theory, the definition of the amount of [[self-information]] and [[information entropy]] involves the binary logarithm; this is needed because the unit of information, the bit, refers to information resulting from an occurrence of one of two equally probable alternatives.
| |
| | |
| ===Computational complexity===
| |
| The binary logarithm also frequently appears in the [[analysis of algorithms]]. If a number ''n'' greater than 1 is divided by 2 repeatedly, the number of iterations needed to get a value at most 1 is again the integral part of lb ''n''. This idea is used in the analysis of several [[algorithm]]s and [[data structure]]s. For example, in [[binary search]], the size of the problem to be solved is halved with each iteration, and therefore roughly lb ''n'' iterations are needed to obtain a problem of size 1, which is solved easily in constant time. Similarly, a perfectly balanced [[binary search tree]] containing ''n'' elements has height lb ''n'' + 1.
| |
| | |
| However, the running time of an algorithm is usually expressed in [[big O notation]], ignoring constant factors. Since log<sub>2</sub> ''n'' = (1/log<sub>''k''</sub> 2)log<sub>''k''</sub> ''n'', where ''k'' can be any number greater than 1, algorithms that run in ''O''(log<sub>2</sub> ''n'') time can also be said to run in, say, ''O''(log<sub>13</sub> ''n'') time. The base of the logarithm in expressions such as ''O''(log ''n'') or ''O''(''n'' log ''n'') is therefore not important.
| |
| In other contexts, though, the base of the logarithm needs to be specified. For example ''O''(2<sup>lb ''n''</sup>) is not the same as ''O''(2<sup>ln ''n''</sup>) because the former is equal to ''O''(''n'') and the latter to ''O''(''n''<sup>0.6931...</sup>).
| |
| | |
| Algorithms with running time ''n'' lb ''n'' are sometimes called [[linearithmic]]. Some examples of algorithms with running time ''O''(lb ''n'') or ''O''(''n'' lb ''n'') are:
| |
| | |
| *[[quicksort|average time quicksort]]
| |
| *[[binary search tree]]s
| |
| *[[merge sort]]
| |
| *[[Monge array]] calculation
| |
| | |
| === Single-elimination tournaments ===
| |
| | |
| In competitive games and sports involving two players/teams in each game/match, the binary logarithm indicates the number of rounds necessary in a [[single-elimination tournament]] in order to determine a winner. For example, a tournament of 4 players requires lb (4) or 2 rounds to determine the winner, a tournament of 32 teams requires lb (32) rounds, which is 5 rounds, etc. In this case, for n players/teams where n is not a power of 2, lb (n) is rounded up since it will be necessary to have at least one round in which not all remaining competitors play. For example, lb (6) is approximately 2.585, rounded up, indicates that a tournament of 6 requires 3 rounds (either 2 teams will sit out the first round, or one team will sit out the second round). | |
| | |
| ==Using calculators==
| |
| An easy way to calculate the log<sub>2</sub>(''n'') on [[calculator]]s that do not have a log<sub>2</sub>-function is to use the [[natural logarithm]] "ln" or the [[common logarithm]] "log" functions, which are found on most "scientific calculators". The specific [[Logarithm#Change_of_base|change of logarithm base]] [[formulae]] for this are:
| |
| | |
| :log<sub>2</sub>(''n'') = ln(''n'')/ln(2) = log(''n'')/log(2)
| |
| | |
| so
| |
| | |
| :log<sub>2</sub>(''n'') = log<sub>''e''</sub>(''n'')×1.442695... = log<sub>10</sub>(''n'')×3.321928...
| |
| | |
| and this produces the curiosity that log<sub>2</sub>(''n'') is within 0.6% of log<sub>''e''</sub>(''n'') + log<sub>10</sub>(''n''). log<sub>''e''</sub>(''n'')+log<sub>10</sub>(''n'') is actually log<sub>2.0081359...</sub>(''n'') where the base is ''e''<sup>1/(1+log<sub>10</sub>''e'')</sup> = 10<sup>1/(1 + log<sub>''e''</sub>10)</sup> ≈ 2.00813 59293 46243 95422 87563 25191 0 to (32 significant figures). Of course, log<sub>10</sub>10 = log<sub>''e''</sub>''e'' = 1. | |
| | |
| ==Algorithm==
| |
| ===Integer===
| |
| For integer [[domain of a function|domain]] and [[range (mathematics)|range]], the binary logarithm can be computed [[rounding]] up or down. These two forms of integer binary logarithm are related by this formula:
| |
| | |
| :<math> \lfloor \log_2(n) \rfloor = \lceil \log_2(n + 1) \rceil - 1, \text{ if }n \ge 1.</math> <ref name="Hackers">{{Cite book | title=[[Hacker's Delight]] | first1=Henry S. | last1=Warren Jr. | year=2002 | publisher=Addison Wesley | isbn=978-0-201-91465-8 | pages=215}}</ref>
| |
| The definition can be extended by defining <math> \lfloor \log_2(0) \rfloor = -1</math>. This function is related to the [[number of leading zeros]] of the 32-bit unsigned binary representation of ''x'', nlz(''x'').
| |
| :<math>\lfloor \log_2(n) \rfloor = 31 - \operatorname{nlz}(n).</math><ref name="Hackers" />
| |
| | |
| The integer binary logarithm can be interpreted as the zero-based index of the most significant 1 bit in the input. In this sense it is the complement of the [[find first set]] operation, which finds the index of the least significant 1 bit. The article [[find first set]] contains more information on algorithms, architecture support, and applications for the integer binary logarithm.
| |
| | |
| ===Real number===
| |
| | |
| For a general [[positive number|positive real number]], the binary logarithm may be computed in two parts:
| |
| # Compute the [[integer]] part, <math>\lfloor\operatorname{lb}(x)\rfloor</math>
| |
| # Compute the fractional part
| |
| | |
| Computing the integral part is straightforward. For any ''x'' > 0, there exists a unique integer ''n'' such that 2<sup>''n''</sup> ≤ ''x'' < 2<sup>''n''+1</sup>, or equivalently 1 ≤ 2<sup>−''n''</sup>''x'' < 2. Now the integer part of the logarithm is simply ''n'', and the fractional part is lb(2<sup>−''n''</sup>''x''). In other words:
| |
| | |
| :<math>\operatorname{lb}(x) = n + \operatorname{lb}(y) \quad\text{where } y = 2^{-n}x \text{ and } y \in [1,2)</math>
| |
| | |
| The fractional part of the result is <math>\operatorname{lb} y</math>, and can be computed [[recursion|recursively]], using only elementary multiplication and division. To compute the fractional part: | |
| # We start with a real number <math>y \in [1,2)</math>. If <math>y=1</math>, then we are done and the fractional part is zero.
| |
| # Otherwise, square <math>y</math> repeatedly until the result is <math>z \in [2,4)</math>. Let <math>m</math> be the number of squarings needed. That is, <math>z = y^{2\uparrow m}</math> with <math>m</math> chosen such that <math>z \in [2,4)</math>.
| |
| # Taking the logarithm of both sides and doing some algebra:
| |
| #:<math>\begin{align}
| |
| \operatorname{lb}\,z &= 2^m \operatorname{lb}\,y \\
| |
| \operatorname{lb}\,y &= \frac{ \operatorname{lb} z }{ 2^m } \\
| |
| &= \frac{ 1 + \operatorname{lb}(z/2) }{ 2^m } \\
| |
| &= 2^{-m} + 2^{-m}\operatorname{lb}(z/2)
| |
| \end{align}</math>
| |
| # Notice that <math>z/2</math> is once again a real number in the interval <math>[1,2)</math>.
| |
| # Return to step 1, and compute the binary logarithm of <math>z/2</math> using the same method recursively.
| |
| | |
| The result of this is expressed by the following formulas, in which <math>m_i</math> is the number of squarings required in the ''i''-th recursion of the algorithm:
| |
| :<math>\begin{align}
| |
| \operatorname{lb}\,x &= n + 2^{-m_1} \left( 1 + 2^{-m_2} \left( 1 + 2^{-m_3} \left( 1 + \cdots \right)\right)\right) \\
| |
| &= n + 2^{-m_1} + 2^{-m_1-m_2} + 2^{-m_1-m_2-m_3} + \cdots
| |
| \end{align}</math>
| |
| | |
| In the special case where the fractional part in step 1 is found to be zero, this is a ''finite'' sequence terminating at some point. Otherwise, it is an [[infinite series]] which [[convergent series|converge]]s according to the [[ratio test]], since each term is strictly less than the previous one (since every <math>m_i>0</math>). For practical use, this infinite series must be truncated to reach an approximate result. If the series is truncated after the ''i''-th term, then the error in the result is less than <math>2^{-(m_1+m_2+\cdots+m_i)}</math>.
| |
| | |
| Fortunately, in practice we can do the computation and know the error margin without doing any algebra or any infinite series truncation. Suppose we want to compute the binary log of 1.65 with four binary digits. Repeat these steps four times:
| |
| # square the number
| |
| # if the square is >= 2, divide it by two and write a 1. Else write a 0.
| |
| The numbers we wrote are the logarithm written in binary.
| |
| That will work when we start with any number between 1 and 2.
| |
| So:
| |
| ** 1.65 squared is 2.72, which is more than two, so we halve it to 1.36 and write a 1
| |
| ** 1.36 squared is 1.85, less than two, so no halving, and write a 0
| |
| ** 1.85 squared is 3.43, more than two, so halve it to 1.72 and write a 1
| |
| ** 1.72 squared is 2.95. more than two, so write a 1 (no need to halve 2.95 because we are already done)
| |
| We wrote 1011 so far, so the binary logarithm of 1.65 written in binary is 0.1011 (or, written as a fraction, 11/16), and the error is less than 1/16. Adding 1/32, we get 23/32 which has error less than 1/32. In general, to get error less than 0.5 raised to the 1+N, we need N squarings and N or less halvings.
| |
| | |
| ==See also==
| |
| * [[Natural logarithm]] (base [[e (mathematical constant)|e]])
| |
| * [[Common logarithm]] (base 10)
| |
| | |
| ==References==
| |
| {{reflist}}
| |
| | |
| [[Category:Binary arithmetic]]
| |
| [[Category:Calculus]]
| |
| [[Category:Logarithms]]
| |
| [[Category:Articles with example Perl code]]
| |
| [[Category:Articles with example Python code]]
| |
This is really important. If you make half-hearted efforts to get rid of fat, we are not truly going to succeed. So develop a strong determination, that this might be what you want plus you will do anything it takes to achieve your goal.
When I'm struggling to get rid of weight, I eat my last meal at 5:30pm thus, by the time 6pm rolls around, I've completed eating for the day. Stopping eating at 6pm gives the body time to burn the calories you've consumed during the day. But, if you eat following 6pm, most of those calories will likely not be burned off plus is turned into fat while we sleep. If you stop eating at 6pm, you'll even find you can eat slightly more during the day and nevertheless lose weight fast.
In regards to the quickest method to lose weight, rest is an often overlooked component. People simply talk about eating plus working out to lose weight. Not everybody ever claims sleeping is important for fat reduction. Yet somehow, this truly is one of the many crucial components inside the weight-loss equation.
First of all, various folks mistakenly think that HCG is only another fancy designer drug. In truth, HCG is a hormone that occurs naturally in all of the bodies. Whenever women are expecting, they have a quite large supply of this hormone. Because of this, whenever a woman takes a pregnancy test, if a certain concentration of HCG is found inside the circulation, then the female is considered positive for the test.
6 Eat vegetable soups and fish ready without fat, no salt, and lose weight fast no spices. This was how 1 celebrity lost a great 20-30 pounds. Fish is a better choice than red meat.
Ever wonder why Brazilians are perpetually slim? They seem to enjoy their traditional dish thus much which they have it with merely regarding every meal. The dish consists of rice plus beans that lowers the risk of gaining excess fat. The dish is high in fiber and low inside fat. Hence, the blood sugar levels are stabilized along with a beach-ready body is the final result. On the other hand, eating breakfast is a daily habit of 75 percent of Germans. Breakfast signifies whole-grain cereals, fruit and breads. Skipping breakfast has constantly been advised against by all nutritionists. So if you are into shedding pounds, you need to eat breakfast like the Germans.
You are able to adopt different kinds of diets like Atkins diet, low-carb diet, high-protein diet, etc., and include the above-mentioned foods inside your diet to gain maximum benefits. All the greatest with your endeavor!