
Te comparto el código fuente de una diapositiva que elaboré usando LaTeX2e para explicar la representación geométrica del cubo de un binomio.
Te explico grosso modo el código fuente.
El documento es de la clase beamer
.
Empiezo cargando los paquetes que se requieren para generar la diapositiva (TikZ
y tikz-3dplot
). Indico las opciones de las diapositivas de la presentación en beamer y después indico información sobre el archivo en un comentario de varias líneas.
Para dar la impresión de que se trata de una animación, utilizo la instrucción \visible
de beamer
para que vayan apareciendo una a una las partes de la figura geométrica.
La primera parte que se muestra corresponde a el cubo de . En esta parte también muestro los valores de
y de
en la representación geométrica usando la instrucción
\pgfmathsetmacro{\a}{3.75}
. De manera semejante para . El valor de
representa la separación entre los prismas rectangulares que se dibujan sucesivamente.
Después dibujo, una tras otra, las partes que corresponden a .
Luego se dibuja, una a una las tres partes que corresponden a . Finalmente, se muestra en la esquina superior frontal el cubo que representa a
.
A continuación se enlista el código fuente.
% Filename: Cube-of-a-binomial.tex % % Description: % A geometric representation of the cube of the binomial $a + b$ is shown. % $(a + b)^3 = a^3 + 3 a^2 b + 3 a b^2 + b^3$. % % Author: Efraín Soto Apolinar. % Date of creation: 05 / Feb / 2023 % Monterrey, N.L., Mexico. % https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/ % Terms of use: % Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) % https://creativecommons.org/licenses/by-nc-sa/4.0/ % Your commitment to the terms of use is greatly appreciated. % \documentclass[aspectratio=169]{beamer} \usepackage{tikz} \usepackage{tikz-3dplot} % \usetheme{Warsaw} \useoutertheme{infolines} \usefonttheme{professionalfonts} % % About this slideshow % \author{Efra\'in Soto Apolinar} \title[Binomio al cubo]{Binomio al cubo} \subtitle{Aprende Matem\'aticas} \institute{} \date{} % % % \begin{document} % \section{Aprende Matem\'aticas} \subsection{www.aprendematematicas.org.mx} % \begin{frame}[fragile]{}{} % \begin{center} % \tdplotsetmaincoords{75}{120} % \begin{tikzpicture}[tdplot_main_coords] \pgfmathsetmacro{\a}{3.75} \pgfmathsetmacro{\b}{1.25} \pgfmathsetmacro{\dx}{0.35} \pgfmathsetmacro{\eje}{\a+\b+\dx} % Vertices of the rectangular prisms \coordinate (1) at (0,0,0); \coordinate (2) at (\a,0,0); \coordinate (3) at (\a,\a,0); \coordinate (4) at (0,\a,0); \coordinate (5) at (0,0,\a); \coordinate (6) at (\a,0,\a); \coordinate (7) at (\a,\a,\a); \coordinate (8) at (0,\a,\a); % \coordinate (9) at (\a+\dx,0,0); \coordinate (10) at (\a+\b+\dx,0,0); \coordinate (11) at (\a+\b+\dx,\a,0); \coordinate (12) at (\a+\dx,\a,0); \coordinate (13) at (\a+\dx,0,\a); \coordinate (14) at (\a+\b+\dx,0,\a); \coordinate (15) at (\a+\b+\dx,\a,\a); \coordinate (16) at (\a+\dx,\a,\a); % \coordinate (17) at (0,\a+\dx,0); \coordinate (18) at (\a,\a+\dx,0); \coordinate (19) at (\a,\a+\b+\dx,0); \coordinate (20) at (0,\a+\b+\dx,0); \coordinate (21) at (0,\a+\dx,\a); \coordinate (22) at (\a,\a+\dx,\a); \coordinate (23) at (\a,\a+\b+\dx,\a); \coordinate (24) at (0,\a+\b+\dx,\a); % \coordinate (25) at (\a+\dx,\a+\dx,0); \coordinate (26) at (\a+\b+\dx,\a+\dx,0); \coordinate (27) at (\a+\b+\dx,\a+\b+\dx,0); \coordinate (28) at (\a+\dx,\a+\b+\dx,0); \coordinate (29) at (\a+\dx,\a+\dx,\a); \coordinate (30) at (\a+\b+\dx,\a+\dx,\a); \coordinate (31) at (\a+\b+\dx,\a+\b+\dx,\a); \coordinate (32) at (\a+\dx,\a+\b+\dx,\a); % \coordinate (33) at (0,0,\a+\dx); \coordinate (34) at (\a,0,\a+\dx); \coordinate (35) at (\a,\a,\a+\dx); \coordinate (36) at (0,\a,\a+\dx); \coordinate (37) at (0,0,\a+\b+\dx); \coordinate (38) at (\a,0,\a+\b+\dx); \coordinate (39) at (\a,\a,\a+\b+\dx); \coordinate (40) at (0,\a,\a+\b+\dx); % \coordinate (41) at (\a+\dx,0,\a+\dx); \coordinate (42) at (\a+\b+\dx,0,\a+\dx); \coordinate (43) at (\a+\b+\dx,\a,\a+\dx); \coordinate (44) at (\a+\dx,\a,\a+\dx); \coordinate (45) at (\a+\dx,0,\a+\b+\dx); \coordinate (46) at (\a+\b+\dx,0,\a+\b+\dx); \coordinate (47) at (\a+\b+\dx,\a,\a+\b+\dx); \coordinate (48) at (\a+\dx,\a,\a+\b+\dx); % \coordinate (49) at (0,\a+\dx,\a+\dx); \coordinate (50) at (\a,\a+\dx,\a+\dx); \coordinate (51) at (\a,\a+\b+\dx,\a+\dx); \coordinate (52) at (0,\a+\b+\dx,\a+\dx); \coordinate (53) at (0,\a+\dx,\a+\b+\dx); \coordinate (54) at (\a,\a+\dx,\a+\b+\dx); \coordinate (55) at (\a,\a+\b+\dx,\a+\b+\dx); \coordinate (56) at (0,\a+\b+\dx,\a+\b+\dx); % \coordinate (57) at (\a+\dx,\a+\dx,\a+\dx); \coordinate (58) at (\a+\b+\dx,\a+\dx,\a+\dx); \coordinate (59) at (\a+\b+\dx,\a+\b+\dx,\a+\dx); \coordinate (60) at (\a+\dx,\a+\b+\dx,\a+\dx); \coordinate (61) at (\a+\dx,\a+\dx,\a+\b+\dx); \coordinate (62) at (\a+\b+\dx,\a+\dx,\a+\b+\dx); \coordinate (63) at (\a+\b+\dx,\a+\b+\dx,\a+\b+\dx); \coordinate (64) at (\a+\dx,\a+\b+\dx,\a+\b+\dx); % Indications for distances \draw[thick] (\a,0,0.05) -- (\a,0,-0.05) node [below] {\footnotesize$a$}; \draw[thick] (0,\a,0.05) -- (0,\a,-0.05) node [below] {\footnotesize$a$}; \draw[thick] (0,0.05,\a) -- (0,-0.05,\a) node [left] {\footnotesize$a$}; % \visible<1-9>{ % Indications for distances at the plane z = 0 \draw[gray,dash dot dot]($(1)!-0.125!(20)$)--($(20)!-0.125!(1)$); \draw[gray,dash dot dot]($(1)!-0.125!(20)$)--($(20)!-0.125!(1)$); \draw[gray,dash dot dot]($(10)!-0.125!(27)$)--($(27)!-0.125!(10)$); \draw[gray,dash dot dot]($(1)!-0.125!(10)$)--($(10)!-0.125!(1)$); \draw[gray,dash dot dot]($(20)!-0.125!(27)$)--($(27)!-0.125!(20)$); \draw[gray,dash dot dot]($(2)!-0.125!(19)$)--($(19)!-0.125!(2)$); \draw[gray,dash dot dot]($(9)!-0.125!(28)$)--($(28)!-0.125!(9)$); \draw[gray,dash dot dot]($(4)!-0.125!(11)$)--($(11)!-0.125!(4)$); \draw[gray,dash dot dot]($(17)!-0.125!(26)$)--($(26)!-0.125!(17)$); \draw[gray,dash dot dot]($(1)!-0.125!(37)$)--($(37)!-0.0625!(1)$); % Indications for distances at the plane x = 0 \draw[gray,dash dot dot]($(5)!-0.125!(24)$)--($(24)!-0.125!(5)$); \draw[gray,dash dot dot]($(33)!-0.125!(52)$)--($(52)!-0.125!(33)$); \draw[gray,dash dot dot]($(37)!-0.125!(56)$)--($(56)!-0.125!(37)$); \draw[gray,dash dot dot]($(2)!-0.125!(38)$)--($(38)!-0.125!(2)$); \draw[gray,dash dot dot]($(9)!-0.125!(45)$)--($(45)!-0.125!(9)$); \draw[gray,dash dot dot]($(10)!-0.125!(46)$)--($(46)!-0.125!(10)$); % Indications for distances at the plane x = \a \draw[gray,dash dot dot]($(5)!-0.125!(14)$)--($(14)!-0.125!(5)$); \draw[gray,dash dot dot]($(33)!-0.125!(42)$)--($(42)!-0.125!(33)$); \draw[gray,dash dot dot]($(4)!-0.125!(40)$)--($(40)!-0.125!(4)$); \draw[gray,dash dot dot]($(37)!-0.125!(46)$)--($(46)!-0.125!(37)$); \draw[gray,dash dot dot]($(17)!-0.125!(53)$)--($(53)!-0.125!(17)$); \draw[gray,dash dot dot]($(20)!-0.125!(56)$)--($(56)!-0.125!(20)$); } % \visible<2->{ % Indications for distances (first part) \draw[thick,<->] (\a,\a+\b+\dx,-\dx) -- (0,\a+\b+\dx,-\dx) node[midway,fill=white] {\footnotesize$a$}; \draw[gray] (\a,\a+\b+\dx,0) -- (\a,\a+\b+\dx,-2.0*\dx); \draw[gray] (0,\a+\b+\dx,0) -- (0,\a+\b+\dx,-2.0*\dx); \draw[thick,<->] (0,\a+\b+2.0*\dx,0) -- (0,\a+\b+2.0*\dx,\a) node[midway,fill=white] {\footnotesize$a$}; \draw[gray] (0,\a+\b+\dx,\a) -- (0,\a+\b+3.0*\dx,\a); \draw[gray] (0,\a+\b+\dx,0) -- (0,\a+\b+3.0*\dx,0); \draw[thick,<->] (\a+\b+\dx,0,-\dx) -- (\a+\b+\dx,\a,-\dx) node[midway,fill=white] {\footnotesize$a$}; \draw[gray] (\a+\b+\dx,0,0) -- (\a+\b+\dx,0,-2.0*\dx); \draw[gray] (\a+\b+\dx,\a,0) -- (\a+\b+\dx,\a,-2.0*\dx); \draw[thick,<->] (\a+\b+2.0*\dx,0,0) -- (\a+\b+2.0*\dx,0,\a) node[midway,fill=white] {\footnotesize$a$}; \draw[gray] (\a+\b+\dx,0,\a) -- (\a+\b+3.0*\dx,0,\a); \draw[gray] (\a+\b+\dx,0,0) -- (\a+\b+3.0*\dx,0,0); } \visible<2->{ % More indications for distances... \draw[thick,<->] (\a+\b+\dx,\a+\dx,-\dx) -- (\a+\b+\dx,\a+\b+\dx,-\dx) node[midway,fill=white] {\footnotesize$b$}; \draw[gray] (\a+\b+\dx,\a+\b+\dx,0) -- (\a+\b+\dx,\a+\b+\dx,-2.0*\dx); \draw[gray] (\a+\b+\dx,\a+\dx,0) -- (\a+\b+\dx,\a+\dx,-2.0*\dx); \draw[thick,<->] (\a+\dx,\a+\b+\dx,-\dx) -- (\a+\b+\dx,\a+\b+\dx,-\dx) node[midway,fill=white] {\footnotesize$b$}; \draw[gray] (\a+\dx,\a+\b+\dx,0) -- (\a+\dx,\a+\b+\dx,-2.0*\dx); \draw[thick,<->] (\a+\b+2.0*\dx,0,\a+\dx) -- (\a+\b+2.0*\dx,0,\a+\b+\dx) node[midway,fill=white] {\footnotesize$b$}; \draw[gray] (\a+\b+\dx,0,\a+\dx) -- (\a+\b+3.0*\dx,0,\a+\dx); \draw[gray] (\a+\b+\dx,0,\a+\b+\dx) -- (\a+\b+3.0*\dx,0,\a+\b+\dx); \draw[thick,<->] (0,\a+\b+2.0*\dx,\a+\dx) -- (0,\a+\b+2.0*\dx,\a+\b+\dx) node[midway,fill=white] {\footnotesize$b$}; \draw[gray] (0,\a+\b+\dx,\a+\dx) -- (0,\a+\b+3.0*\dx,\a+\dx); \draw[gray] (0,\a+\b+\dx,\a+\b+\dx) -- (0,\a+\b+3.0*\dx,\a+\b+\dx); } % The geometric representation of the cube of the binomial % % First $a^3$ % \visible<2->{ \draw[red,thick,fill=cyan!35,opacity=0.5] (1) -- (2) -- (3) --(4) -- (1); % z = 0 \draw[red,thick,fill=cyan!35,opacity=0.5] (1) -- (4) -- (8) --(5) -- (1); % x = 0 \draw[red,thick,fill=cyan!35,opacity=0.5] (1) -- (2) -- (6) --(5) -- (1); % y = 0 % \node at (0.5*\a,0.5*\a,0.5*\a) {$a^3$}; % \draw[red,thick,fill=cyan!35,opacity=0.5] (5) -- (6) -- (7) --(8) -- (5); % z = \a \draw[red,thick,fill=cyan!35,opacity=0.5] (2) -- (3) -- (7) --(6) -- (2); % x = \a \draw[red,thick,fill=cyan!35,opacity=0.5] (4) -- (3) -- (7) --(8) -- (4); % y = \a } % \visible<3->{ % Now: $a^2 b$ (front face) % Las paredes \draw[red,thick,fill=cyan!35,opacity=0.35] (9) -- (10) -- (11) --(12) -- (9); % z = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (9) -- (12) -- (16) --(13) -- (9); % x = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (9) -- (10) -- (14) --(13) -- (9); % y = 0 % \node at (\a+0.5*\b+\dx,0.5*\a,0.5*\a) {$a^2b$}; % \draw[red,thick,fill=cyan!35,opacity=0.35] (13) -- (14) -- (15) --(16) -- (13); % z = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (10) -- (11) -- (15) --(14) -- (10); % x = \a + \b \draw[red,thick,fill=cyan!35,opacity=0.35] (12) -- (11) -- (15) --(16) -- (12); % y = \a } % \visible<4->{ % + + + + + + + + + + + + + % Now: $a^2 b$ (face at the right) \draw[red,thick,fill=cyan!35,opacity=0.35] (17) -- (18) -- (19) --(20) -- (17); % z = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (17) -- (20) -- (24) --(21) -- (17); % x = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (17) -- (18) -- (22) --(21) -- (17); % y = \a % \node at (0.5*\a,\a+0.5*\b+\dx,0.5*\a) {$a^2b$}; % \draw[red,thick,fill=cyan!35,opacity=0.35] (21) -- (22) -- (23) --(24) -- (21); % z = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (18) -- (19) -- (23) --(22) -- (18); % x = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (20) -- (19) -- (23) --(24) -- (20); % y = \a + \b } % \visible<6->{ % Now: $b^2 a$ (front corner) \draw[red,thick,fill=cyan!35,opacity=0.35] (25) -- (26) -- (27) --(28) -- (25); % z = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (25) -- (28) -- (32) --(29) -- (25); % x = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (25) -- (26) -- (30) --(29) -- (25); % y = \a % \node at (\a+0.5*\b+\dx,\a+0.5*\b+\dx,0.5*\a) {$ab^2$}; % \draw[red,thick,fill=cyan!35,opacity=0.35] (29) -- (30) -- (31) --(32) -- (29); % z = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (26) -- (27) -- (31) --(30) -- (26); % x = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (28) -- (27) -- (31) --(32) -- (28); % y = \a + \b } % + + + + + + + + + + + + % Top layer % + + + + + + + + + + + + \visible<5->{ % First $a^2 b$ (Top cover) \draw[red,thick,fill=cyan!35,opacity=0.35] (33) -- (34) -- (35) --(36) -- (33); % z = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (33) -- (36) -- (40) --(37) -- (33); % x = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (33) -- (34) -- (38) --(37) -- (33); % y = 0 % \node at (0.5*\a+\dx,0.5*\a+\dx,\a+0.5*\b+\dx) {$a^2b$}; % \draw[red,thick,fill=cyan!35,opacity=0.35] (37) -- (38) -- (39) --(40) -- (37); % z = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (34) -- (35) -- (39) --(38) -- (34); % x = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (36) -- (35) -- (39) --(40) -- (36); % y = \a } % Now: $a b^2$ (front part) \visible<7->{ % Las paredes \draw[red,thick,fill=cyan!35,opacity=0.35] (41) -- (42) -- (43) --(44) -- (41); % z = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (41) -- (44) -- (48) --(45) -- (41); % x = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (41) -- (42) -- (46) --(45) -- (41); % y = 0 % \node at (\a+0.5*\b+\dx,0.5*\a+\dx,\a+0.5*\b+\dx) {$ab^2$}; % \draw[red,thick,fill=cyan!35,opacity=0.35] (45) -- (46) -- (47) --(48) -- (45); % z = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (42) -- (43) -- (47) --(46) -- (42); % x = \a + \b \draw[red,thick,fill=cyan!35,opacity=0.35] (44) -- (43) -- (47) --(48) -- (44); % y = \a } % \visible<8->{ % Now: $a^2 b$ (at the right) \draw[red,thick,fill=cyan!35,opacity=0.35] (49) -- (50) -- (51) --(52) -- (49); % z = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (49) -- (52) -- (56) --(53) -- (49); % x = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (49) -- (50) -- (54) --(53) -- (49); % y = \a % \node at (0.5*\a+\dx,\a+0.5*\b+\dx,\a+0.5*\b+\dx) {$ab^2$}; % \draw[red,thick,fill=cyan!35,opacity=0.35] (53) -- (54) -- (55) --(56) -- (53); % z = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (50) -- (51) -- (55) --(54) -- (50); % x = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (52) -- (51) -- (55) --(56) -- (52); % y = \a + \b } % \visible<9-10>{ % Lastly, $b^3$ (little cube at the upper-front corner) \draw[red,thick,fill=cyan!35,opacity=0.35] (57) -- (58) -- (59) --(60) -- (57); % z = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (57) -- (60) -- (64) --(61) -- (57); % x = 0 \draw[red,thick,fill=cyan!35,opacity=0.35] (57) -- (58) -- (62) --(61) -- (57); % y = \a % \node at (\a+0.5*\b+\dx,\a+0.5*\b+\dx,\a+0.5*\b+\dx) {$b^3$}; % \draw[red,thick,fill=cyan!35,opacity=0.35] (61) -- (62) -- (63) --(64) -- (61); % z = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (58) -- (59) -- (63) --(62) -- (58); % x = \a \draw[red,thick,fill=cyan!35,opacity=0.35] (60) -- (59) -- (63) --(64) -- (60); % y = \a + \b } % \visible<6-9>{ % Indications for distances at the plane x = \a + \dx \draw[gray,dash dot dot]($(13)!-0.125!(32)$)--($(32)!-0.125!(13)$); \draw[gray,dash dot dot]($(41)!-0.125!(60)$)--($(60)!-0.125!(41)$); \draw[gray,dash dot dot]($(45)!-0.125!(64)$)--($(64)!-0.125!(45)$); % Indications for distances at the plane x = \a + \dx + \b \draw[gray,dash dot dot]($(14)!-0.125!(31)$)--($(31)!-0.125!(14)$); \draw[gray,dash dot dot]($(42)!-0.125!(59)$)--($(59)!-0.125!(42)$); \draw[gray,dash dot dot]($(46)!-0.125!(63)$)--($(63)!-0.125!(46)$); % Indications for distances at the plane y = 0 \draw[gray,dash dot dot]($(5)!-0.125!(14)$)--($(14)!-0.125!(5)$); \draw[gray,dash dot dot]($(33)!-0.125!(42)$)--($(42)!-0.125!(33)$); \draw[gray,dash dot dot]($(37)!-0.125!(46)$)--($(46)!-0.125!(37)$); % Indications for distances at the plane y = \a \draw[gray,dash dot dot]($(6)!-0.125!(23)$)--($(23)!-0.125!(6)$); \draw[gray,dash dot dot]($(34)!-0.125!(51)$)--($(51)!-0.125!(34)$); \draw[gray,dash dot dot]($(38)!-0.125!(55)$)--($(55)!-0.125!(38)$); % Indications for distances at the plane y = \a + \dx \draw[gray,dash dot dot]($(8)!-0.125!(15)$)--($(15)!-0.125!(8)$); \draw[gray,dash dot dot]($(36)!-0.125!(43)$)--($(43)!-0.125!(36)$); \draw[gray,dash dot dot]($(40)!-0.125!(47)$)--($(47)!-0.125!(40)$); % Indications for distances at the plane y = \a + \dx + \b \draw[gray,dash dot dot]($(24)!-0.125!(31)$)--($(31)!-0.125!(24)$); \draw[gray,dash dot dot]($(52)!-0.125!(59)$)--($(59)!-0.125!(52)$); \draw[gray,dash dot dot]($(56)!-0.125!(63)$)--($(63)!-0.125!(56)$); % \draw[gray,dash dot dot]($(53)!-0.125!(62)$)--($(62)!-0.125!(53)$); } % \end{tikzpicture} % \end{center} % % Node indicating the algebraic representation of the cube of the binomial % \begin{tikzpicture}[remember picture,overlay] \node[below right,shift={(0.25,-0.5)}] at (current page.north west){$(a + b)^{3} = a^{3} + 3\,a^{2}b + 3\,ab^{2} + b^{3}$}; \end{tikzpicture} % \end{frame} % % That's all folks! % \end{document} |
El resultado final se muestra a continuación.
Si aún no conoces LaTeX2e, te invito a aprenderlo con nuestro curso en línea gratuito, titulado LaTeX2e para principiantes.
0 responses on "Binomio al cubo: animación en LaTeX2e"