Saltar al contenido principal
LibreTexts Español

11.1: El Paquete de Parcelas

  • Page ID
    113231
  • This page is a draft and is under active development. 

    \( \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}}} \)

    Hay un paquete de plotting relativamente simple, pero potente llamado Plot y no olvides descargarlo como en el Apéndice XXX. La documentación completa se encuentra en el sitio web de Plots.jl. Recordemos que una vez que se agrega el paquete, ingrese

    using Pkg; Pkg.add("Plots")
     
    using Plots

    El paquete Plot intenta unificar la sintaxis para trazar cualquier cosa. El comando básico para trazar datos o funciones en 2D es el comando de trazado, que intenta trazar cualquier objeto que se pueda trazar. Los siguientes ejemplos lo demuestran.

    Funciones de trazado

    Para trazar una función, simplemente llame a plot en la función:

    plot(x->x^2)
     

     

    Nota: si está ejecutando esto en su propia computadora, su trama puede verse un poco diferente a esta con diferentes fuentes. Esto se debe principalmente al uso de un backend diferente, lo cual se explica a continuación.

    Si desea especificar el rango x, intente:

    plot(x->x^2,-2,2)
    UndefVarError: plot not defined
    
    Stacktrace:
     [1] top-level scope at In[1]:1
     [2] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

    Si queremos trazar 2 o más funciones en los mismos ejes, pasar en una matriz de funciones como:

    plot([x->x^2,x->sin(x)],-2,2)
     

    También veremos a continuación cómo cambiar otros aspectos de la trama incluyendo la leyenda, título, etiquetas en los ejes, etc.

    Ejercicio

    Trazar las funciones\( f(x) = e^{-x^2}, g(x)=\ln(x) \) en el intervalo\([-3,3]\)

    # add your code here.
     

    This page titled 11.1: El Paquete de Parcelas is shared under a CC BY-SA license and was authored, remixed, and/or curated by Peter Staab.