Saltar al contenido principal
LibreTexts Español

3.4: Números racionales y complejos

  • Page ID
    113356
  • \( \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}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    2//3
    -4//7
    178//11
    8//18
     

    Una ventaja que tienen es que el numerador y el denominador se almacenan como enteros (64 bits por defecto) y no están sujetos a errores de redondez que son los puntos flotantes. Las operaciones estándar +, −, ·, ÷ entre los racionales resulta en una racional y como veremos en este curso, hay ventajas al usar racionales en lugar de puntos flotantes.

    Ejercicio

    • \(\dfrac{1}{2} + \dfrac{2}{3}\)

    • \(\dfrac{1}{2} - \dfrac{2}{3}\)

    • \(\dfrac{2}{3} \cdot \dfrac{3}{5}\)
    • \(\dfrac{2}{3} \div \dfrac{3}{5}\)
    # insert your code here.
     

    El tipo racional

    Si ingresas

    typeof(1//2)
     

    se llama Tipo Composite Paramétrico, del que se hablará más adelante. En este caso particular, se trata de un tipo racional, pero dentro de él (el numerador y denominador), son de tipo Int64.

    Por ejemplo, para hacer un tipo diferente de racional es necesario declarar un tipo entero diferente en su interior, ingrese

    Int16(1)//Int16(3)
     

    3.4: Números racionales y complejos is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.