Saltar al contenido principal
LibreTexts Español

7.6: Experimento Numérico (Códigos Huffman)

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    El siguiente párrafo contiene la dirección de Lincoln en Gettysburg. Ignorar símbolos especiales como puntos e ignorar la distinción entre letras minúsculas y mayúsculas. Calcular la frecuencia relativa de ocurrencia para cada una de las 26 letras del alfabeto. Escriba un programa MATLAB para generar un árbol binario para el código Huffman de la dirección de Gettysburg. Cuando haya generado el código, calme la longitud promedio de la palabra de código

    \[L=\sum_{i=1}^{26} \frac{n_{i}}{N} l_{i} \nonumber \]

    donde\(\frac{n_{i}}{N}\) es la frecuencia relativa para el símbolo\(i\) y\(l_i\) es la longitud de la palabra de código para el símbolo\(i\). Comparar\(L\) con la entropía

    \[H=-\sum_{i=1}^{26} \frac{n_{i}}{N} \log _{2} \frac{n_{i}}{N}=\sum_{i=1}^{26} \frac{n_{i}}{N} \log _{2} \frac{N}{n_{i}} \nonumber \]

    y comparar\(L\) con\(\log_2 26\). Interpreta tus hallazgos.

    Gettysburg Dirección

    Fourscore and seven years ago, our fathers brought forth upon this
    continent a new nation, conceived in liberty and dedicated to the proposition
    that all men are created equal. Now we are engaged in a great civil war,
    testing whether that nation or any nation so conceived and so dedicated can
    long endure. We are met on a great battlefield of that war. We have come
    to dedicate a portion of that field as a final resting-place for those who have
    given their lives that that nation might live. It is altogether fitting and proper
    that we should do this. But in a larger sense, we cannot dedicate, we cannot
    consecrate, we cannot hallow this ground. The brave men, living and dead,
    who struggled here have consecrated it far above our power to add or detract.
    The world will little note nor long remember what we say here, but it can
    never forget what they did here. It is for us the living rather to be dedicated
    here to the unfinished work which they who fought here have thus far so nobly
    advanced. It is rather for us to be here dedicated to the great task remaining
    before us–that from these honored dead we take increased devotion to that
    cause for which they gave the last full measure of devotion–that we here
    highly resolve that these dead should not have died in vain, that this nation
    under God shall have a new birth of freedom, and that government of the
    people, by the people, for the people shall not perish from the Earth.
                  -Abraham Lincoln, November 19, 1863

    This page titled 7.6: Experimento Numérico (Códigos Huffman) is shared under a CC BY 3.0 license and was authored, remixed, and/or curated by Louis Scharf (OpenStax CNX) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.