├── .DS_Store
├── SVGLogos
├── escudo_fb.svg
├── escudo_insta.svg
└── escudo_github.svg
├── Logos.py
├── Topologia
├── Topologia_SVGs
│ ├── convexo.svg
│ ├── conexo1.svg
│ ├── inter.svg
│ ├── conexo2.svg
│ ├── conexo3.svg
│ ├── no_convexo.svg
│ ├── cerrado.svg
│ ├── disconexo.svg
│ ├── cjtoA.svg
│ ├── abierto.svg
│ ├── observacion1.svg
│ └── cjtoB.svg
├── bolas.py
├── cerradura.py
├── lebesgue.py
├── cubierta.py
├── tipos_puntos.py
└── asilados_acumulacion.py
├── Sucesiones
├── acotadas.py
├── definicion.py
├── teo_puente.py
├── ejemplos.py
├── rectangulos_anidados.py
└── subsucesiones.py
├── Espacios vectoriales
├── distributiva.py
├── bases.py
├── inverso_aditivo.py
├── operaciones.py
├── tipos_normas.py
└── conmutatividad.py
├── Límite y continuidad en funciones multivariable
├── continua_acotada.py
├── contiuas_abiertos.py
├── limite_infinito_R-Rn.py
├── limite_infinito_Rn-R.py
├── curva_nivel.py
├── divergencia_Rn-R_punto.py
├── divergencia_Rn-R_infinito.py
├── divergencia_R-Rn_infinito.py
└── divergencia_R-Rn_punto.py
├── Cálculo diferencial de superficies
└── inclinacion.py
├── Modificaciones Manim
└── space_ops.py
└── Coordenadas polares y cartesianas SVG
└── Diagrama_conmutatividad.svg
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/animathica/calcanim/HEAD/.DS_Store
--------------------------------------------------------------------------------
/SVGLogos/escudo_fb.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SVGLogos/escudo_insta.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SVGLogos/escudo_github.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/Logos.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 | class escudo(Scene):
3 | def construct(self):
4 | A = SVGMobject(r'C:\manim\manim-master\manim-master\assets\svg_images\escudo_f_c')
5 | B = SVGMobject(r'C:\manim\manim-master\manim-master\assets\svg_images\escudo_unam')
6 | A.set_fill(opacity = 0)\
7 | .set_stroke(WHITE,0.65)\
8 | .scale(2)\
9 | .move_to(np.array([-3,0,0]))
10 | B.set_fill(opacity = 0)\
11 | .set_stroke(WHITE,0.65)\
12 | .scale(2)\
13 | .move_to(np.array([3,0,0]))
14 | self.play(ShowCreation(A), ShowCreation(B), run_time = 10)
15 | self.wait()
16 | self.play(FadeOut(A), FadeOut(B) )
17 | C = SVGMobject(r'C:\manim\manim-master\manim-master\assets\svg_images\escudo_insta').set_fill(opacity = 0.4)\
18 | .set_stroke(WHITE,0.65)\
19 | .scale(1)\
20 | .move_to(np.array([-3,2.5,0]))
21 | D = SVGMobject(r'C:\manim\manim-master\manim-master\assets\svg_images\escudo_fb').set_fill(opacity = 0.4)\
22 | .set_stroke(WHITE,0.65)\
23 | .scale(1)\
24 | .move_to(np.array([-3,-2.5,0]))
25 | E = SVGMobject(r'C:\manim\manim-master\manim-master\assets\svg_images\escudo_github').set_fill(opacity = 0.4)\
26 | .set_stroke(WHITE,0.65)\
27 | .scale(1)\
28 | .move_to(np.array([-3,0,0]))
29 | self.play(Write(C),Write(D),Write(E), run_time = 5)
30 | self.wait()
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/convexo.svg:
--------------------------------------------------------------------------------
1 |
2 |
39 |
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/conexo1.svg:
--------------------------------------------------------------------------------
1 |
2 |
64 |
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/inter.svg:
--------------------------------------------------------------------------------
1 |
2 |
61 |
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/conexo2.svg:
--------------------------------------------------------------------------------
1 |
2 |
61 |
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/conexo3.svg:
--------------------------------------------------------------------------------
1 |
2 |
62 |
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/no_convexo.svg:
--------------------------------------------------------------------------------
1 |
2 |
63 |
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/cerrado.svg:
--------------------------------------------------------------------------------
1 |
2 |
62 |
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/disconexo.svg:
--------------------------------------------------------------------------------
1 |
2 |
66 |
--------------------------------------------------------------------------------
/Sucesiones/acotadas.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | ###################################
4 | #### SUCESIONES ACOTADAS #####
5 | ###################################
6 |
7 | class Sucesiones_Acotadas(Scene):
8 | def construct(self):
9 | plano = NumberPlane()
10 | title = TextMobject('''Sucesiones acotadas''')
11 | text1 = TextMobject('''Considera la siguiente sucesión''').shift(UP)
12 |
13 | self.play(Write(title))
14 | self.wait(6)
15 | self.play(ReplacementTransform(title,text1))
16 |
17 | ejem1 = TexMobject(r"X_n=\left(3e^{-n/30}\cos\left(\frac{n}{5}\right),3e^{-n/30}\sin\left(\frac{n}{5}\right)\right)").next_to(text1,DOWN)
18 |
19 | self.play(Write(ejem1))
20 | self.wait()
21 | self.play(FadeOut(text1),FadeOut(ejem1))
22 |
23 | suce1 = []
24 | for n in range(1,151):
25 | x_n = Dot(point=np.array([3*np.exp(-n/30)*np.cos(n/5),3*np.exp(-n/30)*np.sin(n/5),0]),color=ORANGE)
26 | suce1.append(x_n)
27 | sucesion1 = VGroup(*suce1)
28 |
29 | self.play(ShowCreation(plano),run_time=0.5)
30 | self.play(Write(sucesion1),run_time=10)
31 | self.wait()
32 | self.play(FadeOut(plano),FadeOut(sucesion1),run_time=0.5)
33 |
34 | text2 = TextMobject('''Piensa en lo que representaría geométricamente \n
35 | que una sucesión fuera acotada''')
36 | text3 = TextMobject('''Considera una bola de radio $M=3$ centrada en el origen''')
37 | bola = Circle(radius=3,color=RED)
38 |
39 | self.play(Write(text2))
40 | self.wait(5)
41 | self.play(ReplacementTransform(text2,text3))
42 | self.wait(5)
43 | self.play(FadeOut(text3))
44 | self.play(ShowCreation(plano),run_time=0.5)
45 | self.play(FadeIn(bola),Write(sucesion1))
46 | self.wait()
47 |
48 | text4 = TextMobject('''Puedes ver que se cumple \n
49 | $\\{X_n\\}\\subset B_{M}(\\bar{0})$''',color=BLACK).scale(0.6)
50 | text4.bg = SurroundingRectangle(text4,color=RED,fill_color=WHITE,fill_opacity=1)
51 | text4.group = VGroup(text4.bg,text4).move_to(np.array([-4.5,3,0]))
52 |
53 | self.play(FadeIn(text4.group))
54 | self.wait(7)
55 | self.play(FadeOut(plano),FadeOut(sucesion1),FadeOut(bola),FadeOut(text4.group))
56 |
57 | text5 = TextMobject('''Y justo con esto es como se define sucesión acotada''')
58 | text6 = TextMobject('''Decimos que $\\{X_n\\}$ es acotada si existe $M\\in\\mathbb{R}^+$ \n
59 | tal que $\\{X_n\\}\\subset B_{M}(\\bar{0})$''')
60 | text7 = TextMobject('''Intenta demostrar que la sucesión $X_n=(n,n)$ NO es acotada\n
61 | usando la definición anterior (su negación)''')
62 |
63 | self.play(Write(text5))
64 | self.wait(4)
65 | self.play(ReplacementTransform(text5,text6))
66 | self.wait(9)
67 | self.play(ReplacementTransform(text6,text7))
68 | self.wait(5)
69 | self.play(FadeOut(text7))
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/cjtoA.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
76 |
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/abierto.svg:
--------------------------------------------------------------------------------
1 |
2 |
83 |
--------------------------------------------------------------------------------
/Sucesiones/definicion.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | ###################################
4 | #### DEFINICIÓN DE SUCESIONES #####
5 | ###################################
6 |
7 | class Definicion_Sucesiones(Scene):
8 | def construct(self):
9 |
10 | ##texto:
11 | t_1 = TextMobject(''' \\textquestiondown Recuerdas la definici\\'{o}n de sucesiones en $\\mathbb{R}?$ ''')
12 | t_2 = TextMobject('''Una sucesi\\'{o}n es una funci\\'{o}n de: \n
13 | $\\mathbb{N}\\rightarrow\\mathbb{R}$ ''')
14 | t_3 = TextMobject('''Nota que es distinto hablar del conjunto \n
15 | que contiene a todos los \n
16 | elementos de dicha sucesi\\'{o}n:\n
17 | $\{ x_n \}$, \n
18 | donde $x_n = s(n)$ y \n
19 | donde $s$ es la funci\\'{o}n.''')
20 | t_4 = TextMobject(''' \\textexclamdown Bueno! Pues es an\\'{a}logo para \n
21 | sucesiones de $\\mathbb{R}^n$. ''')
22 | t_5 = TextMobject('''Recuerda que un vector en $\\mathbb{R}^n$, \n
23 | se ve de la siguiente forma: \n
24 | $(x_1,x_2,\\dots,x_n)$, donde $x_i\\in \\mathbb{R}$, \n
25 | para cualquier $i\\in \{ 1,\\dots, n \}$''')
26 | t_6 = TextMobject('''Por lo que para definir una sucesi\\'{o}n \n
27 | en $\\mathbb{R}^n$ \n
28 | basta definir una sucesi\\'{o}n para \n
29 | cada entrada vectorial, es decir: \n
30 | $\\vec{s}: \\mathbb{N}\\rightarrow \\mathbb{R}^n$ ''')
31 | t_7 = TextMobject('''O sea que: \n
32 | $\\vec{s}(n) = (s_1(n),s_2(n),\\dots, s_n(n))$ \n
33 | Donde $s_i$ es una sucesi\\'{o}n en $\\mathbb{R}$.''')
34 | t_8 = TextMobject('''Por ejemplo en $\\mathbb{R}^2$, tomemos: \n
35 | $\\vec{s}(n) = ((e^{-n})\\cos(n),(e^{-n})\\sin(n))$''')
36 | t_9 = TextMobject('''Pintemos las parejas de la sucesi\\'{o}n en el plano:''')
37 |
38 |
39 |
40 | ##mas
41 | grid = NumberPlane()
42 | Elementos = [Dot(point=i).set_color(RED_E) for i in cjto_pts_sucesion_1]
43 | Elementos_Y = [Dot(point=i).set_color(YELLOW_E) for i in cjto_pts_sucesion_1]
44 |
45 | Elementos_t = [TexMobject('\\vec{s}_{%i}' % i).next_to(Elementos[i], 0.08*DOWN).set_color(YELLOW_E) for i in range(0, n_sup_1 - 1)]
46 |
47 | Elementos_g = VGroup(*Elementos)
48 | Elementos_g_Y = VGroup(*Elementos_Y)
49 | Elementos_t_g = VGroup(*Elementos_t)
50 |
51 |
52 |
53 | ##animación:
54 | self.play(Write(t_1))
55 | self.wait(2.2)
56 | self.play(ReplacementTransform(t_1, t_2))
57 | self.wait(4.3)
58 | self.play(ReplacementTransform(t_2, t_3))
59 | self.wait(11.5)
60 | self.play(ReplacementTransform(t_3, t_4))
61 | self.wait(6)
62 | self.play(ReplacementTransform(t_4, t_5))
63 | self.wait(13)
64 | self.play(ReplacementTransform(t_5, t_6))
65 | self.wait(13)
66 | self.play(ReplacementTransform(t_6, t_7))
67 | self.wait(10)
68 | self.play(ReplacementTransform(t_7, t_8))
69 | self.wait(12)
70 | self.play(ReplacementTransform(t_8, t_9))
71 | self.wait(4)
72 | self.play(ReplacementTransform(t_9, grid))
73 | self.wait()
74 | self.play(Write(Elementos_g),
75 | Write(Elementos_t_g), run_time=6.35)
76 | self.wait()
77 | self.play(FadeOut(Elementos_t_g), ReplacementTransform(Elementos_g, Elementos_g_Y))
78 | self.wait(3.5)
79 | self.play(FadeOut(grid),FadeOut(Elementos_g_Y))
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/observacion1.svg:
--------------------------------------------------------------------------------
1 |
2 |
80 |
--------------------------------------------------------------------------------
/Espacios vectoriales/distributiva.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #########################################################
4 | #### PROPIEDAD DISTRIBUTIVA EN UN ESPACIO VECTORIAL #####
5 | #########################################################
6 |
7 | class Distribucion_Suma_Escalares(Scene):
8 | def construct(self):
9 | ###vectores:
10 | grid = NumberPlane()
11 | k = float(input('dame a k entre 0 y 1 \n'))
12 | j = float(input('dame a j entre 0 y 1 \n'))
13 | x = Arrow((0, 0, 0), (2, -1, 0), buff=0)
14 | k_m_j_x = Arrow((0, 0, 0), (k + j) * x.get_end(), buff=0)
15 | kx = Arrow((0, 0, 0), k * x.get_end(), buff=0)
16 | jx = Arrow((0, 0, 0), j * x.get_end(), buff=0)
17 | kx_m_jx = Arrow((0, 0, 0), kx.get_end() + jx.get_end(), buff=0)
18 | ###texto
19 | prop = TextMobject('Distribuir el producto de suma de escalares con un vector.')
20 | k_m_j_x_t = TexMobject('(k+j)\\vec{x}')
21 | kx_m_jx_t = TexMobject('k\\vec{x}+j\\vec{x}')
22 | kx_t = TexMobject('k\\vec{x}')
23 | jx_t = TexMobject('j\\vec{x}')
24 | t_1 = TextMobject('''Nota que esta propiedad es encontrar \n
25 | de vuelta otros caminitos para \n
26 | llegar a un mismo vector dentro del \n
27 | espacio vectorial, s\\'{o}lo que a diferencia \n
28 | de las propiedades dados 3 vectores \n
29 | ahora usamos un solo vector y dos escalares, \n
30 | estamos haciendo como un ``escalamiento'' de caminos. ''')
31 | t_2 = TextMobject('''Se te ocurre c\\'{o}mo realizar la animaci\\'{o}n para la propiedad:
32 | $$k(\\vec{x}+\\vec{y}) = k\\vec{x}+k\\vec{y}, \ k\in \mathbb{R}$$''')
33 | t_3 = TextMobject(''' Checa la parte inmediata despu\\'{e}s \n
34 | de la clase de \n
35 | \\textit{distribucion$\\_$suma$\\_$escalares} \n
36 | en el archivo de animaciones para\n
37 | espacios vectoriales \n
38 | para una idea de como realizar dicha animaci\\'{o}n.''')
39 | ###grupos:
40 | gpo_1 = VGroup(k_m_j_x, k_m_j_x_t)
41 | gpo_2 = VGroup(kx_m_jx, kx_m_jx_t)
42 | gpo_3 = VGroup(kx, kx_t)
43 | gpo_4 = VGroup(jx, jx_t)
44 | ###propiedades:
45 | prop.move_to((0, 2.5, 0)) \
46 | .set_color(GREEN)
47 | gpo_3.set_color(YELLOW_E)
48 | gpo_2.set_color(GREEN_C)
49 | t_2.set_color(YELLOW_E)
50 | jx.set_color(BLUE_D)
51 | jx_t.set_color(BLUE_A)
52 | k_m_j_x_t.next_to(k_m_j_x.get_end(), RIGHT)
53 | kx_m_jx_t.next_to(kx_m_jx.get_end(), RIGHT)
54 | kx_t.next_to(kx.get_end(), RIGHT)
55 | jx_t.next_to(kx.get_end(), RIGHT)
56 | ###animacion
57 | prop.bg = SurroundingRectangle(prop, color=WHITE, fill_color=BLACK,
58 | fill_opacity=1)
59 | Group11 = VGroup(prop.bg, prop)
60 | self.play(Write(grid), Write(Group11))
61 | self.wait()
62 | self.play(Write(gpo_1))
63 | self.wait()
64 | self.play(FadeOut(gpo_1))
65 | self.play(Write(gpo_3))
66 | self.wait()
67 | self.play(FadeOut(kx_t))
68 | self.play(Write(gpo_4))
69 | self.wait()
70 | self.play(FadeOut(kx))
71 | self.play(FadeOut(gpo_4))
72 | self.play(Write(gpo_2))
73 | self.wait()
74 | self.play(FadeOut(gpo_2), FadeOut(grid), FadeOut(Group11))
75 | self.wait(1.5)
76 | self.play(Write(t_1))
77 | self.wait(12)
78 | self.play(FadeOut(t_1))
79 | self.wait()
80 | self.play(Write(t_2))
81 | self.wait(7)
82 | self.play(FadeOut(t_2))
83 | self.wait()
84 | self.play(Write(t_3))
85 | self.wait(4)
--------------------------------------------------------------------------------
/Límite y continuidad en funciones multivariable/continua_acotada.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | ## Teorema fuerte: Continuas son acotadas en compactos ##
4 |
5 | class Continua_y_acotada(Scene):
6 | def construct(self):
7 | # Textos
8 | #title = TextMobject('''Continua en compactos implica acotada''').scale(1.5)
9 | title = TextMobject('''Teorema Fuerte: \n
10 | Funciones Continuas son \n
11 | Acotadas en Compactos''').scale(1.5)
12 | t1 = TextMobject('''$f:A\\subset\\mathbb{R}^n\\to\\mathbb{R}^m$ es ''','''acotada''',''' si \n
13 | $f(A)\\subset\\mathbb{R}^m$ es ''','''acotada''')
14 | t1.set_color_by_tex_to_color_map({
15 | '''acotada''': PURPLE_B
16 | })
17 | t2 = TextMobject('''Teniendo en cuenta la definición anterior consideremos el \n
18 | conjunto ''','''$A$''','''$ =[0,\\ 1.5]\\times[0,2]$ en $\\mathbb{R}^2$''')
19 | t2[1].set_color(RED)
20 | t3 = TextMobject('''Recuerda que este conjunto es ''','''compacto''').next_to(t2,DOWN).scale(0.85).shift(2.5*UP)
21 | t3[1].set_color(ORANGE)
22 | t4 = TextMobject('''Toma la función $f:A\\to\\mathbb{R}^2$ dada por $f(x,y)=(x^2,y^2)$, \n
23 | ¿cuál es la ''','''imagen''',''' de ''','''$A$''',''' bajo $f$?''').scale(1.17)
24 | t4[1].set_color(BLUE)
25 | t4[3].set_color(RED)
26 | t5 = TextMobject('''$f$ es ''','''continua''',''' y $f(A)$ es un conjunto ''','''acotado''','''. \n
27 | Intenta demostrar ambas afirmaciones.''').scale(1.17)
28 | t5[1].set_color(GREEN_D)
29 | t5[3].set_color(PURPLE_B)
30 | t6 = TextMobject('''El resultado que vimos, es uno de los teoremas importantes \n
31 | de continuidad, y dice lo siguiente:''').shift(UP*0.75)
32 | t7 = TextMobject('''Si $F:K\\subset\\mathbb{R}^n\\to\\mathbb{R}^m$ es ''','''continua''',''' y $K$ ''','''compacto''',''' \n
33 | entonces $F$ es ''','''acotada''').next_to(t6,DOWN*1)
34 | t7[-1].set_color(PURPLE_B)
35 | t7[1].set_color(GREEN_D)
36 | t7[3].set_color(ORANGE)
37 |
38 | # Ejes
39 | ejes1 = Axes(x_min=-0.5,x_max=5,y_min=-0.5,y_max=4).move_to((-6+2.25,-3+1.75,0))
40 | ejes2 = Axes(x_min=-0.5,x_max=5,y_min=-0.5,y_max=4).move_to((1.5+2.25,-3+1.75,0))
41 |
42 | # Objetos
43 | compacto = Rectangle(height=1.5,width=2,color=RED,fill_color=RED,fill_opacity=0.8).move_to((-5,-2.25,0))
44 | imagen = Rectangle(height=2.25,width=4,color=BLUE,fill_color=BLUE,fill_opacity=0.8).move_to((3.5,-1.875,0))
45 | flecha = Arrow(start=(-1,0,0),end=(1,0,0),color=WHITE)
46 | f = TexMobject(r"f(x,y)").next_to(flecha,DOWN).shift(0.25*DOWN)
47 |
48 | # Grupos
49 | Grupo0 = VGroup(t2,t3)
50 | Grupo1 = VGroup(t4,t5).to_edge(UP).scale(0.7)
51 | Grupo2 = VGroup(flecha,f)
52 | Grupo3 = VGroup(ejes1,ejes2,compacto,imagen,Grupo2,t5)
53 |
54 |
55 | # Animación
56 |
57 | self.play(Write(title))
58 | self.wait(3.25)
59 | self.play(ReplacementTransform(title,t1))
60 | self.wait(7.5)
61 | self.play(ReplacementTransform(t1,t2))
62 | self.wait(5)
63 | self.play(ApplyMethod(t2.scale,0.85))
64 | self.play(ApplyMethod(t2.to_edge,UP))
65 | self.wait()
66 | self.play(ShowCreation(ejes1))
67 | self.play(ShowCreation(compacto))
68 | self.wait()
69 | self.play(Write(t3))
70 | self.wait(3)
71 | self.play(FadeOut(t3))
72 | self.play(ReplacementTransform(t2,t4))
73 | self.wait(7)
74 | self.play(Write(Grupo2))
75 | self.play(ShowCreation(ejes2))
76 | self.play(ShowCreation(imagen))
77 | self.wait()
78 | self.play(ReplacementTransform(t4,t5))
79 | self.wait(7)
80 | self.play(FadeOut(Grupo3))
81 | self.play(Write(t6))
82 | self.wait(5)
83 | self.play(Write(t7))
84 | self.wait(5)
85 | self.play(FadeOut(t6),FadeOut(t7))
--------------------------------------------------------------------------------
/Espacios vectoriales/bases.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | ########################################
4 | #### BASES DE ESPACIOS VECTORIALES #####
5 | ########################################
6 |
7 | class Bases(Scene):
8 | def construct(self):
9 | grid = NumberPlane()
10 |
11 | ###texto:
12 |
13 | t_1 = TextMobject('Idea intuitiva de lo que significa una base.')
14 | t_2 = TextMobject('Pensemos en el plano cartesiano...')
15 | t_3 = TextMobject('y en la base usual...')
16 | t_4 = TextMobject('''la can\\'{o}nica.''')
17 | t_5 = TexMobject('\\xi = \{ \\vec{e}_1, \\vec{e}_2 \} = \{ (1,0), (0,1) \}')
18 | t_6 = TextMobject('''Supongamos que queremos "caracterizar" \n
19 | el vector $\\vec{x} = (1,2)$, con la base $\\xi$.''')
20 | t_7 = TextMobject('''Es claro que: \n
21 | $\\vec{x} = 1\\cdot(1,0)+2\\cdot(0,1) = (1,2)$''')
22 | t_8 = TextMobject('''Que geom\\'{e}tricamente es...''')
23 | t_9 = TextMobject('''Solamente caminar una vez por el camino fijado \n
24 | por el vector $\\vec{e}_1=(1,0)$ y luego caminar dos \n
25 | veces por el camino fijado por $\\vec{e}_2=(0,1)$.''')
26 | t_9.move_to((0, -1.3, 0))
27 | t_10 = TextMobject('''Ahora supongamos que tenemos la base: \n
28 | $\\gamma = \{ (2,1),(1,-1) \}$''')
29 | t_11 = TextMobject('''Sabemos que... \n
30 | $\\vec{x} = 1\cdot(2,1)+(-1)\cdot(1,-1)$''')
31 | t_12 = TextMobject('''¿Pero geom\\'{e}tricamente qu\\'{e} es esta combinaci\\'{o}n lineal?''')
32 | t_13 = TextMobject('''¡Claro! Solamente es tomar un camino distinto \n
33 | dado por esta base \n
34 | para llegar al mismo vector $\\vec{x}$ \n
35 | en el espacio vectorial $\\mathbb{R}^2$.''')
36 |
37 | ###vectores:
38 |
39 | e_1 = Arrow((0, 0, 0), (1, 0, 0), buff=0)
40 | e_2 = Arrow((0, 0, 0), (0, 1, 0), buff=0)
41 | e_2_mov_e_1 = Arrow(e_1.get_end(), (1, 2, 0), buff=0)
42 |
43 | v_1 = Arrow((0, 0, 0), (2, 1, 0), buff=0)
44 | v_2 = Arrow((0, 0, 0), (1, -1, 0), buff=0)
45 | v_1_mov_v_1 = Arrow(v_1.get_end(), (1, 2, 0), buff=0)
46 |
47 | ###propiedades
48 |
49 | e_1.set_color(YELLOW_E)
50 | e_2.set_color(YELLOW_E)
51 | e_2_mov_e_1.set_color(YELLOW_E)
52 | t_5.set_color(YELLOW_E)
53 | t_7.set_color(BLUE)
54 | t_9.set_color(YELLOW_E)
55 | t_10.set_color(YELLOW_E)
56 |
57 | t_9.bg = SurroundingRectangle(t_9, color=WHITE, fill_color=BLACK,
58 | fill_opacity=1)
59 | Group19 = VGroup(t_9.bg, t_9)
60 |
61 | ###animacion:
62 |
63 | self.play(Write(t_1))
64 | self.wait()
65 | self.play(ReplacementTransform(t_1, t_2))
66 | self.wait(2)
67 | self.play(ReplacementTransform(t_2, t_3))
68 | self.wait()
69 | self.play(ReplacementTransform(t_3, t_4))
70 | self.wait()
71 | self.play(ReplacementTransform(t_4, t_5))
72 | self.wait(3)
73 | self.play(ReplacementTransform(t_5, t_6))
74 | self.wait(4)
75 | self.play(ReplacementTransform(t_6, t_7))
76 | self.wait(4)
77 | self.play(ReplacementTransform(t_7, t_8))
78 | self.wait()
79 | self.play(FadeOut(t_8), Write(grid))
80 | self.wait()
81 | self.play(Write(e_1), Write(e_2))
82 | self.wait()
83 | self.play(ReplacementTransform(e_2, e_2_mov_e_1), Write(Group19))
84 | self.wait(4)
85 | self.play(FadeOut(e_2_mov_e_1), FadeOut(grid), FadeOut(Group19), FadeOut(e_1), Write(t_10))
86 | self.wait(3)
87 | self.play(ReplacementTransform(t_10, t_11))
88 | self.wait(3)
89 | self.play(ReplacementTransform(t_11, t_12))
90 | self.wait(2)
91 | self.play(FadeOut(t_12), Write(grid))
92 | self.wait()
93 | self.play(Write(v_1), Write(v_2))
94 | self.wait()
95 | self.play(ReplacementTransform(v_2, v_1_mov_v_1))
96 | self.wait()
97 | self.play(ReplacementTransform(VGroup(v_1_mov_v_1, grid, v_1), t_13))
98 | self.wait(3)
--------------------------------------------------------------------------------
/Espacios vectoriales/inverso_aditivo.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #######################################
4 | #### INVERSO ADITIVO DE UN VECTOR #####
5 | #######################################
6 |
7 | class Inverso_Aditivo(Scene):
8 | def construct(self):
9 | ###vectores
10 | grid = NumberPlane()
11 | x = Arrow((0, 0, 0), (1, 2, 0), buff=0)
12 | menos_x = Arrow((0, 0, 0), -1 * x.get_end(), buff=0)
13 | x_proy_y = Arrow((0, 0, 0), (0, -1 * x.get_end()[1], 0), buff=0)
14 | x_proy_x = Arrow((0, 0, 0), (-1 * x.get_end()[0], 0, 0), buff=0)
15 | mx_proy_y = Arrow((0, 0, 0), (0, x.get_end()[1], 0), buff=0)
16 | mx_proy_x = Arrow((0, 0, 0), (x.get_end()[0], 0, 0), buff=0)
17 | ###texto
18 | x_t = TextMobject('$\\vec{x} = (x_1,x_2)$')
19 | xpy_t = TextMobject('$Proj_{(0,1)}(-\\vec{x}) = (-x_1,0)$')
20 | xpx_t = TextMobject('$Proj_{(1,0)}(-\\vec{x}) = (0,-x_2)$')
21 | menosx_t = TextMobject('$-\\vec{x} = (-x_1,-x_2)$')
22 | prop = TextMobject('Inverso Aditivo.')
23 | t_1 = TextMobject('''Para el vector $\\vec{x}$ \n
24 | existe el vector $-\\vec{x}$ \n
25 | tal que hace: \n
26 | $\\vec{x}+(-\\vec{x}) = \\vec{0}$.''')
27 | t_2 = TextMobject(''' Que notemos \n
28 | que geom\\'{e}tricamente:\n
29 | hay que "voltear" \n
30 | respecto al origen \n
31 | al vector $\\vec{x}$.''')
32 | t_0 = TextMobject(''' fij\\'{e}monos en el siguiente vector \n
33 | y sus componentes. ''')
34 | t_2.bg = SurroundingRectangle(t_2, color=WHITE, fill_color=BLACK,
35 | fill_opacity=1)
36 | Group14 = VGroup(t_2.bg, t_2)
37 | ###gpos
38 | gpo_x = VGroup(x, x_t)
39 | gpo_menos_x = VGroup(menos_x, menosx_t)
40 | gpo_text_proy = VGroup(xpy_t, xpx_t)
41 | gpo_x_proy_y = VGroup(x_proy_y, xpy_t)
42 | gpo_x_proy_x = VGroup(x_proy_x, xpx_t)
43 | gpo_x_proy = VGroup(mx_proy_y, mx_proy_x)
44 | mgpo_x_proy = VGroup(x_proy_y, x_proy_x)
45 | gpo_Fade = VGroup(gpo_text_proy, mgpo_x_proy, Group14)
46 | ###propiedades:
47 | xpy_t.set_color(YELLOW_D)
48 | xpx_t.set_color(YELLOW_D)
49 | x_proy_y.set_color(YELLOW_E)
50 | x_proy_x.set_color(YELLOW_E)
51 | mx_proy_y.set_color(YELLOW_E)
52 | mx_proy_x.set_color(YELLOW_E)
53 | prop.move_to((-3, 2.5, 0))
54 | prop.set_color(GREEN)
55 | t_0.move_to((-3, 2.5, 0))
56 | t_0.set_color(GREEN)
57 | x_t.next_to(x.get_end(), RIGHT, buff=0.4)
58 | menosx_t.next_to(menos_x.get_end(), DOWN)
59 | xpy_t.next_to(x_proy_y.get_end(), RIGHT)
60 | xpx_t.next_to(x_proy_x.get_end(), UP)
61 | t_1.move_to((4, -0.5, 0)) \
62 | .scale(0.8)
63 | Group14.move_to((-4, -0.75, 0)) \
64 | .scale(0.8)
65 | ###animación:
66 | prop.bg = SurroundingRectangle(prop, color=WHITE, fill_color=BLACK,
67 | fill_opacity=1)
68 | Group11 = VGroup(prop.bg, prop)
69 | t_0.bg = SurroundingRectangle(t_0, color=WHITE, fill_color=BLACK,
70 | fill_opacity=1)
71 | Group12 = VGroup(t_0.bg, t_0)
72 | t_1.bg = SurroundingRectangle(t_1, color=WHITE, fill_color=BLACK,
73 | fill_opacity=1)
74 | Group13 = VGroup(t_1.bg, t_1)
75 | self.play(Write(Group11), Write(grid))
76 | self.wait(0.5)
77 | self.play(FadeOut(Group11))
78 | self.play(Write(Group12))
79 | self.wait(1.3)
80 | self.play(Write(gpo_x))
81 | self.play(FadeOut(Group12))
82 | self.play(Write(gpo_x_proy))
83 | self.wait(1.3)
84 | self.play(FadeOut(gpo_x))
85 | self.play(Write(mgpo_x_proy))
86 | self.play(FadeOut(gpo_x_proy))
87 | self.play(Write(gpo_text_proy))
88 | self.wait()
89 | self.play(Write(Group13))
90 | self.wait(2.5)
91 | self.play(Write(Group14), Write(gpo_menos_x), FadeOut(Group13))
92 | self.wait(2.5)
93 | self.play(FadeOut(gpo_Fade))
94 | self.play(Write(gpo_x))
--------------------------------------------------------------------------------
/Topologia/bolas.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #####################################
4 | ######## BOLAS Y VECINDADES #########
5 | #####################################
6 |
7 |
8 | class Bolas(Scene):
9 | def construct(self):
10 | grid = NumberPlane()
11 | titulo = TextMobject("Bolas o Vecindades")
12 | titulo.scale(1.5)
13 | text1 = TextMobject("Tomemos un punto en el espacio, $\\vec{x}_0$")
14 | text1.move_to((0, 3, 0))
15 | text2 = TextMobject("Y un radio ", "r ", "> 0")
16 | text2[1].set_color(TEAL)
17 | text2.move_to(text1)
18 | text_3_1=TextMobject("Podemos seleccionar los puntos que se encuentran")
19 | text_3_2=TextMobject("a una distancia menor a ", "r", " de $\\vec{x}_0$").next_to(text_3_1,DOWN)
20 | text_3_2[1].set_color(TEAL)
21 | text3=VGroup(text_3_1,text_3_2)
22 | text3.move_to(text1)
23 | text4 = TextMobject("""Esto es conocido como una bola o vecindad""")
24 | text4.move_to(text1)
25 | text5 = TextMobject("De manera formal, definimos bola o vecindad como:")
26 | text6 = TexMobject(
27 | "B_r(\\vec{x}_0) :=\\lbrace \\vec{x} \\ | \\ d(\\vec{x},\\vec{x}_0)=\\norm{\\vec{x}-\\vec{x}_0}0,\ B_{\varepsilon}\cap A\neq\emptyset"
86 | ).next_to(text3, DOWN)
87 |
88 | # Secuencia de la animación
89 | self.play(Write(title.scale(1.5)))
90 | self.wait()
91 | self.play(FadeOut(title), run_time=0.5)
92 | self.play(Write(defi))
93 | self.play(Write(defi2))
94 | self.wait(2)
95 | self.play(ApplyMethod(group2.to_edge, UP))
96 | #
97 | self.play(DrawBorderThenFill(conjuntoA), rate_func=linear)
98 | self.play(Write(nameA))
99 | self.wait(1)
100 | self.play(Write(note), run_time=6)
101 | self.wait(1)
102 | self.play(FadeOut(group))
103 | #
104 | self.play(Write(text1))
105 | self.wait(2)
106 | self.play(ReplacementTransform(text1, text2))
107 | self.play(ApplyMethod(text2.to_edge, UP))
108 | self.play(DrawBorderThenFill(conjuntos2), Write(names))
109 | self.wait()
110 | self.play(ReplacementTransform(conjuntos2, conjuntos))
111 | self.wait(9)
112 | self.play(FadeOut(conjuntos), FadeOut(text2), FadeOut(names))
113 | #
114 | self.play(Write(text3))
115 | self.play(Write(prop1))
116 | self.wait(14)
117 | self.play(FadeOut(text3), FadeOut(prop1))
--------------------------------------------------------------------------------
/Espacios vectoriales/operaciones.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | ###################################
4 | #### OPERACIONES CON VECTORES #####
5 | ###################################
6 |
7 | ######Hint para crear la animación
8 | ###Primero crea una clase con el nombre de animación.
9 | ###Luego necesitas crear una "construcción" (función) para que manim ejecute el objeto animación
10 | ###Luego tendrás que definir vectores...
11 | ###No solo ellos, tambien sus propiedades como en las animaciones anteriores
12 | ###Finalmente dile a la computadora cómo deben ser realizadas las animaciones con "self.play[...etc.]"
13 |
14 | ######¿Qué conclusiones geométricas puedes obtener de ésta animación?
15 |
16 |
17 | #### Operaciones con vectores representados por flechas ####
18 |
19 |
20 | # Puedes modificar estos parámetros para probar diferentes vectores y escalares #
21 |
22 | a = np.array([1, 1, 0])
23 | b = np.array([-2, 1, 0])
24 | c = -1.5
25 |
26 | #### considera que el plano es [-7,7]x[-4,4] ####
27 |
28 | text_pos = np.array([-4, 2.6, 0])
29 |
30 |
31 | class Opera(Scene):
32 | def construct(self):
33 | plano = NumberPlane()
34 |
35 | vec1 = Vector(direction=a, color=RED)
36 | vec1_name = TexMobject("a")
37 | vec1_name.next_to(vec1.get_corner(RIGHT + UP), RIGHT)
38 | vec2 = Vector(direction=b, color=GOLD_E)
39 | vec2_name = TexMobject("b")
40 | vec2_name.next_to(vec2.get_corner(LEFT + UP), LEFT)
41 |
42 | #### Suma ####
43 |
44 | vecsum = Vector(direction=a + b, color=GREEN_SCREEN)
45 | vecsum_name = TexMobject("a+b").set_color(GREEN_SCREEN)
46 | vecsum_name.next_to(vecsum, LEFT)
47 | suma1 = TextMobject("Podemos ver la suma de dos")
48 | suma2 = TextMobject("vectores con flechas")
49 | suma2.next_to(suma1, DOWN)
50 | suma = VGroup(suma1, suma2)
51 | suma.scale(0.75)
52 |
53 | suma.bg = SurroundingRectangle(suma, color=WHITE, fill_color=BLACK,
54 | fill_opacity=1)
55 | Group11 = VGroup(suma.bg, suma)
56 | #### Multiplicar por escalar ####
57 | vecesc = Vector(direction=c * a, color=RED)
58 | vecesc_name = TexMobject(str(c) + "a")
59 | vecesc_name.next_to(vecesc, DOWN)
60 | esc1 = TextMobject("Tambi\\'{e}n podemos multiplicar")
61 | esc2 = TextMobject("vectores por un escalar del campo")
62 | esc2.next_to(esc1, DOWN)
63 | esc = VGroup(esc1, esc2)
64 | esc.scale(0.75)
65 | valor = TexMobject(r"\text{En este caso el escalar es}" + str(c))
66 | valor.scale(0.75)
67 | valor.move_to(text_pos)
68 |
69 | esc.bg = SurroundingRectangle(esc, color=WHITE, fill_color=BLACK,
70 | fill_opacity=1)
71 | Group12 = VGroup(esc.bg, esc)
72 |
73 | valor.bg = SurroundingRectangle(valor, color=WHITE, fill_color=BLACK,
74 | fill_opacity=1)
75 | Group13 = VGroup(valor.bg, valor)
76 | #### Desafíos ####
77 | ejem = TextMobject("Puedes modificar los vectores y el escalar para probar tus propios ejemplos,").scale(0.75)
78 | ejem2 = TextMobject("encontrar\\'{a}s m\\'{a}s informaci\\'{o}n en el c\\'{o}digo de este video.").scale(0.75)
79 | ejem2.next_to(ejem, DOWN)
80 |
81 | #Animación
82 | #Animación suma
83 | self.play(FadeIn(Group11))
84 | self.play(ApplyMethod(Group11.move_to, text_pos))
85 | self.play(ShowCreation(plano))
86 | self.play(ShowCreation(vec1), ShowCreation(vec2), Write(vec1_name), Write(vec2_name))
87 | self.wait()
88 | self.play(ApplyMethod(vec2.move_to, a + b / 2), ApplyMethod(vec2_name.move_to, a + b / 2))
89 | self.wait()
90 | self.play(ShowCreation(vecsum), Write(vecsum_name))
91 | self.wait()
92 | self.play(FadeOut(vec1), FadeOut(vec2), FadeOut(vecsum), FadeOut(plano), FadeOut(Group11), FadeOut(vec1_name),
93 | FadeOut(vec2_name), FadeOut(vecsum_name))
94 | #Animación escalar
95 | self.play(Write(Group12))
96 | self.play(ApplyMethod(Group12.move_to, text_pos))
97 | self.play(ShowCreation(plano))
98 | self.play(ShowCreation(vec1), Write(vec1_name))
99 | self.wait()
100 | self.play(ReplacementTransform(Group12, Group13))
101 | self.play(ReplacementTransform(vec1, vecesc), ReplacementTransform(vec1_name, vecesc_name))
102 | self.wait(2)
103 | self.play(FadeOut(plano), FadeOut(vecesc_name), FadeOut(Group13), FadeOut(vecesc))
104 | #Animación desafíos
105 | self.play(Write(ejem), Write(ejem2))
106 | self.wait(3)
107 | self.play(FadeOut(ejem), FadeOut(ejem2))
--------------------------------------------------------------------------------
/Sucesiones/teo_puente.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #########################################
4 | #### TEOREMA PUENTE DE SUCESIONES #####
5 | #########################################
6 |
7 | class Teo_Puente(Scene):
8 | def construct(self):
9 |
10 | plano = NumberPlane()
11 |
12 | title = TextMobject('''Teorema Puente''')
13 | title.scale(1.2)
14 | title.set_color(YELLOW)
15 | intro = TextMobject('''El teorema dice:''').shift(2 * UP)
16 | teo1 = TexMobject(
17 | r'''\text{Sea } \{X_n\}\subset\mathbb{R}^m\text{ sucesi\'{o}n. } \forall k\in\{1,...,m\} \lim_{n\to\infty}X_{n,k}=L_k''')
18 | teo2 = TexMobject(r'''\Longleftrightarrow \lim_{n\to\infty} X_{n}=L=(L_1,...,L_k,...,L_m)''')
19 | teo2.next_to(teo1, DOWN)
20 | teo = VGroup(teo1, teo2)
21 | ejemplos = TextMobject("Veamos algunos ejemplos de su aplicación")
22 |
23 |
24 |
25 | ## Primer ejemplo ##
26 |
27 | ejem1 = TexMobject(r'''X_n=\left(\frac{6}{n},0\right)''').shift(1.5 * UP)
28 | desc1 = TexMobject(r'''\Rightarrow X_{n,1}=\frac{6}{n}\quad X_{n,2}=0''')
29 | teoapl1 = TexMobject(
30 | r'''\lim_{n\to\infty}\frac{6}{n}=0,\ \lim_{n\to\infty}0=0\Rightarrow\lim_{n\to\infty}X_n=(0,0)''').shift(
31 | 1.5 * DOWN)
32 | vis = TextMobject('''Veamos esta sucesi\\'{o}n''')
33 | ejem1.set_color(RED)
34 | ejem1.bg = SurroundingRectangle(ejem1, color=RED, fill_color=BLACK,
35 | fill_opacity=1)
36 | Group11 = VGroup(ejem1.bg, ejem1)
37 |
38 |
39 |
40 | suce1 = []
41 | for n in range(1, 101):
42 | x_n = Dot(point=np.array([6 / n, 0, 0]), radius=0.05, color=RED)
43 | suce1.append(x_n)
44 | sucesion1 = VGroup(*suce1)
45 |
46 |
47 |
48 | ## Segundo ejemplo ##
49 |
50 | ejem2 = TexMobject(r'''X_n =\left(\frac{n}{10},\frac{1}{n}\right)''').shift(1.5 * UP)
51 | desc2 = TexMobject(r'''\Rightarrow X_{n,1}=\frac{n}{10}\quad X_{n,2}=\frac{1}{n}''')
52 | teoapl2 = TexMobject(
53 | r'''\nexists\lim_{n\to\infty}\frac{n}{10} \Rightarrow \nexists\lim_{n\to\infty}X_n''').shift(1.5 * DOWN)
54 | vis = TextMobject('''Veamos esta sucesi\\'{o}n''')
55 | ejem2.set_color(YELLOW_E)
56 | ejem2.bg = SurroundingRectangle(ejem2, color=YELLOW_E, fill_color=BLACK,
57 | fill_opacity=1)
58 | Group12 = VGroup(ejem2.bg, ejem2)
59 |
60 |
61 |
62 | suce2 = []
63 | for n in range(1, 101):
64 | x_n = Dot(point=np.array([n / 10, 1 / n, 0]), radius=0.05, color=YELLOW_E)
65 | suce2.append(x_n)
66 | sucesion2 = VGroup(*suce2)
67 |
68 |
69 |
70 | ## Desaf\\'{i}o ##
71 |
72 | desa1 = TextMobject('''Es tu turno de usar el teorema''')
73 | desa2 = TextMobject('''Demuestra el valor del l\\'{i}mite de la siguiente sucesi\\'{o}n. Usa \n
74 | la definici\\'{o}n e int\\'{e}ntalo despu\\'{e}s usando el teorema puente:''').shift(UP)
75 | desa = TexMobject(r'''X_n=\left(6\frac{(-1)^n}{n},\frac{4}{n}\right)''').shift(DOWN)
76 | desa.set_color(ORANGE)
77 | desa.bg = SurroundingRectangle(desa, color=ORANGE, fill_color=BLACK,
78 | fill_opacity=1)
79 | Group13 = VGroup(desa.bg, desa)
80 |
81 |
82 |
83 | suce5 = []
84 | for n in range(1, 101):
85 | x_n = Dot(point=np.array([6 * (-1) ** n / n, 4 / n, 0]), radius=0.05, color=ORANGE)
86 | suce5.append(x_n)
87 | sucesion5 = VGroup(*suce5)
88 |
89 |
90 |
91 | #animación
92 |
93 | self.play(Write(title))
94 | self.wait(2)
95 | self.play(ReplacementTransform(title, intro), Write(teo))
96 | self.wait(20)
97 | self.play(FadeOut(intro), FadeOut(teo))
98 | self.play(Write(ejemplos))
99 | self.wait(3.2)
100 |
101 | self.play(ReplacementTransform(ejemplos, ejem1))
102 | self.wait(2.5)
103 | self.play(Write(desc1))
104 | self.wait(7)
105 | self.play(Write(teoapl1))
106 | self.wait(10)
107 | self.play(ReplacementTransform(desc1, vis), FadeOut(teoapl1))
108 | self.wait(2)
109 | self.play(Transform(ejem1, Group11))
110 | self.play(ApplyMethod(Group11.to_edge, UP), FadeOut(vis))
111 | self.add_foreground_mobjects(Group11)
112 |
113 | self.play(ShowCreation(plano), run_time=0.5)
114 | self.play(Write(sucesion1), run_time=5)
115 | self.wait(3)
116 | self.play(FadeOut(Group11), FadeOut(plano), FadeOut(sucesion1))
117 |
118 | self.play(Write(ejem2))
119 | self.wait(2.5)
120 | self.play(Write(desc2))
121 | self.wait(2)
122 | self.play(Write(teoapl2))
123 | self.wait(7)
124 | self.play(ReplacementTransform(desc2, vis), FadeOut(teoapl2))
125 | self.wait(2)
126 | self.play(Transform(ejem2, Group12))
127 | self.play(ApplyMethod(Group12.to_edge, UP), FadeOut(vis))
128 | self.add_foreground_mobjects(Group12)
129 |
130 | self.play(ShowCreation(plano), run_time=0.5)
131 | self.play(Write(sucesion2), run_time=5)
132 | self.wait(3)
133 | self.play(FadeOut(Group12), FadeOut(plano), FadeOut(sucesion2))
134 |
135 | self.play(Write(desa1))
136 | self.wait(2.5)
137 | self.play(FadeOut(desa1), Write(desa2), Write(desa))
138 | self.wait(15)
139 | self.play(Transform(desa, Group13))
140 | self.play(FadeOut(desa2), ApplyMethod(Group13.to_edge, UP))
141 | self.add_foreground_mobjects(Group13)
142 |
143 | self.play(ShowCreation(plano), run_time=0.5)
144 | self.play(Write(sucesion5), run_time=5)
145 | self.wait(4)
146 | self.play(FadeOut(plano), FadeOut(sucesion5), FadeOut(Group13))
--------------------------------------------------------------------------------
/Topologia/lebesgue.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | ############################
4 | ### NÚMERO DE LEBESGE ######
5 | ############################
6 |
7 |
8 | class NumLebesgue(Scene):
9 | def construct(self):
10 | grid = NumberPlane()
11 | ###Texto
12 | titulo = TextMobject("""Lema del N\\'{u}mero de Lebesgue""")
13 | titulo.scale(1.2)
14 | t_1 = TextMobject("""Sea $X \\subset \\mathbb{R}^{n}$ compacto""").move_to(
15 | 3 * UP
16 | )
17 | t_2 = TextMobject("y $\\mathcal{F}$ una cubierta abierta de $X$").move_to(
18 | 3 * UP
19 | )
20 | t_3 = TextMobject("$\\implies \\exists$ $\\epsilon > 0$").move_to(3 * UP)
21 | t_4 = TextMobject("tal que $\\forall$ $x \in X$").move_to(3 * UP)
22 | t_5 = TextMobject("$\\exists$ $U \\in \\mathcal{F}$").move_to(3 * UP)
23 | t_6 = TextMobject("tal que $B(x, \\epsilon) \\subseteq U$").move_to(3 * UP)
24 | t_7 = TextMobject(" \\textquestiondown Puedes probarlo formalmente?")
25 |
26 | ###Dibujos
27 |
28 | Conjunto_Cubierto = SVGMobject("Topologia_SVGs/Lebesgue.svg").scale(2)
29 | X = Conjunto_Cubierto[0].set_color(GREEN).next_to(t_1, 5 * DOWN)
30 | cover = Conjunto_Cubierto[1:7].next_to(t_2, 2 * DOWN)
31 | colors = it.cycle([YELLOW, RED, PURPLE, PINK, BLUE, TEAL, WHITE])
32 | for i in range(len(cover)):
33 | color = next(colors)
34 | cover[i].set_fill(color, opacity=0.4).set_stroke(color, 0.5)
35 | line = Line(np.array([1, 0, 0]), np.array([1.27, 0, 0])).move_to((1, -0.8, 0))
36 | brace = Brace(line, UP)
37 | epsilon = TextMobject("$\\epsilon$").next_to(brace, UP)
38 | dot = Dot((0, 0, 0), color=WHITE, radius=0.05).move_to(line, LEFT)
39 | x = TextMobject("$x_1$").next_to(dot, LEFT)
40 | U1 = TextMobject("$U_1$").next_to(cover[5], RIGHT)
41 | U3 = TextMobject("$U_2$").next_to(cover[1], LEFT)
42 | U4 = TextMobject("$U_3$").next_to(cover[0], LEFT)
43 | U5 = TextMobject("$U_4$").next_to(cover[4], RIGHT)
44 | circle = Circle(
45 | radius=0.2, fill_color=RED, color=RED, fill_opacity=0.8
46 | ).move_to(dot)
47 |
48 | line3 = Line(np.array([1, 0, 0]), np.array([1.27, 0, 0])).move_to(
49 | (-0.85, -0.75, 0)
50 | )
51 | dot3 = Dot((0, 0, 0), color=WHITE, radius=0.05).move_to(line3, LEFT)
52 | x3 = TextMobject("$x_2$").next_to(dot3, LEFT)
53 | circle3 = Circle(
54 | radius=0.2, fill_color=RED, color=RED, fill_opacity=0.8
55 | ).move_to(dot3)
56 |
57 | line4 = Line(np.array([1, 0, 0]), np.array([1.27, 0, 0])).move_to((-1.7, 1, 0))
58 | dot4 = Dot((0, 0, 0), color=WHITE, radius=0.05).move_to(line4, LEFT)
59 | x4 = TextMobject("$x_3$").next_to(dot4, DOWN)
60 | circle4 = Circle(
61 | radius=0.2, fill_color=RED, color=RED, fill_opacity=0.8
62 | ).move_to(dot4)
63 |
64 | line5 = Line(np.array([1, 0, 0]), np.array([1.27, 0, 0])).move_to(
65 | (-0.55, 1.2, 0)
66 | )
67 | dot5 = Dot((0, 0, 0), color=WHITE, radius=0.05).move_to(line5, LEFT)
68 | x5 = TextMobject("$x_4$").next_to(dot5, UP)
69 | circle5 = Circle(
70 | radius=0.2, fill_color=RED, color=RED, fill_opacity=0.8
71 | ).move_to(dot5)
72 |
73 | ###Grupos
74 | Group_1 = VGroup(t_1, X)
75 | Group_2 = VGroup(line, brace, epsilon)
76 | Group_3 = VGroup(dot, dot3, dot4, dot5, x, x3, x4, x5)
77 | Group_4 = VGroup(line, brace, epsilon, dot, dot3, dot4, dot5, x, x3, x4, x5)
78 | Group_5 = VGroup(
79 | line,
80 | line3,
81 | line4,
82 | line5,
83 | brace,
84 | epsilon,
85 | dot,
86 | dot3,
87 | dot4,
88 | dot5,
89 | x,
90 | x3,
91 | x4,
92 | x5,
93 | cover,
94 | X,
95 | t_6,
96 | circle,
97 | circle3,
98 | circle4,
99 | circle5,
100 | U1,
101 | U3,
102 | U4,
103 | U5,
104 | )
105 | Group_6 = VGroup(x, x3, x4, x5)
106 | Group_7 = VGroup(line3, line4, line5)
107 |
108 | # animación
109 | self.play(Write(titulo))
110 | self.wait(2)
111 | self.play(ReplacementTransform(titulo, Group_1))
112 | self.wait(4)
113 | self.play(ReplacementTransform(t_1, t_2))
114 | self.play(FadeIn(cover))
115 | self.wait(2)
116 | self.play(ReplacementTransform(t_2, t_3))
117 | self.play(FadeIn(Group_2))
118 | self.play(FadeOut(brace))
119 | self.play(FadeOut(epsilon))
120 | self.add(Group_3)
121 | self.play(ReplacementTransform(t_3, t_4))
122 | self.play(FadeIn(Group_7))
123 | self.wait(2.2)
124 | self.play(FadeOut(Group_6))
125 | self.play(ReplacementTransform(t_4, t_5))
126 | self.play(DrawBorderThenFill(cover[5].set_stroke(WHITE, 1)))
127 | self.add(U1)
128 | self.play(DrawBorderThenFill(cover[1].set_stroke(WHITE, 1)))
129 | self.add(U3)
130 | self.play(DrawBorderThenFill(cover[0].set_stroke(WHITE, 1)))
131 | self.add(U4)
132 | self.play(DrawBorderThenFill(cover[4].set_stroke(WHITE, 1)))
133 | self.add(U5)
134 | self.wait(3)
135 | self.play(ReplacementTransform(t_5, t_6))
136 | self.play(DrawBorderThenFill(circle))
137 | self.play(DrawBorderThenFill(circle3))
138 | self.play(DrawBorderThenFill(circle4))
139 | self.play(DrawBorderThenFill(circle5))
140 | self.play(FadeIn(Group_4))
141 | self.wait(4)
142 | self.wait(4)
143 | self.play(ReplacementTransform(Group_5, t_7))
144 | self.wait(3)
145 | self.play(FadeOut(t_7))
--------------------------------------------------------------------------------
/Límite y continuidad en funciones multivariable/contiuas_abiertos.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | class FunContinuasEnAbiertos (Scene):
4 | def construct(self):
5 | titulo=TextMobject('''Funciones Continuas y Abiertos''').scale(1.5)
6 | titulo1=TextMobject('''La imagen inversa de un abierto,\n
7 | bajo una función continua,\n
8 | es un abierto''').move_to(-0.5*UP).scale(1.5)
9 | text1=TextMobject('''Tomemos la función ''',''' $f(x,y)=(x^{2},y)$''','''$ \ , \ (x,y)\\in\\mathbb{R}^{2}$''').move_to(1*UP)
10 | text2=TextMobject('''Notemos que $Im(f)={(x,z)\\in\\mathbb{R}^2|x\\geq 0}$ y''').move_to(0*UP)
11 |
12 | text3=TextMobject(''' $f(x,y)$ es continua en $\\mathbb{R}^{2}$''').move_to(1*DOWN)
13 | text4=TextMobject('''Ahora tomemos un abierto en el contradominio de f \n
14 | $U\\subset\\mathbb{R}^{2}$''').move_to(2.3*UP)
15 | text5=TextMobject('''Tomemos la imagen inversa de U''').move_to(text4)
16 | text6=TextMobject(''' $f^{-1}(U)$\n
17 | $\\leftarrow$ ''').move_to(-1*UP)
18 | text7=TextMobject('''Lo mismo ocurre con cualquier abierto de $\\mathbb{R}^{2}$''').move_to(text5)
19 | text8=TextMobject(''' $f^{-1}(A)$\n
20 | $\\leftarrow$ ''').move_to(-1*UP)
21 |
22 | textf=TextMobject('''$f:\\mathbb{R}^{n}\\rightarrow\\mathbb{R}^{m}$\n''',
23 | '''f es continua en $\\bf{TODO}$ $\\mathbb{R}^{n}$\n
24 | si solo si para todo \n ''',
25 | '''$ U\\subset\\mathbb{R}^{m}$ abierto \n
26 | se cumple que $f^{-1}(U)$ es abierto ''')
27 | textf1=TextMobject(''' Lo mismo ocurre si el dominio de $f$ es abierto,\n
28 | ''',''' ¿qué pasa si no lo es? \n
29 | ''',''' Investiga sobre topología relativa.''')
30 | textf2=TextMobject('''También puedes modificar el código para ver más \n
31 | ejemplos con cajas''')
32 | linea1=Arrow((-6,-4,0),(-0.5,-4,0),stroke_width=6,color=WHITE,buff=0)
33 | linea2=Arrow((-3.5,-7,0),(-3.5,0,0),stroke_width=6,color=WHITE,buff=0)
34 | G1=VGroup(linea1,linea2).move_to(-2.5*UP+3.5*LEFT)
35 |
36 | linea3=Arrow((0.5,-4,0),(6,-4,0),stroke_width=6,color=WHITE,buff=0)
37 | linea4=Arrow((3,-7,0),(3,0,0),stroke_width=6,color=WHITE,buff=0)
38 | G2=VGroup(linea3,linea4).move_to(3.5*RIGHT-2.5*UP)
39 |
40 | #Pueden cambiar estos parametros para cambiar la caja de la imagen inversa
41 | r1=1#altura
42 | r2=1.5#ancho
43 |
44 | caja1=Rectangle(height=r1, width=r2,fill_color=YELLOW_C,color=YELLOW_C ,fill_opacity=1,buff=0).move_to((3.7+(-r2/2))*LEFT-2.5*UP)
45 |
46 | caja2=Rectangle(height=r1, width=r2*r2,fill_color=PURPLE_C,color=PURPLE_C ,fill_opacity=1,buff=0).move_to((3.3+r2*r2/2)*RIGHT+-2.5*UP)
47 | caja2label=TextMobject("U").next_to(caja2)
48 | #Tambien se puede cambiar r3 y r4 para cambiar los tamaños de la caja en el 2do ejemplo
49 | r3=2#altura
50 | r4=2#ancho
51 | #posiciones de la caja, por si se quiere
52 | #usar una caja que no este esquinada y elevada en y en el segundo ejemplo
53 | y=0
54 |
55 | caja3=Rectangle(height=r3, width=(r4/3),fill_color=YELLOW_C,color=YELLOW_C ,fill_opacity=1,buff=0).move_to((4.7)*LEFT+(-3+(r3/2))*UP)
56 |
57 | caja5=Rectangle(height=r3, width=(r4/3),fill_color=YELLOW_C,color=YELLOW_C ,fill_opacity=1,buff=0).move_to((2.8)*LEFT+(-3+(r3/2))*UP)
58 |
59 | caja4=Rectangle(height=r3, width=(r4/2)**2,fill_color=PURPLE_C,color=PURPLE_C ,fill_opacity=1,buff=0).move_to((3.8+((((r4/2)**2)/2)))*RIGHT+(-3+(r3/2))*UP)
60 | caja4label=TextMobject("A").next_to(caja4)
61 |
62 | punto=np.array([1,-4,0])
63 |
64 |
65 | ### Animación
66 | self.play(Write(titulo))
67 | self.wait()
68 | self.play(titulo.shift,2*UP,runtime=1.5)
69 | self.wait(2)
70 | self.play(Write(titulo1))
71 | self.wait(5)
72 | self.play(FadeOut(titulo),FadeOut(titulo1))
73 | self.play(Write(text1))
74 | self.wait(6)
75 | self.play(Write(text2))
76 | self.wait(3)
77 | self.play(Write(text3))
78 | self.wait(4)
79 | self.play(FadeOut(text1[0]),FadeOut(text2),FadeOut(text3),FadeOut(text1[2]))
80 | self.play(text1[1].shift,2.5*UP+1.2*LEFT,runtime=1.5)
81 | self.play(ShowCreation(G1),ShowCreation(G2))
82 | self.play(Write(text4))
83 | self.wait(6)
84 | self.play(ShowCreation(caja2),Write(caja2label))
85 | self.play(ReplacementTransform(text4,text5))
86 | self.wait(3)
87 | self.play(Write(text6))
88 | self.wait()
89 | self.play(ShowCreation(caja1))
90 | self.play(ReplacementTransform(text5,text7))
91 | self.wait(5)
92 | self.play(ReplacementTransform(caja2,caja4),ReplacementTransform(caja2label,caja4label))
93 | self.play(ReplacementTransform(text6,text8))
94 | self.play(ReplacementTransform(caja1,caja3))
95 | self.play(ShowCreation(caja5))
96 | self.wait()
97 | self.play(FadeOut(caja3),FadeOut(caja4),FadeOut(caja5),FadeOut(G1),FadeOut(G2),FadeOut(text8),FadeOut(text1[1]),
98 | FadeOut(text7),FadeOut(caja4label) )
99 | self.play(Write(textf[0]))
100 | self.wait(5)
101 | self.play(Write(textf[1]))
102 | self.wait()
103 | self.play(Write(textf[2]))
104 | self.wait(5)
105 | self.play(FadeOut(textf))
106 | self.play(Write(textf1[0]))
107 | self.wait(5)
108 | self.play(Write(textf1[1]))
109 | self.wait(2)
110 | self.play(Write(textf1[2]))
111 | self.wait(3)
112 | self.play(ReplacementTransform(textf1,textf2))
113 | self.wait(5)
114 | self.play(FadeOut(textf2))
--------------------------------------------------------------------------------
/Topologia/Topologia_SVGs/cjtoB.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
165 |
--------------------------------------------------------------------------------
/Sucesiones/ejemplos.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | ###################################
4 | #### EJEMPLOS DE SUCESIONES #####
5 | ###################################
6 |
7 | class Ejemplos_Sucesiones(Scene):
8 | def construct(self):
9 |
10 | plano = NumberPlane()
11 |
12 | title = TextMobject(r"Visualizando", r" Sucesiones").scale(1.5)
13 | title[1].set_color(YELLOW)
14 | converg = TextMobject(r"Veamos algunos ejemplos de", r" sucesiones convergentes.")
15 | converg[1].set_color(ORANGE)
16 |
17 | ## Ejemplos de sucesiones convergentes
18 |
19 | ## Primer ejemplo ##
20 |
21 | ejem1 = TexMobject(r"X_n=\left(\frac{6}{n},0\right)")
22 | ejem1.bg=SurroundingRectangle(ejem1, color=WHITE, fill_color=BLACK, fill_opacity=1)
23 | ej1=VGroup(ejem1.bg,ejem1)
24 |
25 | suce1 = []
26 | for n in range(1,101): #LOS VALORES DE N VAN DESDE EL 1 AL 100
27 | x_n = Dot(point=np.array([6/n,0,0]),radius=0.05,color=RED)
28 | suce1.append(x_n)
29 | sucesion1 = VGroup(*suce1)
30 |
31 | preg1 = TextMobject("¿Cuál es el límite de esta sucesión?")
32 | preg2 = TextMobject("Demuéstralo usando la definición.")
33 |
34 | ## Segundo ejemplo ##
35 |
36 | eje2=TextMobject("Observemos un segundo ejemplo:")
37 |
38 | ejem2 = TexMobject(r"X_n=\left(\cos\left(\frac{1}{n}\right),e^{1/n}\right)")
39 | ejem2.bg=SurroundingRectangle(ejem2, color=WHITE, fill_color=BLACK, fill_opacity=1)
40 | ej2 = VGroup(ejem2.bg, ejem2)
41 |
42 | suce2 = []
43 | for n in range(1,101):
44 | x_n = Dot(point=np.array([np.cos(1/n),np.exp(1/n),0]),radius=0.04,color=PINK)
45 | suce2.append(x_n)
46 | sucesion2 = VGroup(*suce2)
47 |
48 | preg1 = TextMobject("¿Cuál es el límite de esta sucesión?")
49 | preg2 = TextMobject("Demuéstralo usando la definición.")
50 |
51 |
52 | #Ejemplos de sucesiones NO convergentes
53 |
54 | diverg = TextMobject(r"Ahora, visualicemos una", r" sucesión no convergente:")
55 | diverg[1].set_color(YELLOW)
56 |
57 | ## Tercer ejemplo ##
58 |
59 | ejem3 = TexMobject(r"X_n=\left(\frac{n}{10},\frac{1}{n}\right)")
60 | ejem3.bg=SurroundingRectangle(ejem3, color=WHITE, fill_color=BLACK, fill_opacity=1)
61 | ej3 = VGroup(ejem3.bg, ejem3)
62 |
63 | suce3 = []
64 | for n in range(1,101):
65 | x_n = Dot(point=np.array([n/10,1/n,0]),radius=0.05,color=YELLOW)
66 | suce3.append(x_n)
67 | sucesion3 = VGroup(*suce3)
68 |
69 | ## Cuarto ejemplo ##
70 |
71 | eje4=TextMobject("Veamos un último ejemplo:")
72 |
73 | ejem4 = TexMobject(r"X_n=\left(e^{n/50}\cos\left(\frac{n}{5}\right),e^{n/50}\sin\left(\frac{n}{5}\right)\right)")
74 | ejem4.bg=SurroundingRectangle(ejem4, color=WHITE, fill_color=BLACK, fill_opacity=1)
75 | ej4 = VGroup(ejem4.bg, ejem4)
76 |
77 | suce4 = []
78 | for n in range(1,101):
79 | x_n = Dot(point=np.array([np.exp(n/50)*np.cos(n/5),np.exp(n/50)*np.sin(n/5),0]),radius=0.05,color=GREEN_SCREEN)
80 | suce4.append(x_n)
81 | sucesion4 = VGroup(*suce4)
82 |
83 | preg_1 = TextMobject('''¿Cómo demostrarías que el límite de esta sucesión no existe? \n
84 | Usa la definición.''')
85 | preg_2 = TextMobject('''Usando lo que sabes de sucesiones en $\\mathbb{R}$, \n
86 | ¿de qué otro modo probarías la convergencia, \n
87 | o no convergencia, de una sucesión? ''')
88 |
89 | #Reproduciendo las animaciones
90 | self.play(Write(title))
91 | self.wait()
92 | self.play(ReplacementTransform(title,converg))
93 | self.wait(2)
94 | self.play(FadeOut(converg))
95 | self.play(ShowCreation(plano),run_time=0.5)
96 | self.play(GrowFromCenter(ej1))
97 | self.wait(1)
98 | self.play(ApplyMethod(ej1.to_edge,UP))
99 | self.play(Write(sucesion1),run_time=3)
100 | self.wait()
101 | self.play(FadeOut(ej1),FadeOut(plano),FadeOut(sucesion1))
102 | self.play(Write(eje2))
103 | self.wait()
104 | self.play(FadeOut(eje2))
105 | self.play(ShowCreation(plano),run_time=0.5)
106 | self.play(GrowFromCenter(ej2))
107 | self.wait(1)
108 | self.play(ApplyMethod(ej2.to_edge,DOWN))
109 | self.play(Write(sucesion2),run_time=3)
110 | self.wait(0.5)
111 | self.play(FadeOut(plano),FadeOut(sucesion2))
112 | self.play(ApplyMethod(ej2.to_edge,UP))
113 | self.play(Write(preg1))
114 | self.wait(1.5)
115 | self.play(FadeOut(ej2))
116 | self.play(ReplacementTransform(preg1,preg2))
117 | self.wait(10)
118 | self.play(FadeOut(preg2))
119 | self.wait()
120 | self.play(Write(diverg))
121 | self.wait()
122 | self.play(FadeOut(diverg))
123 | self.play(ShowCreation(plano),run_time=0.5)
124 | self.play(GrowFromCenter(ej3))
125 | self.wait(1)
126 | self.play(ApplyMethod(ej3.to_edge,UP))
127 | self.play(Write(sucesion3),run_time=3)
128 | self.wait()
129 | self.play(FadeOut(ej3),FadeOut(plano),FadeOut(sucesion3))
130 | self.play(Write(eje4))
131 | self.wait()
132 | self.play(ShrinkToCenter(eje4))
133 | self.play(ShowCreation(plano),run_time=0.5)
134 | self.play(GrowFromCenter(ej4))
135 | self.wait(1)
136 | self.play(ApplyMethod(ej4.to_edge,UP))
137 | self.play(Write(sucesion4),run_time=3)
138 | self.wait()
139 | self.play(FadeOut(plano),FadeOut(sucesion4))
140 | self.play(ApplyMethod(ej4.to_edge,UP))
141 | self.play(Write(preg_1))
142 | self.wait(2)
143 | self.play(FadeOut(ej4))
144 | self.play(ReplacementTransform(preg_1,preg_2))
145 | self.wait(7)
146 | self.play(FadeOut(preg_2))
--------------------------------------------------------------------------------
/Límite y continuidad en funciones multivariable/limite_infinito_R-Rn.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #### Limite al infinito positivo
4 | class superficie2(ParametricSurface):
5 | def __init__(self, **kwargs):
6 | kwargs = {
7 | "u_min": 0.1,
8 | "u_max": 3.2,
9 | "v_min": 0.1,
10 | "v_max": 4,
11 | "checkerboard_colors": [BLUE_C],
12 | }
13 | ParametricSurface.__init__(self, self.func, **kwargs)
14 |
15 | def func(self, x, y):
16 | return np.array([x, (1 / (x * x * x)), (1 / (x * x * x))])
17 |
18 |
19 | class Limites2(ThreeDScene):
20 | def construct(self):
21 | titulo2 = TextMobject(
22 | """Existencia del Límite en Infinito de \n
23 | Funciones de $\\mathbb{R}\\rightarrow\\mathbb{R}^{n}$"""
24 | )
25 | texto = TextMobject("""Sea $f:\\mathbb{R}\\rightarrow\\mathbb{R}^{n}$""")
26 | texto1 = TexMobject(
27 | r""" \lim_{x \to \infty}f(x)=\vec{L}\leftrightarrow\forall \ \epsilon>0"""
28 | )
29 | texto1_1 = TextMobject(
30 | """$\\exists \\ M\\in\\mathbb{R}$ tal que $x>M \\ \\implies ||f(x)-\\vec{L}||<\\epsilon$"""
31 | ).move_to(texto1.get_center() + 0.8 * DOWN)
32 | texto1_2 = TextMobject("""Veamos el siguiente ejemplo""")
33 | texto1_3 = TextMobject(
34 | """$f$""",
35 | """$:\\mathbb{R}^{+}\\rightarrow\\mathbb{R}^{2}$ \n""",
36 | """$f(x)=(\\frac{1}{x^{3}},\\frac{1}{x^{3}})$""",
37 | )
38 | texto1_3[0].set_color(BLUE_C)
39 | texto1_3[2].set_color(BLUE_C)
40 | ###Animacion
41 | self.play(Write(titulo2.scale(1.5)))
42 | self.wait(6)
43 | self.play(FadeOut(titulo2))
44 | self.play(Write(texto))
45 | self.wait(4.25)
46 | self.play(texto.shift, 1.2 * UP, runtime=1.5)
47 | self.play(Write(texto1))
48 | self.wait(6.125)
49 | self.play(Write(texto1_1))
50 | self.wait(8)
51 | self.play(FadeOut(texto1), FadeOut(texto1_1), FadeOut(texto))
52 | self.wait()
53 | self.play(Write(texto1_2))
54 | self.wait(3.5)
55 | self.play(FadeOut(texto1_2))
56 | self.play(Write(texto1_3))
57 | self.wait(6.125)
58 | self.play(FadeOut(texto1_3))
59 | self.wait()
60 | self.custom_method()
61 |
62 | def custom_method(self):
63 | axes = ThreeDAxes()
64 | axes.add(axes.get_x_axis_label("t"))
65 | surface2 = superficie2()
66 | texto2 = TextMobject("""Tomemos""", """ $\\epsilon$=0.8""")
67 | texto2[1].set_color(RED)
68 | texto2.to_corner(UL)
69 |
70 | texto3 = TextMobject(
71 | """Los puntos dentro del círculo \n
72 | en el plano yz están a una \n
73 | distancia 0.8 del $\\vec{0}$\n del plano yz"""
74 | )
75 | texto3.move_to(3.6*LEFT+3*UP)
76 | text_4_1 = TextMobject("Veamos que hay un punto").move_to(3.6*LEFT+3.5*UP)
77 | text_4_2 = TextMobject("en x desde el cual ", "$f(x)$").next_to(text_4_1,DOWN)
78 | text_4_2[1].set_color(BLUE_C)
79 | text_4_3 = TextMobject("está a una distancia menor").next_to(text_4_2,DOWN)
80 | text_4_4 = TextMobject("que ", "$\\epsilon$", " del $\\Vec{0}$ del plano yz").next_to(text_4_3,DOWN)
81 | text_4_4[1].set_color(RED)
82 | texto4 = VGroup(text_4_1,text_4_2,text_4_3,text_4_4)
83 | texto4_1 = TextMobject(
84 | """Es posible hacer lo mismo \n
85 | con cualquier """,
86 | """$\\epsilon$""",
87 | """$>0$""",
88 | )
89 | texto4_1[1].set_color(RED)
90 | texto4_1.to_corner(UL)
91 | texto5 = TextMobject(
92 | """Por lo cual notaremos que \n
93 | la función tiene límite cuando \n
94 | $x\\rightarrow \\infty$ y es (0,0)"""
95 | )
96 | texto5.to_corner(UL)
97 | texto6 = TextMobject(
98 | """¿Se te ocurre cómo modificar la definición \n
99 | anterior cuando el límite es con\n
100 | la variable tendiendo a $-\\infty$?"""
101 | )
102 | r = 0.8
103 | r1 = 0.4
104 | circulo = Circle(radius=r)
105 | circulo.rotate(PI / 2, axis=UP)
106 | circulo1 = Circle(radius=r1).move_to(1.8 * RIGHT)
107 | circulo1.rotate(PI / 2, axis=UP)
108 |
109 | plano = Rectangle(height=2, width=3, fill_color=YELLOW_C, fill_opacity=0.3)
110 | plano.move_to(0.5 * RIGHT)
111 | plano.rotate(PI / 2, axis=UP)
112 |
113 | self.set_camera_orientation(0.8 * np.pi / 2, -0.25 * np.pi, distance=10)
114 | self.play(ShowCreation(axes))
115 | self.play(ShowCreation(surface2))
116 | self.wait()
117 | self.move_camera(phi=80 * DEGREES, theta=0)
118 | self.begin_ambient_camera_rotation(rate=0.001)
119 | self.add_fixed_in_frame_mobjects(texto2)
120 | self.play(Write(texto2))
121 | self.wait(3.5)
122 | self.play(ShowCreation(circulo))
123 | self.play(FadeOut(texto2))
124 | self.add_fixed_in_frame_mobjects(texto3)
125 | self.play(Write(texto3))
126 | self.wait(9.125)
127 | self.play(FadeOut(texto3))
128 | self.move_camera(phi=80 * DEGREES, theta=-PI / 8, rate=0.2)
129 | self.play(circulo.shift, 1.8 * RIGHT, runtime=3)
130 | self.add_fixed_in_frame_mobjects(texto4)
131 | self.play(Write(texto4))
132 | self.wait(9.875)
133 | self.play(FadeOut(texto4))
134 | self.add_fixed_in_frame_mobjects(texto4_1)
135 | self.play(Write(texto4_1))
136 | self.wait(5.75)
137 | self.play(ReplacementTransform(circulo, circulo1))
138 | self.play(circulo1.shift, 2 * RIGHT, runtime=3)
139 | self.wait()
140 | self.play(FadeOut(texto4_1))
141 | self.add_fixed_in_frame_mobjects(texto5)
142 | self.play(Write(texto5))
143 | self.wait(8.375)
144 | self.play(FadeOut(texto5), FadeOut(circulo1), FadeOut(axes), FadeOut(surface2))
145 | self.add_fixed_in_frame_mobjects(texto6)
146 | self.play(Write(texto6))
147 | self.wait(7.625)
148 | self.play(FadeOut(texto6))
--------------------------------------------------------------------------------
/Topologia/cubierta.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #################################
4 | #### CUBIERTA DE UN CONJUNTO ####
5 | #################################
6 |
7 |
8 | class Cubierta(Scene):
9 | def construct(self):
10 | title = TextMobject("""Cubiertas""").scale(1.5)
11 |
12 | grid = ScreenGrid()
13 |
14 | ###Texto
15 | t_1 = TextMobject("Sea ", "$A$", " $\\subset \\mathbb{R}^n$")
16 | t_1.set_color_by_tex_to_color_map({"$A$": BLUE})
17 | t_2 = TextMobject("Definimos una", " cubierta", " de ", "$A$")
18 | t_2.set_color_by_tex_to_color_map({"cubierta": PURPLE_B, "$A$": BLUE})
19 |
20 | t_3_1 = TextMobject(
21 | "como una colección de",
22 | " subconjuntos ",
23 | "$\\mathcal{F}$",
24 | " $\\subset \\mathcal{P}(\\mathbb{R}^n)$,",
25 | )
26 | t_3_1.set_color_by_tex_to_color_map(
27 | {"subconjuntos": GREEN_D, "$\\mathcal{F}": PURPLE_B}
28 | )
29 | t_3_2 = TextMobject("donde $\\mathcal{P}(\\mathbb{R}^n)$ es el conjunto potencia de $\\mathbb{R}^n$").move_to(1*DOWN)
30 | t_3 = VGroup(t_3_1,t_3_2)
31 |
32 | t_4 = TextMobject(
33 | "tal que ", "$A$", " $\\subseteq \\bigcup_{U \\subset \\mathcal{F}} U$, con $U\\subset\\mathbb{R}^n$"
34 | )
35 | t_4.set_color_by_tex_to_color_map({"$A$": BLUE})
36 | t_4[2][4].set_color(PURPLE_B)
37 |
38 | t_5 = TextMobject(
39 | "Por ejemplo, sea ", "$A$", " el siguiente", " conjunto:"
40 | ).move_to(3 * UP)
41 | t_5.set_color_by_tex_to_color_map({"conjunto": BLUE, "$A$": BLUE})
42 |
43 | t_6 = TextMobject(
44 | "Entonces una posible", " cubierta $\\mathcal{F}$", " podría ser: "
45 | ).move_to(3 * UP)
46 | t_6.set_color_by_tex_to_color_map({"cubierta $\\mathcal{F}$": PURPLE_B})
47 |
48 | t_7 = TextMobject(
49 | "Una", " cubierta", " puede ser", " abierta", " o", " cerrada"
50 | ).move_to(3 * UP)
51 | t_7.set_color_by_tex_to_color_map(
52 | {"cubierta": PURPLE_B, "abierta": RED, "cerrada": ORANGE}
53 | )
54 | t_8 = TextMobject(
55 | "dependiendo de si los", " subconjuntos $U_{i}$", " que la componen"
56 | ).move_to(3 * UP)
57 | t_8.set_color_by_tex_to_color_map({"subconjuntos $U_{i}$": GREEN_D})
58 |
59 | t_9 = TextMobject("son todos", " abiertos").move_to(3 * UP)
60 | t_9.set_color_by_tex_to_color_map({"abiertos": RED})
61 |
62 | t_10 = TextMobject("o todos", " cerrados").move_to(3 * UP)
63 | t_10.set_color_by_tex_to_color_map({"cerrados": ORANGE})
64 |
65 | t_11 = TextMobject(
66 | "Observemos que en este caso los ",
67 | "subconjuntos $U_{i}$",
68 | "\\\\ se sobreponen",
69 | ).move_to(3 * UP)
70 | t_11.set_color_by_tex_to_color_map({"subconjuntos $U_{i}$": GREEN_D})
71 |
72 | t_12 = TextMobject(
73 | "por lo que el", " conjunto $A$", " queda totalmente cubierto"
74 | ).move_to(3 * UP)
75 | t_12.set_color_by_tex_to_color_map({"conjunto $A$": BLUE})
76 |
77 | t_13 = TextMobject(
78 | "independientemente de que ",
79 | "$\\mathcal{F}$",
80 | " sea",
81 | " abierta",
82 | " o",
83 | " cerrada",
84 | ).move_to(3 * UP)
85 | t_13.set_color_by_tex_to_color_map(
86 | {"abierta": RED, "cerrada": ORANGE, "$\\mathcal{F}$": PURPLE_B}
87 | )
88 |
89 | t_14 = TextMobject(
90 | "Si ", "A", " es ", "cerrado"," y $diam(U_i)0:
122 | dot2 = Dot(radius=0.05,color=PINK)
123 | dot2_2 = Dot(radius=0.05,color=PINK)
124 | dot2.move_to(np.array([j,-(1-j**n)**(1/n),0]))
125 | dot2_2.move_to(np.array([-(1-j**n)**(1/n),j,0]))
126 | #self.add(dot2,dot2_2)
127 | #self.wait(0.05)
128 | D.append(dot2)
129 | D.append(dot2_2)
130 | j=j-dj
131 | j=0
132 | while j>-1:
133 | dot3 = Dot(radius=0.05,color=PINK)
134 | dot3_2 = Dot(radius=0.05,color=PINK)
135 | dot3.move_to(np.array([j,-(1-(-j)**n)**(1/n),0]))
136 | dot3_2.move_to(np.array([-(1-(-j)**n)**(1/n),j,0]))
137 | #self.add(dot3,dot3_2)
138 | #self.wait(0.05)
139 | D.append(dot3)
140 | D.append(dot3_2)
141 | j=j-dj
142 | j=-1
143 | while j<0:
144 | dot4 = Dot(radius=0.05,color=PINK)
145 | dot4_2 = Dot(radius=0.05,color=PINK)
146 | dot4.move_to(np.array([j,(1-(-j)**n)**(1/n),0]))
147 | dot4_2.move_to(np.array([(1-(-j)**n)**(1/n),j,0]))
148 | #self.add(dot4,dot4_2)
149 | #self.wait(0.05)
150 | D.append(dot4)
151 | D.append(dot4_2)
152 | j=j+dj
153 | puntos = VGroup(*D)
154 | self.add(puntos)
155 | self.wait(0.5)
156 | for i in D:
157 | self.remove(i)
158 | self.remove(valor_sig)
159 | n=round(n + 0.2, 1)
160 | self.remove(plano,Group3,fig3)
161 |
162 | conclus1 = TextMobject("Vemos que tiende al ``c\\'{i}rculo'' que resulta de usar")
163 | conclus2 = TextMobject("la norma infinito, de ah\\'{i} su nombre.").next_to(conclus1,DOWN)
164 | conclus = VGroup(conclus1,conclus2)
165 | ejer = TextMobject("Puedes cambiar el código para verlo con más valores de $p$")
166 |
167 | self.play(Write(ejer))
168 | self.wait(2)
169 | self.play(FadeOut(ejer))
170 | self.play(Write(conclus))
171 | self.wait(2)
172 | self.play(FadeOut(conclus))
--------------------------------------------------------------------------------
/Cálculo diferencial de superficies/inclinacion.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #############################################################
4 | ############## Planos y su inclinación #####################
5 | ###########################################################
6 | #anexado el 11/11/2021
7 |
8 |
9 | class Planos(ThreeDScene):
10 |
11 | def l_1(self, t):
12 | return np.array([t, 0,5*t])
13 | def l_2(self, t):
14 | return np.array([0,t,3*t])
15 | def Plano(self,x,y):
16 | return np.array([x,y,5*x+ 3*y])
17 |
18 |
19 | def construct(self):
20 |
21 | ###Texto
22 | titulo = TextMobject('''Planos y Su Inclinación''').scale(1.5)
23 | t_1 = TextMobject('''En $\\mathbb{R}^3$ un plano puede ser descrito como \n
24 | una superficie lisa, sin subidas ni bajadas. ''')
25 | t_2 = TextMobject('''Algunos planos son gráficas de funciones de $\\mathbb{R}^2$ en $\\mathbb{R},$ \n
26 | $ f(x,y) = ax + by \\mbox{ con } a,b \\in \\mathbb{R}.$''')
27 | t_3 = TextMobject('''Cualquier plano no vertical intersecta \n
28 | a los planos $xz$ y $yz$ en dos rectas, \n
29 | cada una en los planos respectivos \n
30 | son de pendiente $a$ y $b$.''')
31 | t_4 = TextMobject('''Veamos a que nos referimos con esto gráficamente.''')
32 | t_5 = TextMobject('''Tomemos una recta ''', '''$\\mathcal{L}_1$''', ''' en el plano $xz$ de pediente 5. ''').to_edge(UP)
33 | t_5.set_color_by_tex_to_color_map({'''$\\mathcal{L}_1$''': TEAL})
34 | t_5_bg = SurroundingRectangle(t_5, color=WHITE, fill_color=BLACK, fill_opacity=1)
35 | t_6 = TextMobject('''Y otra recta ''','''$\\mathcal{L}_2$''', ''' en el plano $yz$ de pendiente 3.''').to_edge(UP)
36 | t_6.set_color_by_tex_to_color_map({'''$\\mathcal{L}_2$''': RED})
37 | t_6_bg = SurroundingRectangle(t_6, color=WHITE, fill_color=BLACK, fill_opacity=1)
38 | t_7 = TextMobject('''Ahora observemos que el plano \n
39 | $f(x,y) = 5x + 3x$ \n
40 | contiene a ambas rectas.''').to_edge(UP)
41 | t_7_bg = SurroundingRectangle(t_7, color=WHITE, fill_color=BLACK, fill_opacity=1)
42 | t_8 = TextMobject('''Este plano es el único que contiene ambas rectas y \n
43 | por lo tanto este plano queda totalmente \n
44 | caracterizado por estas.''').to_edge(UP)
45 | t_8_bg = SurroundingRectangle(t_8, color=WHITE, fill_color=BLACK, fill_opacity=1)
46 | t_9 = TextMobject(''' En particular la inclinación del plano queda determinada por el \n
47 | vector ''','''$(5,3)$''',''', es decir por la inclinación de las rectas. ''').to_edge(UP)
48 | t_9_bg = SurroundingRectangle(t_9, color=WHITE, fill_color=BLACK, fill_opacity=1)
49 | t_9.set_color_by_tex_to_color_map({'''$(5,3)$''': GREEN})
50 | t_10 = TextMobject('''Se puede demostrar que $f:\\mathbb{R}^2\\rightarrow\\mathbb{R}$ es lineal \n
51 | si y sólo si $f(x,y)=ax+by=(a,b)\\cdot (x,y)$. ''')
52 | t_11 = TextMobject('''Las gráficas de estas funciones corresponden a todos los \n
53 | planos no verticales en $\\mathbb{R}^3$ que pasan por el origen.''')
54 | t_12 = TextMobject('''¿Qué pasa con los planos que no pasan por el origen?''')
55 | t_13 = TextMobject('''¿Cómo aplica este concepto de inclinación \n
56 | para el caso de un plano tangente?''')
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | ### Objetos
65 |
66 | axes = ThreeDAxes(x_min = -4, x_max = 4, y_min = -4, y_max=4, z_min=-4, z_max=4 ,num_axis_pieces= 4)
67 | recta_1 = ParametricFunction(self.l_1, color=TEAL, t_min= -2,t_max=2)
68 | recta_2 = ParametricFunction(self.l_2, color=RED, t_min=-2,t_max=2)
69 | plano = ParametricSurface(self.Plano, fill_color=PURPLE_E, checkerboard_colors= [PURPLE_D, PURPLE_E], fill_opacity=0.6 ,u_min=-2, u_max =2,v_min=-2, v_max=2)
70 | inclinacion=Vector(direction=[5,3,0], color=GREEN)
71 |
72 |
73 |
74 |
75 | ###Grupos
76 |
77 | Group_1 = VGroup(recta_1)
78 | Group_2 = VGroup(recta_2)
79 | Group_3 = VGroup(plano)
80 |
81 |
82 |
83 | ### Animaciones
84 | self.begin_ambient_camera_rotation(rate=0.2)
85 | self.add_fixed_in_frame_mobjects(titulo)
86 | self.play(Write(titulo))
87 | self.wait(5)
88 | self.play(FadeOut(titulo))
89 | self.add_fixed_in_frame_mobjects(t_1)
90 | self.play(Write(t_1))
91 | self.wait(12)
92 | self.play(FadeOut(t_1))
93 | self.add_fixed_in_frame_mobjects(t_2)
94 | self.play(Write(t_2))
95 | self.wait(10)
96 | self.play(FadeOut(t_2))
97 | self.add_fixed_in_frame_mobjects(t_3)
98 | self.play(Write(t_3))
99 | self.wait(15)
100 | self.play(FadeOut(t_3))
101 | self.add_fixed_in_frame_mobjects(t_4)
102 | self.play(Write(t_4))
103 | self.wait(8)
104 | self.play(FadeOut(t_4))
105 | self.set_camera_orientation(phi=45*DEGREES,theta=55*DEGREES)
106 | self.play(LaggedStart(ShowCreation(axes)))
107 | self.add_fixed_in_frame_mobjects(t_5_bg, t_5)
108 | self.play(Write(t_5_bg), Write(t_5))
109 | self.play(LaggedStart(ShowCreation(Group_1)))
110 | self.wait(8)
111 | self.play(FadeOut(t_5), FadeOut(t_5_bg))
112 | self.wait(3)
113 | self.add_fixed_in_frame_mobjects(t_6_bg, t_6)
114 | self.play(Write(t_6_bg), Write(t_6))
115 | self.play(LaggedStart(ShowCreation(Group_2)))
116 | self.wait(8)
117 | self.play(FadeOut(t_6), FadeOut(t_6_bg))
118 | self.wait(2)
119 | self.add_fixed_in_frame_mobjects(t_7_bg, t_7)
120 | self.play(Write(t_7_bg), Write(t_7))
121 | self.play(LaggedStart(ShowCreation(Group_3)))
122 | self.wait(15)
123 | self.play(FadeOut(t_7), FadeOut(t_7_bg))
124 | self.wait(5)
125 | self.add_fixed_in_frame_mobjects(t_8_bg, t_8)
126 | self.play(Write(t_8_bg), Write(t_8))
127 | self.wait(18)
128 | self.play(FadeOut(t_8), FadeOut(t_8_bg))
129 | self.add_fixed_in_frame_mobjects(t_9_bg, t_9)
130 | self.play(Write(t_9_bg), Write(t_9))
131 | self.play(FadeIn(inclinacion))
132 | self.wait(18)
133 | self.play(FadeOut(t_9), FadeOut(t_9_bg))
134 | self.play(FadeOut(Group_1), FadeOut(Group_2), FadeOut(Group_3), FadeOut(axes), FadeOut(inclinacion))
135 | self.add_fixed_in_frame_mobjects(t_10)
136 | self.play(Write(t_10))
137 | self.wait(10)
138 | self.play(FadeOut(t_10))
139 | self.add_fixed_in_frame_mobjects(t_11)
140 | self.play(Write(t_11))
141 | self.wait(10)
142 | self.play(FadeOut(t_11))
143 | self.add_fixed_in_frame_mobjects(t_12)
144 | self.play(Write(t_12))
145 | self.wait(8)
146 | self.play(FadeOut(t_12))
147 | self.add_fixed_in_frame_mobjects(t_13)
148 | self.play(Write(t_13))
149 | self.wait(10)
150 | self.play(FadeOut(t_13))
151 |
--------------------------------------------------------------------------------
/Límite y continuidad en funciones multivariable/limite_infinito_Rn-R.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | class Limite4_1 (ThreeDScene):
4 | def construct (self):
5 | titulo=TextMobject('''Existencia del Límite en Infinito\n
6 | de Funciones de $\\mathbb{R}^n$ $\\rightarrow$ $\\mathbb{R}$''').scale(1.5)
7 | text=TextMobject("Sea $f:\\mathbb{R}^{n}\\rightarrow\\mathbb{R}$").move_to(2.2*UP)
8 | text1=TexMobject(r"\lim_{\vec{x}\rightarrow\infty}f(\vec{x})=L\leftrightarrow\forall\epsilon>0").move_to(1*UP)
9 | text2=TexMobject(r"\exists\delta>0 \ tq \ \forall \vec{x}\in B^{c}_{\delta}(\vec{0})").move_to(-0.2*UP)
10 | text3=TexMobject(r"\implies d(f(\vec{x}),L)<\epsilon").move_to(1.4*DOWN)
11 | G1=VGroup(text,text1,text2,text3)
12 | text4=TextMobject('''Veamos el siguiente ejemplo para aterrizar ideas:''')
13 | text5=TexMobject(r"f:\mathbb{R}^{2}\rightarrow\mathbb{R}")
14 | text6=TexMobject(r"f(x,y)=1+\frac{1}{x^{2}+y^{2}}").move_to(1.5*DOWN)
15 | G2=VGroup(text4,text5,text6)
16 |
17 | self.play(Write(titulo))
18 | self.wait(5.25)
19 | self.play(FadeOut(titulo))
20 | self.play(Write(text))
21 | self.play(Write(text1))
22 | self.play(Write(text2))
23 | self.play(Write(text3))
24 | self.wait(6)
25 | self.play(FadeOut(G1))
26 | self.play(Write(text4))
27 | self.wait(4.6)
28 | self.play(text4.shift,2*UP,runtime=1.5)
29 | self.play(Write(text5))
30 | self.play(Write(text6))
31 | self.wait(3)
32 | self.play(FadeOut(G2))
33 | self.wait()
34 | self.custom_method()
35 |
36 |
37 | def custom_method(self):
38 | axes=ThreeDAxes()
39 | superficie=superficie4()
40 | text1=TexMobject(r'''f(x,y)=1+\frac{1}{x^{2}+y^{2}}''')
41 | text1.to_corner(UL)
42 | text2=TextMobject("Tomemos", " $\epsilon$=0.5")
43 | text2.to_corner(UL)
44 | text2[1].set_color(RED)
45 | text3=TextMobject('''Y notemos que \n
46 | podemos escoger''').to_corner(UL)
47 | text3_1=TextMobject("una"," $\\delta>0$").move_to(text3.get_center()+1*DOWN)
48 | text3_1[1].set_color(YELLOW_C)
49 | text4=TextMobject('''Tal que la imagen de los\n
50 | puntos que no \n
51 | pertenecen a $ B_{\\delta}(\\vec{0})$,''').to_corner(UL)
52 | text5=TextMobject('''están a una distancia $\\epsilon$\n
53 | de 1.''').to_corner(UL)
54 | text5_1=TextMobject('''Es posible hacer lo mismo\n
55 | con toda $\\epsilon>0$.''').to_corner(UL)
56 | text6=TextMobject('''Por lo cual:''').to_corner(UL)
57 | text7=TexMobject(r"\lim_{\vec{x}\rightarrow\infty}f(\vec{x})=1").move_to(text5.get_center()+1*DOWN)
58 |
59 | M=TextMobject("1").move_to(1*UP+0.2*LEFT)
60 |
61 | #epsilons se pueden modificar
62 | r=0.5
63 | r1=1
64 | linea=Line((0,0,1),(0,0,1+r),stroke_width=6,color=RED)
65 | linea_1=Line((0,0,1),(0,0,1+r1),stroke_width=6,color=RED)
66 | R=1.7
67 | R1=R-0.5
68 | linea1=Line((0,0,0),(R,0,0),stroke_width=6,color=YELLOW_C)
69 |
70 | circulo=Circle(radius=R,color=YELLOW_C)
71 | circulo1=Circle(radius=R1,color=YELLOW_C)
72 | #cilindro = ParametricSurface(
73 | # lambda u, v: np.array([
74 | # R*np.cos(TAU * v),
75 | # R*np.sin(TAU * v),
76 | # 4*u
77 | # ]),
78 | # resolution=(6, 32)).fade(0.1).set_opacity(0.2)
79 | #cilindro.set_color(YELLOW_C)
80 | #cilindro1 = ParametricSurface(
81 | # lambda u, v: np.array([
82 | # R1*np.cos(TAU * v),
83 | # R1*np.sin(TAU * v),
84 | # 4*u
85 | # ]),
86 | # resolution=(6, 32)).fade(0.1).set_opacity(0.2)
87 | #cilindro1.set_color(YELLOW_C)
88 |
89 | def puntosEnSuperficie(rad,lim,num):
90 | puntosDom = []
91 | puntosSur = []
92 | for i in range(num):
93 | azar = lim*np.random.rand(1,2)[0] + 0.1
94 | if (rad < np.sqrt(azar[0]**2 + azar[1]**2) < lim):
95 | puntosDom.append(Dot(np.array([azar[0], azar[1],0]), color = BLUE))
96 | puntosSur.append(Dot(superficie.func(azar[0], azar[1]), color = RED))
97 | return puntosDom, puntosSur
98 |
99 | puntosD1, puntosS1 = puntosEnSuperficie(R, 5, 6000)
100 | puntosD2, puntosS2 = puntosEnSuperficie(R1, R, 3000)
101 |
102 | GPuntosD1 = VGroup(*puntosD1)
103 | GPuntosS1 = VGroup(*puntosS1)
104 | GPuntosD2 = VGroup(*puntosD2)
105 | GPuntosS2 = VGroup(*puntosS2)
106 |
107 | ###Animacion
108 | self.set_camera_orientation(0.8*np.pi/2, -0.25*np.pi,distance=12)
109 | self.begin_ambient_camera_rotation(rate=0.001)
110 | self.play(ShowCreation(axes))
111 | self.add_fixed_in_frame_mobjects(text1)
112 | self.add_fixed_in_frame_mobjects(M)
113 | self.play(Write(text1))
114 | self.play(ShowCreation(superficie))
115 | self.wait()
116 | self.play(FadeOut(text1))
117 | self.add_fixed_in_frame_mobjects(text2)
118 | self.play(Write(text2))
119 | self.play(ShowCreation(linea))
120 | self.play(FadeOut(text2))
121 | self.add_fixed_in_frame_mobjects(text3)
122 | self.play(Write(text3))
123 | self.add_fixed_in_frame_mobjects(text3_1)
124 | self.play(Write(text3_1))
125 | self.play(ShowCreation(linea1))
126 | self.play(ShowCreation(circulo))
127 | self.play(FadeOut(text3),FadeOut(text3_1))
128 | self.add_fixed_in_frame_mobjects(text4)
129 | self.play(Write(text4))
130 | #self.play(ShowCreation(cilindro))
131 | self.wait()
132 | self.play(FadeOut(text4))
133 | self.play(FadeIn(GPuntosD1))
134 | self.add_fixed_in_frame_mobjects(text5)
135 | self.play(Write(text5),FadeOut(linea1))
136 | self.play(FadeIn(GPuntosS1))
137 | self.play(linea.shift,(R+0.1)*RIGHT,runtime=10)
138 | self.wait(6.5)
139 | self.play(FadeOut(text5))
140 | self.add_fixed_in_frame_mobjects(text5_1)
141 | self.play(Write(text5_1))
142 | self.play(ReplacementTransform(linea,linea_1))
143 | self.play(ReplacementTransform(circulo,circulo1))
144 | #self.play(ReplacementTransform(cilindro,cilindro1))
145 | self.play(FadeIn(GPuntosD2))
146 | self.play(FadeIn(GPuntosS2))
147 | self.play(linea_1.shift,(R1+0.1)*RIGHT,runtime=10)
148 | self.wait(3)
149 | self.play(FadeOut(text5_1))
150 | self.add_fixed_in_frame_mobjects(text6)
151 | self.play(Write(text6))
152 | self.add_fixed_in_frame_mobjects(text7)
153 | self.play(Write(text7))
154 | self.wait(2)
155 | self.play(FadeOut(text7),FadeOut(text6),FadeOut(axes),FadeOut(M),
156 | FadeOut(superficie),FadeOut(linea_1),FadeOut(circulo1),FadeOut(GPuntosD1),
157 | FadeOut(GPuntosS1),FadeOut(GPuntosD2),FadeOut(GPuntosS2))
--------------------------------------------------------------------------------
/Modificaciones Manim/space_ops.py:
--------------------------------------------------------------------------------
1 | from functools import reduce
2 |
3 | import numpy as np
4 |
5 | from manimlib.constants import OUT
6 | from manimlib.constants import PI
7 | from manimlib.constants import RIGHT
8 | from manimlib.constants import TAU
9 | from manimlib.utils.iterables import adjacent_pairs
10 | from manimlib.utils.simple_functions import fdiv
11 |
12 |
13 | def get_norm(vect):
14 | return sum([x**2 for x in vect])**0.5
15 |
16 |
17 | # Quaternions
18 | # TODO, implement quaternion type
19 |
20 |
21 | def quaternion_mult(q1, q2):
22 | w1, x1, y1, z1 = q1
23 | w2, x2, y2, z2 = q2
24 | return np.array([
25 | w1 * w2 - x1 * x2 - y1 * y2 - z1 * z2,
26 | w1 * x2 + x1 * w2 + y1 * z2 - z1 * y2,
27 | w1 * y2 + y1 * w2 + z1 * x2 - x1 * z2,
28 | w1 * z2 + z1 * w2 + x1 * y2 - y1 * x2,
29 | ])
30 |
31 |
32 | def quaternion_from_angle_axis(angle, axis):
33 | return np.append(
34 | np.cos(angle / 2),
35 | np.sin(angle / 2) * normalize(axis)
36 | )
37 |
38 |
39 | def angle_axis_from_quaternion(quaternion):
40 | axis = normalize(
41 | quaternion[1:],
42 | fall_back=np.array([1, 0, 0])
43 | )
44 | angle = 2 * np.arccos(quaternion[0])
45 | if angle > TAU / 2:
46 | angle = TAU - angle
47 | return angle, axis
48 |
49 |
50 | def quaternion_conjugate(quaternion):
51 | result = np.array(quaternion)
52 | result[1:] *= -1
53 | return result
54 |
55 |
56 | def rotate_vector(vector, angle, axis=OUT):
57 | if len(vector) == 2:
58 | # Use complex numbers...because why not
59 | z = complex(*vector) * np.exp(complex(0, angle))
60 | return np.array([z.real, z.imag])
61 | elif len(vector) == 3:
62 | # Use quaternions...because why not
63 | quat = quaternion_from_angle_axis(angle, axis)
64 | quat_inv = quaternion_conjugate(quat)
65 | product = reduce(
66 | quaternion_mult,
67 | [quat, np.append(0, vector), quat_inv]
68 | )
69 | return product[1:]
70 | else:
71 | raise Exception("vector must be of dimension 2 or 3")
72 |
73 |
74 | def thick_diagonal(dim, thickness=2):
75 | row_indices = np.arange(dim).repeat(dim).reshape((dim, dim))
76 | col_indices = np.transpose(row_indices)
77 | return (np.abs(row_indices - col_indices) < thickness).astype('uint8')
78 |
79 |
80 | def rotation_matrix(angle, axis):
81 | """
82 | Rotation in R^3 about a specified axis of rotation.
83 | """
84 | about_z = rotation_about_z(angle)
85 | z_to_axis = z_to_vector(axis)
86 | axis_to_z = np.linalg.inv(z_to_axis)
87 | return reduce(np.dot, [z_to_axis, about_z, axis_to_z])
88 |
89 |
90 | def rotation_about_z(angle):
91 | return [
92 | [np.cos(angle), -np.sin(angle), 0],
93 | [np.sin(angle), np.cos(angle), 0],
94 | [0, 0, 1]
95 | ]
96 |
97 |
98 | def z_to_vector(vector):
99 | """
100 | Returns some matrix in SO(3) which takes the z-axis to the
101 | (normalized) vector provided as an argument
102 | """
103 | norm = get_norm(vector)
104 | if norm == 0:
105 | return np.identity(3)
106 | v = np.array(vector) / norm
107 | phi = np.arccos(v[2])
108 | if any(v[:2]):
109 | # projection of vector to unit circle
110 | axis_proj = v[:2] / get_norm(v[:2])
111 | theta = np.arccos(axis_proj[0])
112 | if axis_proj[1] < 0:
113 | theta = -theta
114 | else:
115 | theta = 0
116 | phi_down = np.array([
117 | [np.cos(phi), 0, np.sin(phi)],
118 | [0, 1, 0],
119 | [-np.sin(phi), 0, np.cos(phi)]
120 | ])
121 | return np.dot(rotation_about_z(theta), phi_down)
122 |
123 |
124 | def angle_between(v1, v2):
125 | return np.arccos(np.dot(
126 | v1 / get_norm(v1),
127 | v2 / get_norm(v2)
128 | ))
129 |
130 |
131 | def angle_of_vector(vector):
132 | """
133 | Returns polar coordinate theta when vector is project on xy plane
134 | """
135 | z = complex(*vector[:2])
136 | if z == 0:
137 | return 0
138 | return np.angle(complex(*vector[:2]))
139 |
140 |
141 | def angle_between_vectors(v1, v2):
142 | """
143 | Returns the angle between two 3D vectors.
144 | This angle will always be btw 0 and pi
145 | """
146 | return np.arccos(fdiv(
147 | np.dot(v1, v2),
148 | get_norm(v1) * get_norm(v2)
149 | ))
150 |
151 |
152 | def project_along_vector(point, vector):
153 | matrix = np.identity(3) - np.outer(vector, vector)
154 | return np.dot(point, matrix.T)
155 |
156 |
157 | def normalize(vect, fall_back=None):
158 | norm = get_norm(vect)
159 | if norm > 0:
160 | return np.array(vect) / norm
161 | else:
162 | if fall_back is not None:
163 | return fall_back
164 | else:
165 | return np.zeros(len(vect))
166 |
167 |
168 | def cross(v1, v2):
169 | return np.array([
170 | v1[1] * v2[2] - v1[2] * v2[1],
171 | v1[2] * v2[0] - v1[0] * v2[2],
172 | v1[0] * v2[1] - v1[1] * v2[0]
173 | ])
174 |
175 |
176 | def get_unit_normal(v1, v2):
177 | return normalize(cross(v1, v2))
178 |
179 |
180 | ###
181 |
182 |
183 | def compass_directions(n=4, start_vect=RIGHT):
184 | angle = TAU / n
185 | return np.array([
186 | rotate_vector(start_vect, k * angle)
187 | for k in range(n)
188 | ])
189 |
190 |
191 | def complex_to_R3(complex_num):
192 | return np.array((complex_num.real, complex_num.imag, 0))
193 |
194 |
195 | def R3_to_complex(point):
196 | return complex(*point[:2])
197 |
198 |
199 | def complex_func_to_R3_func(complex_func):
200 | return lambda p: complex_to_R3(complex_func(R3_to_complex(p)))
201 |
202 |
203 | def center_of_mass(points):
204 | points = [np.array(point).astype("float") for point in points]
205 | return sum(points) / len(points)
206 |
207 |
208 | def midpoint(point1, point2):
209 | return center_of_mass([point1, point2])
210 |
211 |
212 | def line_intersection(line1, line2):
213 | """
214 | return intersection point of two lines,
215 | each defined with a pair of vectors determining
216 | the end points
217 | """
218 | x_diff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])
219 | y_diff = (line1[0][1] - line1[1][1], line2[0][1] - line2[1][1])
220 |
221 | def det(a, b):
222 | return a[0] * b[1] - a[1] * b[0]
223 |
224 | div = det(x_diff, y_diff)
225 | if div == 0:
226 | raise Exception("Lines do not intersect")
227 | d = (det(*line1), det(*line2))
228 | x = det(d, x_diff) / div
229 | y = det(d, y_diff) / div
230 | return np.array([x, y, 0])
231 |
232 |
233 | def get_winding_number(points):
234 | total_angle = 0
235 | for p1, p2 in adjacent_pairs(points):
236 | d_angle = angle_of_vector(p2) - angle_of_vector(p1)
237 | d_angle = ((d_angle + PI) % TAU) - PI
238 | total_angle += d_angle
239 | return total_angle / TAU
240 |
241 | def phi_of_vector(vector):
242 |
243 | xy = complex(*vector[:2])
244 |
245 | if xy == 0:
246 |
247 | return 0
248 |
249 | a = ((vector[:1])**2 + (vector[1:2])**2)**(1/2)
250 |
251 | vector[0] = a
252 |
253 | vector[1] = vector[2]
254 |
255 | return np.angle(complex(*vector[:2]))
256 |
--------------------------------------------------------------------------------
/Límite y continuidad en funciones multivariable/curva_nivel.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #############################
4 | ###CONJUNTO DE NIVEL EN R3###
5 | #############################
6 | class ConjNiv_R3(ThreeDScene,Scene):
7 | def setup(self):
8 | Scene.setup(self)
9 | ThreeDScene.setup(self)
10 |
11 | def construct(self):
12 |
13 | text_1 = TextMobject("Veamos ahora los conjuntos de nivel de", " $f(x,y) = \\sqrt{x^2+y^2}$").to_edge(DOWN).set_opacity(0)
14 | text_1[1].set_color(GOLD_E)
15 | text_1.scale(0.9)
16 |
17 | # Creamos la superficie con f(x,y) = \\sqrt(x^2+y^2)
18 | superficie = ParametricSurface(
19 | lambda u, v: np.array([
20 | u,
21 | v,
22 | np.sqrt(u**2+v**2)
23 | ]),v_min=-3,v_max=3,u_min=-3,u_max=3,fill_opacity=0.75,checkerboard_colors=[GOLD_E,GOLD_E],
24 | resolution=(80, 80))
25 |
26 | text_2 = TextMobject("Consideremos", " $c=2$").to_edge(DOWN).set_opacity(0)
27 | text_2[1].set_color(RED)
28 | text_3 = TextMobject("Este conjunto estará contenido en $\mathbb{R}^2$").to_edge(DOWN).set_opacity(0)
29 |
30 | #CREAMOS EL PLANO Z=2
31 | plano_1 = ParametricSurface(
32 | lambda u, v: np.array([
33 | u,
34 | v,
35 | 2
36 | ]),v_min=-3,v_max=3,u_min=-3,u_max=3,fill_color=RED,fill_opacity=0.7, checkerboard_colors=[RED,RED],
37 | resolution=(60, 60))
38 |
39 | #EL CONJUNTO DE NIVEL PARA C=2
40 | circulo_niv2= ParametricFunction(
41 | lambda u : np.array([
42 | 2*math.cos(u),
43 | 2*math.sin(u),
44 | 2
45 | ]),color=WHITE,t_min=0,t_max=2*PI,
46 | )
47 |
48 | circulo_niv2_dup= ParametricFunction(
49 | lambda u : np.array([
50 | 2*math.cos(u),
51 | 2*math.sin(u),
52 | 2
53 | ]),color=WHITE,t_min=0,t_max=2*PI,
54 | )
55 |
56 | circulo_niv2_R2= ParametricFunction(
57 | lambda u : np.array([
58 | 2*math.cos(u),
59 | 2*math.sin(u),
60 | 0
61 | ]),color=WHITE,t_min=0,t_max=2*PI,
62 | )
63 |
64 | conjunto_nivel2 = TexMobject(r"N_2(f) = \{ \vec{x} \in \mathbb{R}^2 \vert \Vert \vec{x} \Vert = 2 \}").shift(2*UP+3*RIGHT).scale(0.7)
65 | conjunto_nivel2_short = TexMobject(r"N_2(f)").shift(1.75*UP+1.75*RIGHT).scale(0.6)
66 | text_4 = TextMobject("Repitamos lo anterior ahora con ", "$c = 1$").to_edge(DOWN).set_opacity(0)
67 | text_4[1].set_color(RED)
68 |
69 | plano_2 = ParametricSurface(
70 | lambda u, v: np.array([
71 | u,
72 | v,
73 | 1
74 | ]),v_min=-3,v_max=3,u_min=-3,u_max=3,fill_color=RED,fill_opacity=0.5, checkerboard_colors=[RED,RED],
75 | resolution=(60, 60))
76 |
77 | circulo_niv1= ParametricFunction(
78 | lambda u : np.array([
79 | 1*math.cos(u),
80 | 1*math.sin(u),
81 | 1
82 | ]),color=WHITE,t_min=0,t_max=2*PI,
83 | )
84 | circulo_niv1_dup= ParametricFunction(
85 | lambda u : np.array([
86 | 1*math.cos(u),
87 | 1*math.sin(u),
88 | 1
89 | ]),color=WHITE,t_min=0,t_max=2*PI,
90 | )
91 |
92 | circulo_niv1_R2= ParametricFunction(
93 | lambda u : np.array([
94 | 1*math.cos(u),
95 | 1*math.sin(u),
96 | 0
97 | ]),color=WHITE,t_min=0,t_max=2*PI,
98 | )
99 |
100 | conjunto_nivel1 = TexMobject(r"N_1(f) = \{ \vec{x} \in \mathbb{R}^2 \vert \Vert \vec{x} \Vert = 1 \}").shift(2*DOWN+3*RIGHT).scale(0.7)
101 | conjunto_nivel1_short = TexMobject(r"N_1(f)").shift(UP+RIGHT).scale(0.6)
102 | text_5 = TextMobject("¡Los conjuntos de nivel nos ayudan a esbozar la gráfica!").to_edge(DOWN).set_opacity(0).scale(0.8)
103 |
104 | ## Secuencia de la Animación
105 | axes = ThreeDAxes(x_min=-4,x_max=4,y_min=-4,y_max=4,z_min=-2,z_max=4,num_axis_pieces=40)
106 | self.set_camera_orientation(phi=75 * DEGREES,theta=-45*DEGREES,distance=100)
107 | self.add_fixed_in_frame_mobjects(text_1)
108 | self.play(text_1.set_opacity, 1, runtime = 2)
109 | self.play(ShowCreation(axes))
110 | self.play(ShowCreation(superficie))
111 | self.wait(5.5)
112 |
113 | #PLANO 1
114 | self.play(FadeOut(text_1))
115 | self.add_fixed_in_frame_mobjects(text_2)
116 | self.play(text_2.set_opacity, 1, runtime = 2)
117 | self.play(ShowCreation(plano_1))
118 | self.wait(2)
119 | self.move_camera(phi=90 * DEGREES,theta=-90*DEGREES,frame_center=(0.1,0,1))
120 |
121 | self.play(FadeOut(text_2))
122 | self.add_fixed_in_frame_mobjects(text_3)
123 | self.play(text_3.set_opacity, 1, runtime = 2)
124 | self.wait(4)
125 |
126 | #CONJUNTO DE NIVEL
127 | self.play(FadeOut(text_3))
128 | self.move_camera(phi= 0 * DEGREES,theta=-90*DEGREES,run_time=2)
129 | self.play(ShowCreation(circulo_niv2), runtime = 2)
130 |
131 | self.move_camera(phi=75 * DEGREES,theta=-45*DEGREES,distance=100,run_time=2)
132 | self.play(ReplacementTransform(circulo_niv2_dup, circulo_niv2_R2))
133 | self.add_foreground_mobjects(superficie)
134 | self.play(Write(conjunto_nivel2))
135 |
136 | self.play(FadeOut(superficie), FadeOut(plano_1), FadeOut(circulo_niv2),FadeOut(circulo_niv2_dup))
137 | self.move_camera(phi= 0 * DEGREES,theta=-90*DEGREES,run_time=2)
138 | self.wait(5.5)
139 | self.play(ReplacementTransform(conjunto_nivel2,conjunto_nivel2_short))
140 |
141 |
142 | self.move_camera(phi=75 * DEGREES,theta=-45*DEGREES,distance=100, run_time=2)
143 | self.play(ShowCreation(superficie))
144 | self.add_fixed_in_frame_mobjects(text_4)
145 | self.play(text_4.set_opacity, 1, runtime = 2)
146 | self.play(ShowCreation(plano_2))
147 | self.wait(4)
148 | self.play(FadeOut(text_4))
149 | self.move_camera(phi= 0 * DEGREES,theta=-90*DEGREES,run_time=3)
150 | self.play(ShowCreation(circulo_niv1), runtime = 2)
151 | self.wait()
152 | self.move_camera(phi=75 * DEGREES,theta=-45*DEGREES,distance=100,run_time=3)
153 | self.play(ReplacementTransform(circulo_niv1_dup, circulo_niv1_R2))
154 |
155 | self.play(FadeOut(superficie), FadeOut(plano_2), FadeOut(circulo_niv1),FadeOut(circulo_niv1_dup))
156 | self.move_camera(phi= 0 * DEGREES,theta=-90*DEGREES,run_time=3)
157 | self.play(Write(conjunto_nivel1_short))
158 | self.wait(4)
159 |
160 | self.move_camera(phi=75 * DEGREES,theta=-45*DEGREES,distance=100,run_time=3)
161 | self.play(ShowCreation(superficie),ShowCreation(circulo_niv1),ShowCreation(circulo_niv2))
162 |
163 | self.add_fixed_in_frame_mobjects(text_5)
164 | self.play(text_5.set_opacity, 1, runtime = 2)
165 | self.wait(4)
166 | self.play(
167 | *[FadeOut(mob)for mob in self.mobjects]
168 | )
169 | self.wait(2)
--------------------------------------------------------------------------------
/Límite y continuidad en funciones multivariable/divergencia_Rn-R_punto.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | class ThreeDSurface(ParametricSurface):
4 |
5 | def __init__(self, **kwargs):
6 | kwargs = {
7 | "u_min": 0.1,
8 | "u_max": 5,
9 | "v_min": 0.1,
10 | "v_max": 5,
11 | #"checkerboard_colors": [BLUE_D]
12 | #"fill_color": BLUE_D,
13 | "fill_opacity": 1.0,
14 | #"checkerboard_colors": [BLUE_D, RED_E]
15 |
16 | # "should_make_jagged": True
17 | }
18 | ParametricSurface.__init__(self, self.func, **kwargs)
19 |
20 | def func(self, x, y):
21 | return np.array([x,y,(1/(x+y))])
22 |
23 | class LimitesR2_a_R_1 (ThreeDScene):
24 | def construct(self):
25 | titulo=TextMobject('''Divergencia a Infinito de Funciones de\n
26 | $\\mathbb{R}^{n}\\rightarrow\\mathbb{R}$\n
27 | en un Punto $a$''').scale(1.5)
28 | text=TextMobject(''' En el caso de funciones de:\n
29 | $\\mathbb{R}^{n}\\rightarrow\\mathbb{R},$''')
30 | text_1=TextMobject('''donde $n\\in\\lbrace 1,2,3...\\rbrace$''').move_to(text.get_center()+1*DOWN)
31 | G1=VGroup(text,text_1)
32 | Def=TextMobject('''Sea una función $f:D\\subseteq\\mathbb{R}^{n}\\rightarrow\\mathbb{R}$''').shift(1.5*UP)
33 | Def1=TextMobject('''Y sea $\\vec{a}\\in D$''').shift(0.6*UP)
34 | Def2=TexMobject(r''' \lim_{x \to \vec{a}}f(\vec{x})=\infty\iff\forall M\in\mathbb{R}''').shift(0.5*DOWN)
35 | #En el video la definción dice limite al infinito, pero ya lo corregí para que sea el limite cuando x tiende a a
36 | Def3=TextMobject('''$\\exists \\ \\delta>0$ tal que si $\\vec{x}\\in \\left( B_{\\delta}(\\vec{a})\\setminus\\vec{a}\\right) \\cap
37 | D\\implies f(\\vec{x})>M$''').shift(1.5*DOWN)
38 | text_2=TextMobject('''Veamos el siguiente ejemplo''')
39 | text1=TexMobject(r"f:D\subset\mathbb{R}^2\rightarrow\mathbb{R}").shift(2.5*UP)
40 | text1_1=TexMobject(r"D=\lbrace (x,y)|x,y\in\mathbb{R}^{+}-\lbrace 0 \rbrace \rbrace").shift(1.25*UP)
41 | text2=TexMobject(r"f(x,y)=\frac{1}{x+y}").shift(-.1*UP)
42 | text3=TextMobject('''Veamos el límite cuando:''').shift(-1*UP)
43 | text4=TextMobject("(x,y)$\\rightarrow\\vec{0}=(0,0)$").shift(-1.8*UP)
44 |
45 |
46 | #ANIMACION
47 | self.play(Write(titulo))
48 | self.wait(6.5)
49 | self.play(FadeOut(titulo))
50 | self.play(Write(text))
51 | self.play(Write(text_1))
52 | self.wait(6.5)
53 | self.play(FadeOut(G1))
54 | self.play(Write(Def))
55 | self.play(Write(Def1))
56 | self.play(Write(Def2))
57 | self.play(Write(Def3))
58 | self.wait(19)
59 | self.play(FadeOut(Def),FadeOut(Def1),FadeOut(Def2),FadeOut(Def3))
60 | self.play(Write(text_2))
61 | self.wait()
62 | self.play(FadeOut(text_2))
63 | self.play(Write(text1))
64 | self.play(Write(text1_1))
65 | self.play(Write(text2))
66 | self.wait()
67 | self.play(Write(text3))
68 | self.wait()
69 | self.play(Write(text4))
70 | self.wait(16)
71 | self.play(FadeOut(text4),FadeOut(text3),FadeOut(text2),FadeOut(text1_1),
72 | FadeOut(text1))
73 | self.wait()
74 | self.custom_method()
75 |
76 | def custom_method (self):
77 | axes = ThreeDAxes()
78 | surface = ThreeDSurface()
79 | text4=TextMobject('''Tomemos M=1''')
80 | M=TextMobject("M").move_to(1*UP+0.3*LEFT)
81 | text4.to_corner(UL)
82 | text5=TextMobject('''Si tomamos''',''' $\\delta=0.5$''')
83 | text5[1].set_color("#88FF00")
84 | text5.to_corner(UL)
85 | text6=TextMobject('''La imagen de los puntos en D \n
86 | y la bola son mayores a 1''')
87 | text6.to_corner(UL)
88 | text7=TextMobject('''Es posible verificar lo anterior \n
89 | a través de operaciones\n
90 | algebraicas.''')
91 | text7.to_corner(UL)
92 | text8=TextMobject('''Puedes visualizar con mejor detalle la gráfica \n
93 | de la función anterior en el notebook anexo, así\n
94 | como modificar los valores de M''')
95 | r=0.5
96 | #cilindro = ParametricSurface(
97 | # lambda u, v: np.array([
98 | # r*np.cos(TAU * v),
99 | # r*np.sin(TAU * v),
100 | # 2*u
101 | # ]),
102 | # resolution=(6, 32)).fade(0.1).set_opacity(0.2)
103 | linea=Line((0,0,0),(0.5*np.cos(np.pi/4),0.5*np.sin(np.pi/4),0),stroke_width=4,color="#88FF00")
104 | bola=Circle(radius=r,color=PURPLE,fill_opacity=1)
105 | text5_1=TexMobject(r"\delta").move_to(bola.get_center()+0.7*UP+0.7*RIGHT)
106 | text5_1.set_color("#88FF00")
107 | linea1=Line((0,0,1),(0.5,0.5,1),stroke_width=6,color=PURPLE_D)
108 | #plano1=Rectangle(height=2, width=3,color=PURPLE_C,fill_color=PURPLE_C,fill_opacity=0.4,color_opacity=0.4).move_to(-1*IN)
109 | linea2=Line((0.5*np.cos(np.pi/4),0.5*np.sin(np.pi/4),0),(0.5*np.cos(np.pi/4),0.5*np.sin(np.pi/4),1/(r*(2*np.cos(np.pi/4)))),stroke_width=6,color=RED)
110 |
111 | lineaZ=Line((0,0,1),(0,0,3.2),stroke_width=7,color=PURPLE)
112 |
113 | def puntosEnSuperficie(rad):
114 | puntos=[]
115 | for i in range(2000):
116 | azar=np.random.rand(1,2)
117 | if (0.1 < np.sqrt(azar[0][0]**2 + azar[0][1]**2) < rad):
118 | puntos.append(Dot(surface.func(azar[0][0], azar[0][1]),radius=0.05,
119 | color=PURPLE))
120 | return puntos
121 |
122 | puntos=puntosEnSuperficie(r)
123 |
124 | grupo= VGroup(*puntos)
125 |
126 | #ANIMACION
127 | self.set_camera_orientation(0.8*np.pi/2, -0.25*np.pi,distance=4)
128 | self.add(axes)
129 | self.play(ShowCreation(surface))
130 | self.begin_ambient_camera_rotation(rate=0.001)
131 | self.wait()
132 | self.add_fixed_in_frame_mobjects(text4)
133 | self.play(Write(text4))
134 | self.add_fixed_in_frame_mobjects(M)
135 | self.wait()
136 | self.play(FadeOut(text4))
137 | self.play(ShowCreation(bola))
138 | self.wait()
139 | self.add_fixed_in_frame_mobjects(text5)
140 | self.play(Write(text5))
141 | self.play(ShowCreation(linea),Write(text5_1))
142 | self.wait()
143 | self.play(FadeOut(text5))
144 | self.play(FadeOut(linea),FadeOut(text5_1))
145 | self.add_fixed_in_frame_mobjects(text6)
146 | self.play(Write(text6))
147 | self.play()
148 | #self.play(ShowCreation(plano1))
149 | self.play(ShowCreation(lineaZ))
150 | self.play(FadeIn(grupo))
151 | self.wait(5.75)
152 | #self.play(ShowCreation(cilindro))
153 | self.play(FadeOut(text6))
154 | self.add_fixed_in_frame_mobjects(text7)
155 | self.play(Write(text7))
156 | self.wait(5.7)
157 | #self.play(FadeOut(text7),FadeOut(axes),FadeOut(plano1),FadeOut(surface),
158 | self.play(FadeOut(text7),FadeOut(axes),FadeOut(lineaZ),FadeOut(surface),FadeOut(bola),FadeOut(M),
159 | FadeOut(grupo))
160 | self.add_fixed_in_frame_mobjects(text8)
161 | self.play(Write(text8))
162 | self.wait(13)
163 | self.play(FadeOut(text8))
--------------------------------------------------------------------------------
/Espacios vectoriales/conmutatividad.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #### SUGERENCIA: SIEMPRE QUE CAMBIES LOS VECTORES A VISUALIZAR ###
4 | ### CONDISERA QUE EL PLNO ES DE [-7,7]x[-4,4] ####
5 |
6 |
7 | ### CLASES AUXILIARES, NO SON ESCENAS
8 |
9 | class Grid(VGroup):
10 | CONFIG = {
11 | "height": 6.0,
12 | "width": 6.0,
13 | }
14 | def __init__(self, rows, columns, **kwargs):
15 | digest_config(self, kwargs, locals())
16 | super().__init__(**kwargs)
17 | x_step = self.width / self.columns
18 | y_step = self.height / self.rows
19 | for x in np.arange(0, self.width + x_step, x_step):
20 | self.add(Line(
21 | [x - self.width / 2., -self.height / 2., 0],
22 | [x - self.width / 2., self.height / 2., 0],
23 | ))
24 | for y in np.arange(0, self.height + y_step, y_step):
25 | self.add(Line(
26 | [-self.width / 2., y - self.height / 2., 0],
27 | [self.width / 2., y - self.height / 2., 0]
28 | ))
29 | class ScreenGrid(VGroup):
30 | CONFIG = {
31 | "rows": 8,
32 | "columns": 14,
33 | "height": FRAME_Y_RADIUS * 2,
34 | "width": 14,
35 | "grid_stroke": 0.5,
36 | "grid_color": WHITE,
37 | "axis_color": RED,
38 | "axis_stroke": 2,
39 | "labels_scale": 0.25,
40 | "labels_buff": 0,
41 | "number_decimals": 2
42 | }
43 | def __init__(self, **kwargs):
44 | super().__init__(**kwargs)
45 | rows = self.rows
46 | columns = self.columns
47 | grid = Grid(width=self.width, height=self.height, rows=rows, columns=columns)
48 | grid.set_stroke(self.grid_color, self.grid_stroke)
49 | vector_ii = ORIGIN + np.array((- self.width / 2, - self.height / 2, 0))
50 | vector_si = ORIGIN + np.array((- self.width / 2, self.height / 2, 0))
51 | vector_sd = ORIGIN + np.array((self.width / 2, self.height / 2, 0))
52 | axes_x = Line(LEFT * self.width / 2, RIGHT * self.width / 2)
53 | axes_y = Line(DOWN * self.height / 2, UP * self.height / 2)
54 | axes = VGroup(axes_x, axes_y).set_stroke(self.axis_color, self.axis_stroke)
55 | divisions_x = self.width / columns
56 | divisions_y = self.height / rows
57 | directions_buff_x = [UP, DOWN]
58 | directions_buff_y = [RIGHT, LEFT]
59 | dd_buff = [directions_buff_x, directions_buff_y]
60 | vectors_init_x = [vector_ii, vector_si]
61 | vectors_init_y = [vector_si, vector_sd]
62 | vectors_init = [vectors_init_x, vectors_init_y]
63 | divisions = [divisions_x, divisions_y]
64 | orientations = [RIGHT, DOWN]
65 | labels = VGroup()
66 | set_changes = zip([columns, rows], divisions, orientations, [0, 1], vectors_init, dd_buff)
67 | for c_and_r, division, orientation, coord, vi_c, d_buff in set_changes:
68 | for i in range(1, c_and_r):
69 | for v_i, directions_buff in zip(vi_c, d_buff):
70 | ubication = v_i + orientation * division * i
71 | coord_point = round(ubication[coord], self.number_decimals)
72 | label = Text(f"{coord_point}",font="Arial",stroke_width=0).scale(self.labels_scale)
73 | label.next_to(ubication, directions_buff, buff=self.labels_buff)
74 | labels.add(label)
75 | self.add(grid, axes, labels)
76 |
77 | ######################################
78 | #### CONMUTATIVIDAD CON VECTORES #####
79 | ######################################
80 |
81 | class Conmutatividad(Scene):
82 | def construct(self):
83 | grid = ScreenGrid()
84 | v_x = Arrow((0, 0, 0), 2 * RIGHT + UP, buff=0)
85 | v_y = Arrow((0, 0, 0), RIGHT - 2 * UP, buff=0)
86 | v_z = Arrow((0, 0, 0), LEFT + 0.5 * UP, buff=0)
87 | suma_t_1 = TextMobject('Sumemos el vector:' + ' $\\vec{x}+\\vec{y}$')
88 | suma_t_2 = TextMobject('Sumemos el vector:' + ' $\\vec{y}+\\vec{x}$')
89 | prop_1 = TextMobject('''Observemos la primera propiedad: \n
90 | la conmutatividad.''')
91 | prop_1.set_color(GREEN).move_to((-3, 3, 0))
92 | suma_t_1.move_to((-3, 2, 0))
93 | suma_t_1[0][16:18].set_color(RED)
94 | suma_t_1[0][19:].set_color(ORANGE)
95 | suma_t_2.move_to((-3, 1, 0))
96 | suma_t_2[0][19:].set_color(RED)
97 | suma_t_2[0][16:18].set_color(ORANGE)
98 | v_x_t = TextMobject('$\\vec{x}$')
99 | v_y_t = TextMobject('$\\vec{y}$')
100 | v_z_t = TextMobject('$\\vec{z}$')
101 | v_x_t.move_to(v_x.get_end() + RIGHT * 0.3)
102 | v_y_t.next_to(v_y.get_end() + RIGHT * 0.1)
103 | v_z_t.next_to(v_y.get_end() + RIGHT * 0.1)
104 | gpo_x = VGroup(v_x, v_x_t)
105 | gpo_y = VGroup(v_y, v_y_t)
106 | gpo_z = VGroup(v_z, v_z_t)
107 | gpo_x.set_color(RED)
108 | gpo_y.set_color(ORANGE)
109 | v_y_mov = Arrow(v_x.get_end(), v_x.get_end() + v_y.get_end(), buff=0)
110 | v_y_mov_t = TextMobject('$\\vec{y}$')
111 | v_y_mov_t.move_to(v_y_mov.get_end() + RIGHT * 0.3)
112 | gpo_y_mov = VGroup(v_y_mov, v_y_mov_t)
113 | v_x_mov = Arrow(v_y.get_end(), v_y.get_end() + v_x.get_end(), buff=0)
114 | v_x_mov_t = TextMobject('$\\vec{x}$')
115 | v_x_mov_t.move_to(v_x_mov.get_end() + RIGHT * 0.3)
116 | gpo_x_mov = VGroup(v_x_mov, v_x_mov_t)
117 | gpo_y_mov.set_color(ORANGE)
118 | gpo_x_mov.set_color(RED)
119 | v_x_mov = Arrow(v_x)
120 | v_x_mov_t = TextMobject('$\\vec{x}$')
121 | v_x_mov_t.move_to(v_x.get_end() + RIGHT * 0.3)
122 | suma_x_y = Arrow((0, 0, 0), v_y_mov.get_end(), buff=0)
123 | gpo_y_1 = gpo_y.copy()
124 | Text_f = TextMobject(''' Nota que en realidad lo que nos dice es que \n
125 | no importa el camino que elijas, siempre llegas a ROMA \n
126 | o en este caso, \n
127 | el punto en el espacio vectorial. ''')
128 | Text_f.move_to((-3.3, -1.5, 0)) \
129 | .scale(0.56)
130 | ####################################################################
131 | prop_1.bg = SurroundingRectangle(prop_1, color=WHITE, fill_color=BLACK,
132 | fill_opacity=1)
133 | Group11 = VGroup(prop_1.bg, prop_1)
134 | suma_t_1.bg = SurroundingRectangle(suma_t_1, color=WHITE, fill_color=BLACK,
135 | fill_opacity=1)
136 | Group12 = VGroup(suma_t_1.bg, suma_t_1)
137 | suma_t_2.bg = SurroundingRectangle(suma_t_2, color=WHITE, fill_color=BLACK,
138 | fill_opacity=1)
139 | Group13 = VGroup(suma_t_2.bg, suma_t_2)
140 | Text_f.bg = SurroundingRectangle(Text_f, color=WHITE, fill_color=BLACK,
141 | fill_opacity=1)
142 | Group14 = VGroup(Text_f.bg, Text_f)
143 | self.play(Write(grid))
144 | self.play(Write(Group11))
145 | self.wait(2)
146 | self.play(FadeOut(Group11))
147 | self.wait()
148 | self.play(Write(v_x), Write(v_y), Write(v_x_t), Write(v_y_t))
149 | self.wait()
150 | self.play(Write(Group12))
151 | self.wait()
152 | self.play(ReplacementTransform(gpo_y, gpo_y_mov))
153 | self.wait()
154 | self.play(Write(suma_x_y))
155 | self.wait()
156 | self.play(Write(Group13))
157 | self.play(ReplacementTransform(gpo_y_mov, gpo_y_1),
158 | ReplacementTransform(gpo_x, gpo_x_mov))
159 | self.wait()
160 | self.play(Write(Group14))
161 | self.wait()
--------------------------------------------------------------------------------
/Coordenadas polares y cartesianas SVG/Diagrama_conmutatividad.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Límite y continuidad en funciones multivariable/divergencia_Rn-R_infinito.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | # Cuando el lim es igual a infinito
4 | class superficie3(ParametricSurface):
5 | def __init__(self, **kwargs):
6 | kwargs = {
7 | "u_min": -3,
8 | "u_max": 3,
9 | "v_min": -3,
10 | "v_max": 3,
11 | "checkerboard_colors": [BLUE_E]
12 | }
13 | ParametricSurface.__init__(self, self.func, **kwargs)
14 |
15 | def func(self, x, y):
16 | return np.array([x,y,(x*x)+(y*y)-1])
17 | class superficie4(ParametricSurface):
18 | def __init__(self, **kwargs):
19 | kwargs = {
20 | "u_min": 0.1,
21 | "u_max": 5,
22 | "v_min": 0.1,
23 | "v_max": 5,
24 | "checkerboard_colors": [GREEN_B]
25 | }
26 | ParametricSurface.__init__(self, self.func, **kwargs)
27 |
28 | def func(self, x, y):
29 | return np.array([x,y,1+(1/((x*x)+(y*y)))])
30 |
31 | class LimitesRnaR (ThreeDScene):
32 | def construct(self):
33 | titulo=TextMobject('''Divergencia a Infinito de Funciones \n
34 | de $\\mathbb{R}^{n}\\rightarrow\\mathbb{R}$ en Infinito''').scale(1.5)
35 |
36 | text1=TextMobject('''Sea $f:\\mathbb{R}^{n}\\rightarrow\\mathbb{R}$''').move_to(2*UP)
37 | text2=TexMobject(r"lím_{\vec{x}\rightarrow\infty}f(\vec{x})=\infty^{+} \leftrightarrow\forall\ M\in\mathbb{R}").move_to(0.8*UP)
38 | text3=TextMobject('''$\\exists\\delta>0$ tal que si $\\vec{x}\\in B^{c}_{\\delta}(\\vec{0})$ ''' ).move_to(0.5*DOWN)
39 | text4=TexMobject(r'''\implies f(\vec{x})>M''').move_to(1.6*DOWN)
40 | text5=TextMobject("Veamos el siguiente ejemplo para aterrizar lo anterior.")
41 | text6=TextMobject('''Tomemos el paraboloide:\n
42 | $f(x,y)=y^{2}+x^{2}-1$''')
43 |
44 | self.play(Write(titulo))
45 | self.wait(5.3)
46 | self.play(FadeOut(titulo))
47 | self.play(Write(text1))
48 | self.play(Write(text2))
49 | self.play(Write(text3))
50 | self.play(Write(text4))
51 | self.wait(8)
52 | self.play(FadeOut(text1),FadeOut(text2),FadeOut(text3),FadeOut(text4))
53 | self.play(Write(text5))
54 | self.wait(5)
55 | self.play(FadeOut(text5))
56 | self.play(Write(text6))
57 | self.wait(3.8)
58 | self.play(FadeOut(text6))
59 | self.custom_method()
60 |
61 |
62 | def custom_method(self):
63 | axes=ThreeDAxes()
64 | superficie=superficie3()
65 | superficie.set_opacity(0.8)
66 | text1=TexMobject(r'''f(x,y)=y^{2}+x^{2}-1''')
67 | text1.to_corner(UL)
68 | text2=TextMobject('''Tomemos M=0''')
69 | text2.to_corner(UL)
70 | text3=TextMobject('''Tomamos $\\delta$''')
71 | text3.to_corner(UL)
72 |
73 | text4=TextMobject('''Veremos que la imagen de los puntos que no \n
74 | están en la bola, son mayor a M''')
75 | text4.to_corner(UL)
76 | text5=TextMobject('''Podemos realizar lo mismo con cualquier M$\\in\\mathbb{R}$''')
77 | text5.to_corner(UL)
78 | text6=TextMobject('''Por lo cual notaremos que la función diverge a $+\\infty$ \n
79 | cuando $\\vec{x}\\rightarrow\\infty$.''')
80 | text6.to_corner(UL)
81 | # text7=TextMobject('''¿Se te ocurre como modificar la definición \n
82 | # cuando la función diverge a $\\infty^{-}$''')
83 | M=0
84 | r=M+1.4
85 | #cilindro = ParametricSurface(
86 | # lambda u, v: np.array([
87 | # r*np.cos(TAU * v),
88 | # r*np.sin(TAU * v),
89 | # 2*u
90 | # ]),
91 | # resolution=(6, 32)).fade(0.1).set_opacity(0.4)
92 | # cilindro.set_color(RED_C).move_to(M*IN)
93 | #cilindro.set_opacity(0.4)
94 | M1=-0.5
95 | r1=M1+1.5
96 | #cilindro1 = ParametricSurface(
97 | # lambda u, v: np.array([
98 | # r1*np.cos(TAU * v),
99 | # r1*np.sin(TAU * v),
100 | # 4*u
101 | # ]),
102 | # resolution=(6, 32)).fade(0.1).set_opacity(0.4)
103 | #cilindro1.set_color(RED_C).move_to((M1/2)*IN)
104 | # cilindro2.set_opacity(0.4)
105 |
106 | #bola1=Circle(radius=r1,color=RED,color_opacity=1).move_to(M1*OUT)
107 | bola1=Circle(radius=r1,color=RED,color_opacity=1)
108 |
109 | #plano1=Rectangle(height=3, width=5,color=PURPLE_C,fill_color=PURPLE_C,fill_opacity=0.4,
110 | # color_opacity=0.4 ).move_to(M*OUT)
111 | bola=Circle(radius=r,color=RED,color_opacity=1).move_to(M*OUT)
112 | linealabel=TexMobject(r'''\delta''').next_to(bola,RIGHT,buff=0.5).set_color(RED_C).rotate(PI/2,axis=RIGHT).scale(2)
113 | linea=Line((0,0,0),(r,0,0),stroke_width=3,color=RED_C)
114 |
115 | def puntosEnSuperficie(rad,lim,num):
116 | puntosDom = []
117 | puntosSur = []
118 | for i in range(num):
119 | azar = np.random.uniform(-lim,lim, (1,2))[0]
120 | if ((rad < np.sqrt(azar[0]**2 + azar[1]**2)) and not (azar[0]<0 and azar[1]>0)):
121 | puntosDom.append(Dot(np.array([azar[0], azar[1],0]), color = PURPLE))
122 | puntosSur.append(Dot(superficie.func(azar[0], azar[1]), color = RED))
123 | return puntosDom, puntosSur
124 |
125 | puntosD1, puntosS1 = puntosEnSuperficie(r, 3, 6000)
126 | puntosD2, puntosS2 = puntosEnSuperficie(r1, r, 3000)
127 |
128 | GPuntosD1 = VGroup(*puntosD1)
129 | GPuntosS1 = VGroup(*puntosS1)
130 | GPuntosD2 = VGroup(*puntosD2)
131 | GPuntosS2 = VGroup(*puntosS2)
132 |
133 | ###Animacion
134 | self.set_camera_orientation(0.8*np.pi/2, -0.25*np.pi,distance=15)
135 | self.begin_ambient_camera_rotation(rate=0.001)
136 | self.play(ShowCreation(axes))
137 | self.add_fixed_in_frame_mobjects(text1)
138 | self.play(Write(text1))
139 | self.play(ShowCreation(superficie))
140 | self.wait(2)
141 | self.play(FadeOut(text1))
142 | self.add_fixed_in_frame_mobjects(text2)
143 | self.play(Write(text2))
144 | #self.play(ShowCreation(plano1))
145 | self.wait(2.75)
146 | self.play(FadeOut(text2))
147 | self.add_fixed_in_frame_mobjects(text3)
148 | self.play(Write(text3))
149 | self.play(ShowCreation(linea))
150 | self.play(Write(linealabel))
151 | self.play(ShowCreation(bola))
152 | self.play(FadeOut(linea),FadeOut(linealabel))
153 | self.play(FadeOut(text3))
154 | self.add_fixed_in_frame_mobjects(text4)
155 | self.play(Write(text4))
156 | self.play(FadeIn(GPuntosD1))
157 | self.play(FadeIn(GPuntosS1))
158 | #self.play(ShowCreation(cilindro))
159 | self.wait(8.3)
160 | self.play(FadeOut(text4))
161 | self.add_fixed_in_frame_mobjects(text5)
162 | self.play(Write(text5))
163 | ##self.play(plano1.shift,M1*OUT,runtime=1.5)
164 | self.play(ReplacementTransform(bola,bola1))
165 | self.wait()
166 | self.play(FadeIn(GPuntosD2))
167 | self.play(FadeIn(GPuntosS2))
168 | #self.play(ReplacementTransform(cilindro,cilindro1))
169 | self.wait(4.6)
170 | self.play(FadeOut(text5))
171 | self.add_fixed_in_frame_mobjects(text6)
172 | self.play(Write(text6))
173 | self.wait(6.5)
174 | self.play(FadeOut(axes),FadeOut(text6),FadeOut(superficie),FadeOut(bola1),
175 | FadeOut(GPuntosD1),FadeOut(GPuntosS1),FadeOut(GPuntosD2),FadeOut(GPuntosS2))
--------------------------------------------------------------------------------
/Topologia/tipos_puntos.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #######################
4 | ### TIPOS DE PUNTOS ###
5 | #######################
6 |
7 |
8 | class TiposPuntos(Scene):
9 | def construct(self):
10 | titulo = TextMobject("Tipos de Puntos")
11 | titulo.scale(1.5)
12 | t_1 = TextMobject("Sea A un conjunto cualquiera")
13 | interior_t = TextMobject("Punto interior de A")
14 | interior_t.move_to((-3.75, 2.5, 0)).set_color(RED)
15 | exterior_t = TextMobject("Punto exterior de A")
16 | exterior_t.move_to((-3.75, 1, 0)).set_color(BLUE)
17 | frontera_t = TextMobject("Punto frontera de A")
18 | frontera_t.move_to((-3.75, 0, 0)).set_color(GREEN)
19 | interior_def = TexMobject(
20 | "\\exists r>0, \\ tq. \\ \\mathbb{B}_r(x_0)\\subset A"
21 | )
22 | interior_def.move_to((3, 2.5, 0)).set_color(WHITE)
23 | exterior_def = TexMobject(
24 | "\\exists r>0, \\ tq. \\ \\mathbb{B}_r(x_0)\\subset A^c"
25 | )
26 | exterior_def.move_to((3, 1, 0)).set_color(WHITE)
27 | frontera_def = TexMobject("""\\forall r>0, \\ tq.""")
28 | frontera_def_1 = TexMobject("""\\mathbb{B}_r(x_0)\\cap A\\neq \\emptyset""")
29 | frontera_def_2 = TexMobject("""y""")
30 | frontera_def_3 = TexMobject("""\\mathbb{B}_r(x_0)\\cap A^c\\neq \\emptyset""")
31 | frontera_def.move_to((3, 0, 0)).set_color(WHITE)
32 | frontera_def_1.next_to(frontera_def, DOWN, buff=0.1).set_color(WHITE)
33 | frontera_def_2.next_to(frontera_def_1, DOWN, buff=0.1).set_color(WHITE)
34 | frontera_def_3.next_to(frontera_def_2, DOWN, buff=0.1).set_color(WHITE)
35 |
36 | texto_1 = TextMobject(
37 | """Pero \\textquestiondown qu\\'{e} significa geom\\'{e}tricamente?"""
38 | )
39 |
40 |
41 | texto_3 = (
42 | TextMobject(
43 | """ \\textexclamdown Por favor regresa el video e intenta \n
44 | asociar las definiciones de cada tipo \n
45 | de punto con el dibujo y visualiza cada \n
46 | definici\\'{o}n en este dibujo!"""
47 | )
48 | .scale(0.5)
49 | .move_to((-4.5, 2.5, 0))
50 | )
51 | texto_4 = TextMobject(
52 | """El conjunto de todos los puntos \n
53 | interiores de un conjunto es el""",
54 | " INTERIOR",
55 | """ del \n
56 | conjunto.""",
57 | ).move_to((0, 2, 0))
58 | texto_4[1].set_color(RED)
59 |
60 | texto_5 = TextMobject(
61 | """El conjunto de todos los puntos \n
62 | exteriores de un conjunto es el""",
63 | """ EXTERIOR""",
64 | """ del \n
65 | conjunto. """,
66 | ).move_to((0, 0, 0))
67 | texto_5[1].set_color(BLUE)
68 |
69 | texto_6 = TextMobject(
70 | """El conjunto de todos los puntos \n
71 | frontera de un conjunto es la""",
72 | " FRONTERA",
73 | """ del \n
74 | conjunto. """,
75 | ).move_to((0, -2, 0))
76 | texto_6[1].set_color(GREEN)
77 |
78 | texto_7t = TextMobject(
79 | """Intenta probar lo siguiente: Si $A$ es un conjunto"""
80 | )
81 | texto_71 = TextMobject("""1) \\ $Int(A)\\cap Fr(A) = \\emptyset$""")
82 | texto_72 = TextMobject("""2) \\ $Int(A)\\cap Ext(A) = \\emptyset$""")
83 | texto_73 = TextMobject("""3) \\ $Ext(A)\\cap Fr(A) = \\emptyset$""")
84 | texto_74 = TextMobject("""4) \\ $Int(A^c) = Ext(A)$""")
85 |
86 | texto_7t.shift(3 * UP)
87 | texto_71.next_to(texto_7t, 2*DOWN)
88 | texto_72.next_to(texto_71, DOWN)
89 | texto_73.next_to(texto_72, DOWN)
90 | texto_74.next_to(texto_73, DOWN)
91 |
92 | texto_7 = VGroup(texto_7t, texto_71, texto_72, texto_73, texto_74)
93 |
94 | # figs:
95 |
96 | conjunto = Circle(
97 | radius=3, color=YELLOW_B, fill_color=YELLOW_D, fill_opacity=0.7
98 | )
99 | punto_int = Dot(point=(1, 1, 0)).set_color(RED)
100 | punto_ext = Dot(point=(3, 3, 0)).set_color(BLUE)
101 | punto_fr = Dot(point=(1.5, np.sqrt(9 - 1.5 ** 2), 0)).set_color(GREEN)
102 |
103 | flecha_int = Arrow((-1.5, 2.5, 0), (0.3, 2.5, 0)).set_color(RED)
104 | flecha_ext = Arrow((-1.5, 1, 0), (0.3, 1, 0)).set_color(BLUE)
105 | flecha_fr = Arrow((-1.5, 0, 0), (0.3, 0, 0)).set_color(GREEN)
106 |
107 | cjto_int = Circle(
108 | radius=1, color=RED, fill_color=RED, fill_opacity=0.7
109 | ).move_to((1, 1, 0))
110 | cjto_ext = Circle(
111 | radius=0.5, color=BLUE, fill_color=BLUE, fill_opacity=0.7
112 | ).move_to((3, 3, 0))
113 | cjto_fr = Circle(
114 | radius=0.5, color=GREEN, fill_color=GREEN, fill_opacity=0.7
115 | ).move_to(punto_fr.get_center())
116 |
117 | # GPOS
118 |
119 | gpo_1 = VGroup(
120 | interior_t,
121 | exterior_t,
122 | frontera_t,
123 | interior_def,
124 | exterior_def,
125 | frontera_def,
126 | flecha_int,
127 | flecha_ext,
128 | flecha_fr,
129 | frontera_def_1,
130 | frontera_def_2,
131 | frontera_def_3,
132 | )
133 |
134 | gpo_11 = VGroup(interior_t, interior_def, flecha_int)
135 | gpo_12 = VGroup(exterior_t, exterior_def, flecha_ext)
136 | gpo_13 = VGroup(
137 | frontera_t,
138 | frontera_def,
139 | flecha_fr,
140 | frontera_def_1,
141 | frontera_def_2,
142 | frontera_def_3,
143 | )
144 |
145 | # animación
146 | self.play(Write(titulo))
147 | self.wait(2)
148 | self.play(FadeOut(titulo))
149 | self.play(Write(t_1))
150 | self.wait(2)
151 | self.play(FadeOut(t_1))
152 | self.play(Write(gpo_11))
153 | self.wait(1.4)
154 | self.play(Write(gpo_12))
155 | self.wait(1.4)
156 | self.play(Write(gpo_13))
157 | self.wait(3)
158 | self.play(ReplacementTransform(gpo_1, texto_1))
159 | self.wait(2.6)
160 | self.play(ReplacementTransform(texto_1, conjunto))
161 | self.wait(2.7)
162 | self.play(Write(punto_int), Write(punto_ext), Write(punto_fr))
163 | self.wait(1.2)
164 | self.play(DrawBorderThenFill(cjto_int), runtime=0.2)
165 | self.play(DrawBorderThenFill(cjto_ext), runtime=0.2)
166 | self.play(DrawBorderThenFill(cjto_fr), runtime=0.2)
167 | self.play(Write(texto_3))
168 | self.wait(4)
169 | self.play(
170 | FadeOut(texto_3),
171 | FadeOut(cjto_int),
172 | FadeOut(cjto_ext),
173 | FadeOut(cjto_fr),
174 | FadeOut(conjunto),
175 | FadeOut(punto_int),
176 | FadeOut(punto_ext),
177 | FadeOut(punto_fr),
178 | )
179 | self.play(Write(texto_4))
180 | self.wait(2)
181 | self.play(Write(texto_5))
182 | self.wait(2)
183 | self.play(Write(texto_6))
184 | self.wait(2)
185 | self.play(FadeOut(texto_4), FadeOut(texto_5), FadeOut(texto_6))
186 | self.play(Write(texto_7t))
187 | self.wait(2)
188 | self.play(Write(texto_71))
189 | self.wait(2)
190 | self.play(Write(texto_72))
191 | self.wait(2)
192 | self.play(Write(texto_73))
193 | self.wait(2)
194 | self.play(Write(texto_74))
195 | self.wait(2)
196 | self.play(FadeOut(texto_7))
--------------------------------------------------------------------------------
/Topologia/asilados_acumulacion.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | #############################################################
4 | #### PUNTOS AISLADOS, DE ACUMULACION Y CONJUNTO DERIVADO ####
5 | #############################################################
6 |
7 |
8 | class Puntos_Aislado_y_Acumulacion(Scene):
9 | def construct(self):
10 | title = TextMobject(
11 | """Puntos Aislados y \n
12 | Puntos de Acumulación"""
13 | ).scale(1.5)
14 | text1 = TextMobject("""Considera el siguiente conjunto """, """$A$""")
15 | text1.set_color_by_tex_to_color_map({"A": YELLOW})
16 | text2 = TextMobject(
17 | """Fíjate en los puntos """, """$x$""", """ e """, """$y$"""
18 | ).to_edge(UP)
19 | text2.set_color_by_tex_to_color_map({"x": RED, "y": BLUE})
20 | B = (
21 | SVGMobject("Topologia_SVGs/cjtoA.svg", color=YELLOW, fill_color=YELLOW)
22 | .shift(1.5 * LEFT)
23 | .scale(2)
24 | )
25 | x = Dot(point=((1, 0, 0)), color=YELLOW, radius=0.1)
26 | x_label = TexMobject("x", color=RED).next_to(x, DOWN)
27 | cjto = VGroup(B, x)
28 | y = Dot(point=((-1.8, 0.5, 0)), color=BLUE, radius=0.1)
29 | y_label = TexMobject("y", color=BLUE).next_to(y, DOWN)
30 | grupo = VGroup(y, x_label, y_label)
31 | bola = Circle(radius=1, color=PURPLE_B).move_to((1, 0, 0))
32 | radio = Line(((1, 0, 0)), ((2, 0, 0)), color=PURPLE_B)
33 | eps = TexMobject(r"\varepsilon").next_to(radio, UP)
34 | aislado = VGroup(bola, radio, eps)
35 |
36 | text3 = TextMobject(
37 | """¿Cuál crees que sea un""", """ punto aislado""", """?"""
38 | ).to_edge(UP)
39 | text3.set_color_by_tex_to_color_map(
40 | {
41 | """punto aislado""": PURPLE_B,
42 | }
43 | )
44 |
45 | text4 = TextMobject(
46 | """¿Cuál crees que sea un""", """ punto de acumulación""", """?"""
47 | ).to_edge(UP)
48 | text4.set_color_by_tex_to_color_map(
49 | {
50 | """punto de acumulación""": GREEN_D,
51 | }
52 | )
53 |
54 | text5 = TextMobject(
55 | """$x$""",
56 | """ es un""",
57 | """ punto aislado""",
58 | """, al tomar alguna $\\varepsilon >0$ \n
59 | vemos que $B_{\\varepsilon}($""",
60 | """$x$""",
61 | """)$\\cap$ """,
62 | """$A$""",
63 | """$=$""",
64 | """$\\{x\\}$""",
65 | ).to_edge(UP)
66 | # ,'''${x}$''','''\\'''
67 | text5.set_color_by_tex_to_color_map(
68 | {
69 | """punto aislado""": PURPLE_B,
70 | """$A$""": YELLOW,
71 | """$x$""": RED
72 | #'''$\\{x\\}$''': RED,
73 | }
74 | )
75 | text5[8][1].set_color(RED)
76 |
77 | text6 = TextMobject(
78 | """Mientras que """,
79 | """$y$""",
80 | """ es un""",
81 | """ punto de acumulación""",
82 | """ pues $\\forall\\varepsilon >0$ \n
83 | se cumple que $(B_{\\varepsilon}($""",
84 | """$y$""",
85 | """)$\\backslash$""",
86 | """$\\{y\\}$""",
87 | """$)\\cap $""",
88 | """$A$""",
89 | """$\\neq \\emptyset$""",
90 | ).to_edge(UP)
91 | text6.set_color_by_tex_to_color_map(
92 | {
93 | """punto de acumulación""": GREEN_D,
94 | """$A$""": YELLOW,
95 | """$y$""": BLUE
96 | #'''$\\{y\\}$''': BLUE
97 | }
98 | )
99 | text6[7][1].set_color(BLUE)
100 |
101 | text7 = TextMobject(
102 | """El conjunto de todos los""",
103 | """ puntos de acumulación""",
104 | """ de """,
105 | """$A$""",
106 | """ \\\\ se llama""",
107 | """ conjunto derivado""",
108 | """, y se denota por """,
109 | """$der(A)$""",
110 | ).scale(0.9)
111 | text7.set_color_by_tex_to_color_map(
112 | {
113 | """puntos de acumulación""": GREEN_D,
114 | """conjunto derivado""": RED,
115 | """$der(A)$""": RED,
116 | """$A$""": YELLOW,
117 | }
118 | )
119 |
120 | text8 = TextMobject(
121 | """Intenta demostrar las siguientes propiedades \\\\ de dicho conjunto:"""
122 | ).move_to((0, 2.5, 0))
123 | prop1 = TextMobject(
124 | """$der(A)$""",
125 | """ es la unión de $int(A)$ y los puntos frontera no aislados""",
126 | ).move_to((0, 1, 0))
127 | prop2 = TextMobject(
128 | """$cl(A)=$""", """$A$""", """$\cup$""", """$der(A)$"""
129 | ).next_to(prop1, DOWN)
130 | prop3 = TextMobject(
131 | """Todos los""",
132 | """ puntos""",
133 | """ de $int(A)$ son""",
134 | """ de acumulación""",
135 | ).next_to(prop2, DOWN)
136 | prop1.set_color_by_tex_to_color_map(
137 | {
138 | """$der(A)$""": RED,
139 | }
140 | )
141 | prop2.set_color_by_tex_to_color_map({"""$der(A)$""": RED, """$A$""": YELLOW})
142 | prop3.set_color_by_tex_to_color_map(
143 | {"""puntos""": GREEN_D, """de acumulación""": GREEN_D}
144 | )
145 | prop4 = TextMobject(
146 | """Todos los """,
147 | """puntos aislados""",
148 | """ de """,
149 | """$A$""",
150 | """ son puntos frontera de """,
151 | """$A$""",
152 | ).next_to(prop3, DOWN)
153 | prop4.set_color_by_tex_to_color_map(
154 | {"""puntos aislados""": PURPLE_B, """$A$""": YELLOW}
155 | )
156 | propiedades = VGroup(text8, prop1, prop2, prop3, prop4)
157 |
158 | # Secuencia de la animación
159 | self.play(Write(title))
160 | self.wait()
161 | self.play(ReplacementTransform(title, text1))
162 | self.play(ApplyMethod(text1.to_edge, UP))
163 | self.play(DrawBorderThenFill(cjto))
164 | self.wait()
165 | self.play(
166 | ReplacementTransform(text1, text2),
167 | ApplyMethod(x.set_color, RED),
168 | Write(grupo),
169 | )
170 | self.wait(2)
171 | #
172 | self.play(ReplacementTransform(text2, text3))
173 | self.wait(2)
174 | self.play(ReplacementTransform(text3, text4))
175 | self.wait(2)
176 | self.play(ReplacementTransform(text4, text5), ShowCreation(aislado))
177 | self.wait(13)
178 | self.play(ReplacementTransform(text5, text6), FadeOut(aislado))
179 | ##
180 | i = 4
181 | bola_ant = Circle(radius=i, color=GREEN_D).move_to((-1.8, 0.5, 0))
182 | while i > 0.2:
183 | bola_sig = Circle(radius=i, color=GREEN_D).move_to((-1.8, 0.5, 0))
184 |
185 | self.play(ReplacementTransform(bola_ant, bola_sig))
186 | self.wait()
187 |
188 | bola_ant = bola_sig
189 | i = 0.5 * i
190 | self.wait(5)
191 | self.play(FadeOut(text6), FadeOut(bola_ant), FadeOut(cjto), FadeOut(grupo))
192 | self.wait(2)
193 | self.play(Write(text7))
194 | self.wait(10)
195 | self.play(ReplacementTransform(text7, text8))
196 | self.wait(5)
197 | self.play(Write(prop1))
198 | self.wait(8)
199 | self.play(Write(prop2))
200 | self.wait(7)
201 | self.play(Write(prop3))
202 | self.wait(6)
203 | self.play(Write(prop4))
204 | self.wait(6)
205 | self.play(FadeOut(propiedades))
--------------------------------------------------------------------------------
/Límite y continuidad en funciones multivariable/divergencia_R-Rn_infinito.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | class Limites_Al_Infinito(ThreeDScene):
4 | def cur_1(self, t):
5 | return np.array([t, t * np.sin(5 * t), -np.exp(t / 2) * np.cos(5 * t)])
6 |
7 | def construct(self):
8 |
9 | ###Texto
10 | titulo = TextMobject(
11 | """Divergencia a Infinito de Funciones de \n
12 | $\\mathbb{R}\\rightarrow\\mathbb{R}^{n}$ en Infinito""",
13 | )
14 | definicion_1 = TextMobject(
15 | """Sea $f: \\mathbb{R} \\rightarrow \\mathbb{R}^{n}$"""
16 | )
17 | definicion_2 = TextMobject(
18 | """$$\\implies \\ \\lim_{t \\rightarrow \\infty} f(t) = \\vec{\\infty} \\Leftrightarrow \\forall \\: M >0$$"""
19 | )
20 | definicion_3 = TextMobject(
21 | """$\\exists$ $\\delta >0$ tal que si $ t> \\delta$ \n
22 | $\\implies \\ \\Vert f(t) \\Vert > M$"""
23 | ).move_to(definicion_2.get_center() + 0.9 * DOWN)
24 |
25 | ##Animacion definiciones
26 | self.play(Write(titulo.scale(1.5)))
27 | self.wait()
28 | self.play(FadeOut(titulo))
29 | self.play(Write(definicion_1))
30 | self.wait(2.5)
31 | self.play(definicion_1.shift, 1.2 * UP, runtime=1.5)
32 | self.play(Write(definicion_2))
33 | self.wait(6.5)
34 | self.play(Write(definicion_3))
35 | self.wait(7.6)
36 | self.play(FadeOut(definicion_2), FadeOut(definicion_3), FadeOut(definicion_1))
37 | self.wait()
38 | self.custom_method()
39 |
40 | def custom_method(self):
41 | t_1 = TextMobject("""Por ejemplo:""")
42 | t_2 = TextMobject("""$f(t) = (t \\sin(5t),- e^{\\frac{t}{2}} \\cos(5t))$""")
43 | t_2.set_color(TEAL)
44 | t_3 = TextMobject("""Cuando $t \\rightarrow \\infty$""")
45 | t_4 = TextMobject("""Vemos que $\\forall$""", """ $M$""", """$>0$""")
46 | t_4[1].set_color(YELLOW)
47 | t_5 = TextMobject("""Si $t > $ """, """$\\delta$ """, """ adecuada""")
48 | t_5[1].set_color(RED)
49 | t_6 = TextMobject(
50 | """Notamos que \n
51 | $ \\Vert $""",
52 | """$f(t)$""",
53 | """$ \\Vert > $""",
54 | """$ M$""",
55 | )
56 | t_6[1].set_color(TEAL)
57 | t_6[3].set_color(YELLOW)
58 | t_7 = TextMobject("""$\\forall$""", """ $M $""", """$> 0$""")
59 | t_7[1].set_color(YELLOW)
60 | t_8 = TextMobject(
61 | """¿Qué crees que sucede cuando $t \\rightarrow - \\infty$?"""
62 | )
63 |
64 | t_1.to_corner(UL)
65 | t_2.to_corner(UL)
66 | t_3.to_corner(UL)
67 | t_4.to_corner(UL)
68 | t_5.to_corner(UL)
69 | t_6.to_corner(UL)
70 | t_7.to_corner(UL)
71 |
72 | axes = ThreeDAxes(
73 | x_min=-5.5, x_max=5.5, z_min=-5.5, z_max=40, num_axis_pieces=50
74 | )
75 | axes.add(axes.get_x_axis_label("t"))
76 | curve_1 = ParametricFunction(self.cur_1, color=TEAL, t_min=-5, t_max=5)
77 |
78 | M = Line(
79 | np.array([0, 0, 0]),
80 | np.array([0, -1 / np.sqrt(2), 1 / np.sqrt(2)]),
81 | stroke_width=8,
82 | color=YELLOW,
83 | ).move_to(np.array([1, -1 / (2 * np.sqrt(2)), 1 / (2 * np.sqrt(2))]))
84 | m = (
85 | TextMobject("$M$")
86 | .rotate(PI / 2, axis=RIGHT)
87 | .rotate(PI / 2, about_edge=Z_AXIS)
88 | .move_to(M.get_center() + np.array([0, -0.5, 0.5]))
89 | .set_color(YELLOW)
90 | )
91 | Delta = Line(
92 | np.array([0, 0, 0]), np.array([1, 0, 0]), stroke_width=8, color=RED
93 | ).move_to(np.array([0.5, 0, 0]))
94 | delta = (
95 | TextMobject("$\\delta$")
96 | .rotate(PI / 2, axis=RIGHT)
97 | .rotate(PI / 2, about_edge=Z_AXIS)
98 | .move_to(Delta.get_center() + np.array([0.5, 0.5, 0]))
99 | .set_color(RED)
100 | )
101 | Bola = (
102 | Circle(radius=1, color=YELLOW)
103 | .rotate(PI / 2, axis=RIGHT)
104 | .rotate(PI / 2, about_edge=Z_AXIS)
105 | .move_to(np.array([1, 0, 0]))
106 | )
107 |
108 | ###Grupos
109 | Group = VGroup(M, m, Delta, delta, Bola)
110 | Group_1 = VGroup(curve_1)
111 | Group_2 = VGroup(M, m)
112 | Group_3 = VGroup(Delta, delta)
113 |
114 | ### Update
115 |
116 | x = ValueTracker(1)
117 |
118 | def update_group(Group):
119 | M, m, Delta, delta, Bola = Group
120 | M_new = Line(
121 | np.array([0, 0, 0]),
122 | np.array([0, -x.get_value() / np.sqrt(2), x.get_value() / np.sqrt(2)]),
123 | stroke_width=8,
124 | color=YELLOW,
125 | ).move_to(
126 | np.array(
127 | [
128 | x.get_value(),
129 | -x.get_value() / (2 * np.sqrt(2)),
130 | x.get_value() / (2 * np.sqrt(2)),
131 | ]
132 | )
133 | )
134 | M.become(M_new)
135 | m.move_to(
136 | M_new.get_center()
137 | + np.array([0, -x.get_value() / np.sqrt(2), x.get_value() / np.sqrt(2)])
138 | )
139 | Delta_new = Line(
140 | np.array([0, 0, 0]),
141 | np.array([x.get_value(), 0, 0]),
142 | stroke_width=8,
143 | color=RED,
144 | ).move_to(np.array([(x.get_value()) / 2, 0, 0]))
145 | Delta.become(Delta_new)
146 | delta.move_to(Delta_new.get_center() + np.array([0.5, 0.5, 0]))
147 | Bola_new = (
148 | Circle(radius=x.get_value(), color=YELLOW)
149 | .rotate(PI / 2, axis=RIGHT)
150 | .rotate(PI / 2, about_edge=Z_AXIS)
151 | .move_to(np.array([x.get_value(), 0, 0]))
152 | )
153 | Bola.become(Bola_new)
154 | return Group
155 |
156 | ### Animaciones
157 | self.begin_ambient_camera_rotation(rate=0.12)
158 | self.add_fixed_in_frame_mobjects(t_1)
159 | self.play(Write(t_1))
160 | self.wait(2.75)
161 | self.play(FadeOut(t_1))
162 | self.add(axes)
163 | self.set_camera_orientation(phi=65 * DEGREES, theta=-90 * DEGREES)
164 | self.play(LaggedStart(ShowCreation(Group_1)))
165 | self.wait(2)
166 | self.add_fixed_in_frame_mobjects(t_2)
167 | self.play(Write(t_2))
168 | self.wait(6)
169 | self.play(FadeOut(t_2))
170 | self.add_fixed_in_frame_mobjects(t_3)
171 | self.play(Write(t_3))
172 | self.wait(3.5)
173 | self.play(FadeOut(t_3))
174 | self.add_fixed_in_frame_mobjects(t_4)
175 | self.play(Write(t_4))
176 | self.wait(4.2)
177 | self.add(Group_2)
178 | self.wait()
179 | self.play(FadeOut(t_4))
180 | self.wait()
181 | self.add_fixed_in_frame_mobjects(t_5)
182 | self.play(Write(t_5))
183 | self.wait(3.8)
184 | self.add(Group_3)
185 | self.wait()
186 | self.play(FadeOut(t_5))
187 | self.add(Bola)
188 | self.add_fixed_in_frame_mobjects(t_6)
189 | self.play(Write(t_6))
190 | self.wait(4.2)
191 | self.play(FadeOut(t_6))
192 | self.wait()
193 | self.add_fixed_in_frame_mobjects(t_7)
194 | self.play(Write(t_7))
195 | self.wait(3.5)
196 | Group.add_updater(update_group)
197 | self.add(Group)
198 | self.play(x.increment_value, 2, rate_func=linear, run_time=10)
199 | self.wait()
200 | self.play(FadeOut(t_7))
201 | self.play(FadeOut(Group))
202 | self.play(FadeOut(Group_1), FadeOut(axes))
203 | self.add_fixed_in_frame_mobjects(t_8)
204 | self.play(Write(t_8))
205 | self.wait(5)
206 | self.play(FadeOut(t_8))
--------------------------------------------------------------------------------
/Límite y continuidad en funciones multivariable/divergencia_R-Rn_punto.py:
--------------------------------------------------------------------------------
1 | from manimlib.imports import *
2 |
3 | class Divergencia_A_Infinito(ThreeDScene):
4 | def cur_1(self, t):
5 | return np.array([t, 1 / (1 - t), t ** 2])
6 |
7 | def construct(self):
8 |
9 | ###Texto
10 | titulo = TextMobject(
11 | """Divergencia a Infinito de Funciones de \n
12 | $\\mathbb{R}\\rightarrow\\mathbb{R}^{n}$ en un Punto $t_0$"""
13 | )
14 | definicion_1 = TextMobject(
15 | """Sea $f: \\mathbb{R} \\rightarrow \\mathbb{R}^{n}$"""
16 | )
17 | definicion_2 = TextMobject(
18 | """$$\\lim_{t \\rightarrow t_{0}} f(t) = \\vec{\\infty} \\Leftrightarrow \\forall \\: M >0$$"""
19 | )
20 | definicion_3 = TextMobject(
21 | """$\\exists \\delta >0$ tal que si $0< |t-t_{0}| < \\delta$ \n $\\Rightarrow \\Vert f(t) \\Vert > M$"""
22 | ).move_to(definicion_2.get_center() + 0.8 * DOWN)
23 |
24 | ### Animaciones
25 | self.play(Write(titulo.scale(1.5)))
26 | self.wait()
27 | self.play(FadeOut(titulo))
28 | self.play(Write(definicion_1))
29 | self.wait(4.25)
30 | self.play(definicion_1.shift, 1.2 * UP, runtime=1.5)
31 | self.play(Write(definicion_2))
32 | self.wait(6.125)
33 | self.play(Write(definicion_3))
34 | self.wait(8.75)
35 | self.play(FadeOut(definicion_2), FadeOut(definicion_3), FadeOut(definicion_1))
36 | self.wait()
37 | self.custom_method()
38 |
39 | def custom_method(self):
40 | t_1 = TextMobject("""Veamos este ejemplo:""")
41 | t_2 = TextMobject("""$f(t) = (\\frac{1}{1-t},t^2)$""")
42 | t_2[0].set_color(PURPLE)
43 | t_3 = TextMobject(
44 | """¿Qué sucede cuando \n
45 | $t \\rightarrow 1$?"""
46 | )
47 | t_4 = TextMobject("""Tomemos """, """$M$""", """$>0$""")
48 | t_4[1].set_color("#88FF00")
49 | t_5 = TextMobject(
50 | """Si elegimos adecuadamente \n
51 | """,
52 | """$\\delta$""",
53 | """$>0 $""",
54 | )
55 | t_5[1].set_color(BLUE)
56 | t_6 = TextMobject(
57 | """Es claro que \n
58 | $\\Vert$""",
59 | """$ f(t) $""",
60 | """$\\Vert >$""",
61 | """$ M$""",
62 | )
63 | t_6[1].set_color(PURPLE)
64 | t_6[3].set_color("#88FF00")
65 | t_7 = TextMobject("""$\\forall$""", """ $M$""", """$> 0$""")
66 | t_7[1].set_color("#88FF00")
67 | t_8 = TextMobject(
68 | """¿Se te ocurre como definir este límite usando sucesiones?"""
69 | )
70 |
71 | t_1.to_corner(UL)
72 | t_2.to_corner(UL)
73 | t_3.to_corner(UL)
74 | t_4.to_corner(UL)
75 | t_5.to_corner(UL)
76 | t_6.to_corner(UL)
77 | t_7.to_corner(UL)
78 |
79 | ### Objetos
80 |
81 | axes = ThreeDAxes()
82 | axes.add(axes.get_x_axis_label("t"))
83 | curve_1_1 = ParametricFunction(self.cur_1, color=PURPLE, t_min=-3, t_max=0.9)
84 | curve_1_2 = ParametricFunction(self.cur_1, color=PURPLE, t_min=1.1, t_max=3)
85 |
86 | M = Line(
87 | np.array([0, 0, 0]),
88 | np.array([0, -1 / np.sqrt(2), 1 / np.sqrt(2)]),
89 | stroke_width=8,
90 | color="#88FF00",
91 | ).move_to(np.array([1, -1 / (2 * np.sqrt(2)), 1 / (2 * np.sqrt(2))]))
92 | m = (
93 | TextMobject("$M$")
94 | .rotate(PI / 2, axis=RIGHT)
95 | .rotate(PI / 2, about_edge=Z_AXIS)
96 | .move_to(M.get_center() + np.array([0, -0.5, 0.5]))
97 | .set_color("#88FF00")
98 | )
99 | Delta = Line(
100 | np.array([0, 0, 0]), np.array([1.5, 0, 0]), stroke_width=8, color=BLUE
101 | ).move_to(np.array([1.75, 0, 0]))
102 | delta = (
103 | TextMobject("$\\delta$")
104 | .rotate(PI / 2, axis=RIGHT)
105 | .rotate(PI / 2, about_edge=Z_AXIS)
106 | .move_to(Delta.get_center() + np.array([0.5, 0.5, 0]))
107 | .set_color(BLUE)
108 | )
109 | Bola = (
110 | Circle(radius=1, color="#88FF00")
111 | .rotate(PI / 2, axis=RIGHT)
112 | .rotate(PI / 2, about_edge=Z_AXIS)
113 | .move_to(np.array([1, 0, 0]))
114 | )
115 |
116 | ###Grupos
117 | Group = VGroup(M, m, Delta, delta, Bola)
118 | Group_1 = VGroup(curve_1_1, curve_1_2)
119 | Group_2 = VGroup(M, m)
120 | Group_3 = VGroup(Delta, delta)
121 |
122 | ### Update
123 |
124 | x = ValueTracker(1)
125 |
126 | def update_group(Group):
127 | M, m, Delta, delta, Bola = Group
128 | M_new = Line(
129 | np.array([0, 0, 0]),
130 | np.array([0, -x.get_value() / np.sqrt(2), x.get_value() / np.sqrt(2)]),
131 | stroke_width=8,
132 | color="#88FF00",
133 | ).move_to(
134 | np.array(
135 | [
136 | 1,
137 | -x.get_value() / (2 * np.sqrt(2)),
138 | x.get_value() / (2 * np.sqrt(2)),
139 | ]
140 | )
141 | )
142 | M.become(M_new)
143 | m.move_to(
144 | M_new.get_center()
145 | + np.array([0, -x.get_value() / np.sqrt(2), x.get_value() / np.sqrt(2)])
146 | )
147 | Delta_new = Line(
148 | np.array([0, 0, 0]),
149 | np.array([1 / x.get_value(), 0, 0]),
150 | stroke_width=8,
151 | color=BLUE,
152 | ).move_to(np.array([1 + (1 / x.get_value()) / 2, 0, 0]))
153 | Delta.become(Delta_new)
154 | delta.move_to(Delta_new.get_center() + np.array([0.5, 0.5, 0]))
155 | Bola_new = (
156 | Circle(radius=x.get_value(), color="#88FF00")
157 | .rotate(PI / 2, axis=RIGHT)
158 | .rotate(PI / 2, about_edge=Z_AXIS)
159 | .move_to(np.array([1, 0, 0]))
160 | )
161 | Bola.become(Bola_new)
162 | return Group
163 |
164 | ## Animaciones
165 | self.begin_ambient_camera_rotation(rate=0.1)
166 | self.add_fixed_in_frame_mobjects(t_1)
167 | self.play(Write(t_1))
168 | self.wait(3.125)
169 | self.play(FadeOut(t_1))
170 | self.add(axes)
171 | self.set_camera_orientation(phi=65 * DEGREES, theta=-90 * DEGREES)
172 | self.play(LaggedStart(ShowCreation(Group_1)))
173 | self.wait(2)
174 | self.add_fixed_in_frame_mobjects(t_2)
175 | self.play(Write(t_2))
176 | self.wait(3.87)
177 | self.play(FadeOut(t_2))
178 | self.add_fixed_in_frame_mobjects(t_3)
179 | self.play(Write(t_3))
180 | self.wait(4.25)
181 | self.play(FadeOut(t_3))
182 | self.add_fixed_in_frame_mobjects(t_4)
183 | self.play(Write(t_4))
184 | self.wait(3.5)
185 | self.add(Group_2)
186 | self.wait()
187 | self.play(FadeOut(t_4))
188 | self.add(Group_3)
189 | self.wait()
190 | self.add_fixed_in_frame_mobjects(t_5)
191 | self.play(Write(t_5))
192 | self.wait(4.25)
193 | self.play(FadeOut(t_5))
194 | self.add(Bola)
195 | self.add_fixed_in_frame_mobjects(t_6)
196 | self.play(Write(t_6))
197 | self.wait(4.625)
198 | self.play(FadeOut(t_6))
199 | self.wait()
200 | self.add_fixed_in_frame_mobjects(t_7)
201 | self.play(Write(t_7))
202 | self.wait(3.5)
203 | Group.add_updater(update_group)
204 | self.add(Group)
205 | self.play(x.increment_value, 1, rate_func=linear, run_time=10)
206 | self.play(FadeOut(t_7))
207 | self.wait()
208 | self.play(FadeOut(Group), FadeOut(Group_1), FadeOut(axes))
209 | self.add_fixed_in_frame_mobjects(t_8)
210 | self.play(Write(t_8))
211 | self.wait(5.375)
212 | self.play(FadeOut(t_8))
--------------------------------------------------------------------------------