Saltar al contenido principal
LibreTexts Español

11.3: Otras gráficas de funciones

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

    Aquí hay algunos comandos preliminares para ejecutar si aún no lo han estado.

    using Pkg; Pkg.add("Plots")
       Updating registry at `/srv/julia/pkg/registries/General`
      Resolving package versions...
    Updating `~/Project.toml`
      [91a5bcdd] + Plots v1.14.0
    Updating `~/Manifest.toml`
      [6e34b625] + Bzip2_jll v1.0.6+5
      [83423d85] + Cairo_jll v1.16.0+6
      [35d6a980] + ColorSchemes v3.12.1
      [5ae413db] + EarCut_jll v2.1.5+1
      [2e619515] + Expat_jll v2.2.7+6
      [c87230d0] + FFMPEG v0.4.0
      [b22a6f82] + FFMPEG_jll v4.3.1+4
      [a3f928ae] + Fontconfig_jll v2.13.1+14
      [d7e528f0] + FreeType2_jll v2.10.1+5
      [559328eb] + FriBidi_jll v1.0.5+6
      [0656b61e] + GLFW_jll v3.3.4+0
      [28b8d3ca] + GR v0.57.4
      [d2c73de3] + GR_jll v0.57.2+0
      [5c1252a2] + GeometryBasics v0.3.12
      [78b55507] + Gettext_jll v0.20.1+7
      [7746bdde] + Glib_jll v2.59.0+4
      [aacddb02] + JpegTurbo_jll v2.0.1+3
      [c1c5ebd0] + LAME_jll v3.100.0+3
      [dd4b983a] + LZO_jll v2.10.0+3
      [b964fa9f] + LaTeXStrings v1.2.1
      [23fbe1c1] + Latexify v0.15.5
      [dd192d2f] + LibVPX_jll v1.9.0+1
      [e9f186c6] + Libffi_jll v3.2.1+4
      [d4300ac3] + Libgcrypt_jll v1.8.5+4
      [7e76a0d4] + Libglvnd_jll v1.3.0+3
      [7add5ba3] + Libgpg_error_jll v1.36.0+3
      [4b2f31a3] + Libmount_jll v2.34.0+3
      [89763e89] + Libtiff_jll v4.1.0+2
      [38a345b3] + Libuuid_jll v2.34.0+7
      [77ba4419] + NaNMath v0.3.5
      [e7412a2a] + Ogg_jll v1.3.4+2
      [91d4177d] + Opus_jll v1.3.1+3
      [2f80f16e] + PCRE_jll v8.42.0+4
      [30392449] + Pixman_jll v0.40.0+0
      [ccf2f8ad] + PlotThemes v2.0.1
      [995b91a9] + PlotUtils v1.0.10
      [91a5bcdd] + Plots v1.14.0
      [ea2cea3b] + Qt5Base_jll v5.15.2+0
      [01d81517] + RecipesPipeline v0.3.2
      [f50d1b31] ↑ Rmath_jll v0.2.2+1 ⇒ v0.2.2+2
      [6c6a2e73] + Scratch v1.0.3
      [09ab397b] + StructArrays v0.5.1
      [a2964d1f] + Wayland_jll v1.17.0+4
      [2381bf8a] + Wayland_protocols_jll v1.18.0+4
      [aed1982a] + XSLT_jll v1.1.33+4
      [4f6342f7] + Xorg_libX11_jll v1.6.9+4
      [0c0b7dd1] + Xorg_libXau_jll v1.0.9+4
      [935fb764] + Xorg_libXcursor_jll v1.2.0+4
      [a3789734] + Xorg_libXdmcp_jll v1.1.3+4
      [1082639a] + Xorg_libXext_jll v1.3.4+4
      [d091e8ba] + Xorg_libXfixes_jll v5.0.3+4
      [a51aa0fd] + Xorg_libXi_jll v1.7.10+4
      [d1454406] + Xorg_libXinerama_jll v1.1.4+4
      [ec84b674] + Xorg_libXrandr_jll v1.5.2+4
      [ea2f1a96] + Xorg_libXrender_jll v0.9.10+4
      [14d82f49] + Xorg_libpthread_stubs_jll v0.1.0+3
      [c7cfdc94] + Xorg_libxcb_jll v1.13.0+3
      [cc61e674] + Xorg_libxkbfile_jll v1.1.0+4
      [12413925] + Xorg_xcb_util_image_jll v0.4.0+1
      [2def613f] + Xorg_xcb_util_jll v0.4.0+1
      [975044d2] + Xorg_xcb_util_keysyms_jll v0.4.0+1
      [0d47668e] + Xorg_xcb_util_renderutil_jll v0.3.9+1
      [c22f9ab0] + Xorg_xcb_util_wm_jll v0.4.1+1
      [35661453] + Xorg_xkbcomp_jll v1.4.2+4
      [33bec58e] + Xorg_xkeyboard_config_jll v2.27.0+4
      [c5fb5394] + Xorg_xtrans_jll v1.4.0+3
      [0ac62f75] + libass_jll v0.14.0+4
      [f638f0a6] + libfdk_aac_jll v0.1.6+4
      [b53b4c65] + libpng_jll v1.6.37+6
      [f27f6e37] + libvorbis_jll v1.3.6+6
      [1270edf5] + x264_jll v2020.7.14+2
      [dfaa095f] + x265_jll v3.0.0+3
      [d8fb68d0] + xkbcommon_jll v0.9.1+5
    
    using Plots
     

    Parcelas Paramétricas

    Recordemos que una curva paramétrica es un conjunto de puntos en el\(xy\) plano -dado por\( (x(t),y(t)\) para funciones\(x(t)\) y\(y(t)\). La variable\(t\) se llama el parámetro. Un ejemplo clásico es el círculo que se puede escribir como

    \[x(t) = \cos t, \qquad y(t) = \sin t \nonumber \]

    Para trazar el círculo usando este formulario, ingrese

    plot(t->cos(t),t->sin(t),0,2*pi,legend=false)
    UndefVarError: plot not defined
    
    Stacktrace:
     [1] top-level scope at In[1]:1
     [2] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

    y señalar que la leyenda está apagada, ya que con una curva, no tiene mucho sentido. Observe que esto debería ser un círculo, pero parece una elipse debido a la relación de aspecto. Si uno agrega la opción aspect_ratio=:equal, como en

    plot(t->cos(t),t->sin(t),0,2*pi,aspect_ratio=:equal, legend=false)
     

    Ejercicio

    Producir una gráfica de la curva\( x(t) = t^3-t, y(t)=t^2 \) para\(-2 \leq t \leq 2\).

    # insert your code here
     

    Curvas implícitas

    Una curva implícita es el conjunto de puntos tal que\(f (x, y) = 0\) (o cualquier constante) y un círculo es el ejemplo clásico. Por ejemplo,\(x^2+y^2=1\). Aunque hay otras formas de hacer esto, usaremos algo de álgebra para escribir el círculo como\( f(x,y) = x^2+y^2-1 \).

    Podemos trazar esto con la función de contorno por ejemplo

    contour(-1.05:0.05:1.05, -1.05:0.05:1.05, (x,y) -> x^2+y^2-1, levels=[0], aspect_ratio = :equal, legend = false)
     

    Tenga en cuenta que nuevamente, hemos utilizado la opción aspect_ratio =:equal para asegurar que el círculo se vea como un círculo. La gráfica resultante es exactamente la misma que el círculo anterior.

    El siguiente ejemplo es un poco más interesante visualmente. Esta es la función\( f(x,y) = sin(x+y)-cos(xy)+1 \)

    contour(-10.1:0.1:10.1, -10.1:0.1:10.1, (x,y) -> sin(x+y)-cos(x*y)+1, levels=[0], aspect_ratio = :equal, colorbar_entry = false)
     

    Ejercicio

    Un cardiod es una curva 2D que se parece un poco a un corazón. Se puede representar por una curva implícita con la ecuación

    \[ (x^2+y^2)^2 +4ax(x^2+y^2) -4a^2y^2 = 0 \nonumber \]

    Trazar el cardiod\(a=1\) usando el bloque de código a continuación

    # insert your code here
     

    Parcelas de superficie

    Si tenemos una función de 2 variables, una gráfica de superficie es agradable de usar. Por ejemplo, si tenemos la función

    \[f(x,y) = e^{-0.1(x^2+y^2)} \label{3dbell}\]

    y queremos trazarlo de -3 a 3 en ambas direcciones, si definimos

    f(x,y)=exp(-0.1*(x^2+y^2))
    x = y = range(-5, stop = 5, length = 40)
     
    -5.0:0.2564102564102564:5.0

    y luego trazar con

    surface(x,y, f, legend = false)
    UndefVarError: surface not defined
    
    Stacktrace:
     [1] top-level scope at In[2]:1
     [2] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

    Ejercicio

    Producir una gráfica de superficie de la función\(f(x,y)=\sin x \cos y\) para\(0\leq x \leq 2\pi, 0\leq y \leq 2\pi\) usar el bloque de código a continuación

    # insert your code here
     

    Mapas de Calor

    Un mapa de calor es una versión bidimensional de una gráfica de superficie en la que se le da un color a la altura de cada valor. Lo siguiente produce un mapa de calor de la función en\ ref {3dbell}

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

    Ejercicio

    Producir una gráfica de superficie de la función\(f(x,y)=\sin x \cos y\) para\(0\leq x \leq 2\pi, 0\leq y \leq 2\pi\) usar el bloque de código a continuación

    # Insert your code here
     

    11.3: Otras gráficas de funciones is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.