This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class longdiv(Scene): | |
| def construct(self): | |
| # https://www.calculatorsoup.com/calculators/math/longdivision.php | |
| divisor = 123 | |
| dividend = 764556 | |
| divisor_mobj = VGroup( | |
| *Tex(f"{divisor}")[0] | |
| ) | |
| remainder = 0 | |
| divisor_mobj.arrange_in_grid( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class smileyeqn(Scene): | |
| def construct(self): | |
| smiley = ImageMobject("bilder/slightly-smiling-face_1f642.png") | |
| tex_templ = TexTemplate() | |
| tex_templ.add_to_preamble(r"\DeclareMathOperator{\sinc}{sinc}") | |
| eqn = MathTex(r"\sinc(x) = \frac{\sin(x)}{x}", tex_template=tex_templ).to_edge(UP) | |
| self.add(eqn) | |
| eqn2 = eqn.copy().next_to(eqn,DOWN) | |
| smiley.scale_to_fit_width(eqn2[0][5].width*1.5) | |
| smileys = Group( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://math.stackexchange.com/questions/2493537/smooth-transition-between-linear-functions | |
| class oscdot4(Scene): | |
| def construct(self): | |
| def f1(x): | |
| return 0 + 0.5*x*2*PI | |
| def f2(x): | |
| return f1(3) + 2.5*(x-3)*2*PI | |
| x0 = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $fn=60; | |
| difference() | |
| { | |
| sphere(r=1.5); | |
| cylinder(h=4,r=1,center=true); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from MF_Tools import ir | |
| class bigeqn(Scene): | |
| def construct(self): | |
| eqn = MathTex( | |
| r"""1+\sum_{i=1}^{2}\left\lfloor\left( | |
| \frac{1}{\sum\limits_{j=1}^{i}\left\lfloor\left(\cos\left(\frac{(j-1)!\,+1}{j}\pi\right)^2\right)\right\rfloor} | |
| \right)^\frac{1}{1}\right\rfloor""" | |
| ) | |
| # uncomment for index labels | |
| #self.add(eqn, index_labels(eqn[0]).set_color(RED)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class orbit(Scene): | |
| def construct(self): | |
| ax = Axes( | |
| x_range=[-200e9,200e9,50e9], | |
| y_range=[-200e9,200e9,50e9], | |
| x_length=8, | |
| y_length=8, | |
| tips=False | |
| ) | |
| G = 6.67e-11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image, ImageFilter | |
| class Scene2(MovingCameraScene): | |
| def construct(self): | |
| def blur_image(mobjs, blur=15, bright=1.2, scale_first=1.2): | |
| scene = Scene() | |
| render = scene.renderer | |
| objs = VGroup(*[m.copy().scale(scale_first, about_point=m.get_center()) for m in mobjs]) | |
| render.camera.set_pixel_array(np.zeros_like(render.camera.pixel_array)) | |
| render.camera.capture_mobjects(objs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from manim import * | |
| class tikztest(Scene): | |
| def construct(self): | |
| MyTexTemplate = TexTemplate( | |
| tex_compiler="xelatex", | |
| output_format=".xdv", | |
| documentclass=r"\documentclass[preview,dvisvgm]{standalone}" | |
| ) | |
| MyTexTemplate.add_to_preamble(r"\usepackage{tikz}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from manim import * | |
| import manim.mobject.geometry.tips as tips | |
| class LineFromPoints(Line): | |
| def __init__(self, pointsdirections, radius=0, **kwargs): | |
| super().__init__(**kwargs) | |
| pointsradii = [(pointsdirections[0][0],0)] | |
| for p0,p2 in zip(pointsdirections, pointsdirections[1:]): | |
| if len(p0)==3: | |
| r = p0[2] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LineThroughPoints(Line): | |
| def __init__(self, pointsdirections, radius=0, **kwargs): | |
| super().__init__(**kwargs) | |
| self.pointsdirections = pointsdirections | |
| self.radius = radius | |
| self.set_points([pointsdirections[0][0]]) | |
| for p0,p1 in zip(pointsdirections,pointsdirections[1:]): | |
| dx,dy,dz = p1[0]-p0[0] | |
| if len(p0) == 3: | |
| r = p0[2] |
NewerOlder