from manim import * from manim_physics import * from manim_circuit import * import random as rn class ef1(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(3, 2 * LEFT) charge2 = Charge(-3, 2 * RIGHT) self.add(charge1, charge2) class ef2(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(3, 2 * LEFT) charge2 = Charge(3, 2 * RIGHT) fv1 = LabeledArrow( r"\vec{F}_e", label_color=BLACK, frame_fill_color=WHITE, start=2 * LEFT, end=4 * LEFT, color=BLACK, ) fv2 = LabeledArrow( r"\vec{F}_e", label_color=BLACK, frame_fill_color=WHITE, start=2 * RIGHT, end=4 * RIGHT, color=BLACK, ) self.add(charge1, charge2, fv1, fv2) class ef3(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(3, 2 * LEFT) charge2 = Charge(-3, 2 * RIGHT) fv1 = LabeledArrow( r"\vec{F}_e", label_color=BLACK, frame_fill_color=WHITE, start=2 * LEFT, end=ORIGIN, color=BLACK, ) fv2 = LabeledArrow( r"\vec{F}_e", label_color=BLACK, frame_fill_color=WHITE, start=2 * RIGHT, end=ORIGIN, color=BLACK, ) self.add(charge1, charge2, fv1, fv2) class ef4(Scene): def construct(self): self.camera.background_color = WHITE charge = Charge(3, ORIGIN) field = ElectricField(charge) self.add(charge, field) class ef5(Scene): def construct(self): self.camera.background_color = WHITE charge = Charge(3) field = ElectricField(charge) p = LabeledDot(MathTex("P_1"), color=BLACK).move_to([3, 3, 0]) dv1 = LabeledArrow( r"\vec{r}", label_color=BLACK, frame_fill_color=WHITE, start=ORIGIN, end=[3, 3, 0], color=RED, ) dv2 = LabeledArrow( r"\vec{e}_r", label_color=BLACK, frame_fill_color=WHITE, start=ORIGIN, end=[1.3, 1.3, 0], color=BLUE, ) self.add( field, dv1, dv2, charge, p, ) class ef7(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(3, 2 * LEFT) charge2 = Charge(3, 2 * RIGHT) field = ElectricField(charge1, charge2) fv1 = LabeledArrow( r"\vec{e}_r", label_color=BLACK, frame_fill_color=WHITE, start=2 * RIGHT, end=4 * RIGHT, color=BLACK, ) fv2 = LabeledArrow( r"\vec{e}_r", label_color=BLACK, frame_fill_color=WHITE, start=2 * LEFT, end=4 * LEFT, color=BLACK, ) self.add( field, charge1, charge2, fv1, fv2, ) class ef6(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(3, 2 * LEFT) charge2 = Charge(3, 2 * RIGHT) fv = LabeledArrow( r"\vec{e}_r", label_color=BLACK, frame_fill_color=WHITE, start=2 * RIGHT, end=4 * RIGHT, color=BLACK, ) self.add(charge1, charge2, fv) class ef8(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(6) charge2 = Charge(3, 2 * RIGHT) charge3 = Charge(-3, 2 * LEFT) field = ElectricField(charge1) fv1 = LabeledArrow( r"\vec{e}_r", label_color=BLACK, frame_fill_color=WHITE, start=2 * RIGHT, end=4 * RIGHT, color=BLACK, ) fv2 = LabeledArrow( r"\vec{e}_r", label_color=BLACK, frame_fill_color=WHITE, start=2 * LEFT, end=ORIGIN, color=BLACK, ) self.add( field, charge1, charge2, charge3, fv1, fv2, ) class ef9(ThreeDScene): def construct(self): self.camera.background_color = WHITE plate = Polygon( [0, -2.5, 2.5], [0, 3.5, 2.5], [0, 3.5, -1.5], [0, -2.5, -1.5], color=GREY, fill_color=GREY, fill_opacity=0.25, ) vec1 = Arrow3D(start=[-2, 0, 0], end=[2, 0, 0], color=BLUE) vec2 = Arrow3D(start=[-2, -1, 0], end=[2, -1, 0], color=BLUE) vec3 = Arrow3D(start=[-2, 1, 0], end=[2, 1, 0], color=BLUE) vec4 = Arrow3D(start=[-2, 0, -1], end=[2, 0, -1], color=BLUE) vec5 = Arrow3D(start=[-2, 0, 1], end=[2, 0, 1], color=BLUE) self.set_camera_orientation(PI / 3, PI / 4) self.add(vec1, vec2, vec3, vec4, vec5, plate) class ef10(ThreeDScene): def construct(self): self.camera.background_color = WHITE line = Line( [4, -6, 0], [2, -2, 0], color=BLACK, ) chargel1 = Charge(1, [4, -6.3, 0]) chargel2 = Charge(1, [4, -5.8, 0]) chargel3 = Charge(-1, [2, -2.2, 0]) chargel4 = Charge(-1, [2, -1.8, 0]) plane = Polygon( [0, -2, 0], [2, 0, 0], [0, 2, 0], [-2, 0, 0], color=GREY, fill_color=GREY, fill_opacity=0.25, ) chargep1 = Charge(1, [0.5, -1.5, 0]) chargep2 = Charge(1, [1.5, -0.5, 0]) chargep3 = Charge(-1, [-1.5, 0.5, 0]) chargep4 = Charge(-1, [-0.5, 1.5, 0]) sphere = Sphere( [-3, 3, 0], fill_opacity=0.5, checkerboard_colors=[BLUE, BLUE], stroke_width=0, ) charges1 = Charge(1, [-2, 2, 0]) charges2 = Charge(-1, [-4, 4, 0]) self.set_camera_orientation(PI / 3, PI / 4) self.add( line, chargel1, chargel2, chargel3, chargel4, plane, chargep1, chargep2, chargep3, chargep4, sphere, charges1, charges2, ) class ef11(Scene): def construct(self): self.camera.background_color = WHITE randc = VGroup() x1 = rn.randint(-4, 4) y1 = rn.randint(-4, 4) x2 = rn.randint(-4, 4) y2 = rn.randint(-4, 4) x3 = rn.randint(-4, 4) y3 = rn.randint(-4, 4) x4 = rn.randint(-4, 4) y4 = rn.randint(-4, 4) x5 = rn.randint(-4, 4) y5 = rn.randint(-4, 4) x6 = rn.randint(-4, 4) y6 = rn.randint(-4, 4) x7 = rn.randint(-4, 4) y7 = rn.randint(-4, 4) x8 = rn.randint(-4, 4) y8 = rn.randint(-4, 4) x9 = rn.randint(-4, 4) y9 = rn.randint(-4, 4) x10 = rn.randint(-4, 4) y10 = rn.randint(-4, 4) charge1 = Charge( 1, [x1, y1, 0], ) charge2 = Charge( 1, [x2, y2, 0], ) charge3 = Charge( 1, [x3, y3, 0], ) charge4 = Charge( 1, [x4, y4, 0], ) charge5 = Charge( 1, [x5, y5, 0], ) charge6 = Charge( 1, [x6, y6, 0], ) charge7 = Charge( 1, [x7, y7, 0], ) charge8 = Charge( 1, [x8, y8, 0], ) charge9 = Charge( 1, [x9, y9, 0], ) charge10 = Charge( 1, [x10, y10, 0], ) field = ElectricField( charge1, charge2, charge3, charge4, charge5, charge6, charge7, charge8, charge9, charge10, ) plane = Polygon( [-2, 2, 0], [2, 2, 0], [2, -2, 0], [-2, -2, 0], color=GREY, fill_color=GREY, fill_opacity=0.25, ) self.add(field, plane) class ef12(Scene): def construct(self): self.camera.background_color = WHITE charge = Charge(1, [0, -1000, 0]) field = ElectricField(charge, color=BLUE, x_range=[-2, 2], y_range=[-2, 1.5]) plane = Polygon( [-2, 2, 0], [2, 2, 0], [2, -2, 0], [-2, -2, 0], color=GREY, fill_color=GREY, fill_opacity=0.25, ) vece = Arrow([-4, -2, 0], [-4, 2, 0], color=YELLOW) self.add(field, plane, vece) class ef13(Scene): def construct(self): self.camera.background_color = WHITE plane1 = Polygon( [3, 10, 0], [-10, 10, 0], [-10, -10, 0], [-3, -10, 0], color=BLUE, fill_color=BLUE, fill_opacity=0.25, ) plane2 = Polygon( [3, 10, 0], [10, 10, 0], [10, -10, 0], [-3, -10, 0], color=RED, fill_color=RED, fill_opacity=0.25, ) vec1 = Arrow([-4, -2, 0], [0, 0, 0], color=GREEN) vec2 = Arrow([0, 0, 0], [4, 1, 0], color=GREEN) text1 = MathTex(r"\epsilon_1", color=BLACK).move_to([-5, 3, 0]) text2 = MathTex(r"\epsilon_2", color=BLACK).move_to([5, 3, 0]) self.add(plane1, plane2, vec1, vec2, text1, text2) class ef15(Scene): def construct(self): self.camera.background_color = WHITE plane1 = Line([-1, 2, 0], [-1, -2, 0], color=RED) plane2 = Line([1, 2, 0], [1, -2, 0], color=BLUE) evec1 = Arrow([-0.8, 2, 0], [0.8, 2, 0], color=RED) evec2 = Arrow([-0.8, 1, 0], [0.8, 1, 0], color=RED) evec3 = Arrow([-0.8, 0, 0], [0.8, 0, 0], color=RED) evec4 = Arrow([-0.8, -1, 0], [0.8, -1, 0], color=RED) evec5 = Arrow([-0.8, -2, 0], [0.8, -2, 0], color=RED) box = Polygon( [-3, 3, 0], [3, 3, 0], [3, -3, 0], [-3, -3, 0], color=RED, fill_opacity=0 ) self.add(plane1, plane2, evec1, evec2, evec3, evec4, evec5, box) class ef14(Scene): def construct(self): self.camera.background_color = WHITE cabell = Line([-5, 0, 0], [-1, 0, 0], color=BLACK) cabelr = Line([1, 0, 0], [5, 0, 0], color=BLACK) plane1 = Line([-1, 2, 0], [-1, -2, 0], color=RED) plane2 = Line([1, 2, 0], [1, -2, 0], color=BLUE) evec1 = Arrow([-0.8, 2, 0], [0.8, 2, 0], color=RED) evec2 = Arrow([-0.8, 1, 0], [0.8, 1, 0], color=RED) evec3 = Arrow([-0.8, 0, 0], [0.8, 0, 0], color=RED) evec4 = Arrow([-0.8, -1, 0], [0.8, -1, 0], color=RED) evec5 = Arrow([-0.8, -2, 0], [0.8, -2, 0], color=RED) text1 = MathTex(r"+", color=BLACK).move_to([-1, 3, 0]) text2 = MathTex(r"-", color=BLACK).move_to([1, 3, 0]) self.add( cabell, cabelr, plane1, plane2, evec1, evec2, evec3, evec4, evec5, text1, text2, ) class ef17(Scene): def construct(self): self.camera.background_color = WHITE cabell = Line([-5, 0, 0], [-1, 0, 0], color=BLACK) cabelr = Line([1, 0, 0], [5, 0, 0], color=BLACK) plane1 = Line([-1, 2, 0], [-1, -2, 0], color=RED) plane2 = Line([1, 2, 0], [1, -2, 0], color=BLUE) evec1 = Arrow([-0.8, 2, 0], [0.8, 2, 0], color=RED) evec2 = Arrow([-0.8, 1, 0], [0.8, 1, 0], color=RED) evec3 = Arrow([-0.8, 0, 0], [0.8, 0, 0], color=RED) evec4 = Arrow([-0.8, -1, 0], [0.8, -1, 0], color=RED) evec5 = Arrow([-0.8, -2, 0], [0.8, -2, 0], color=RED) text1 = MathTex(r"+", color=BLACK).move_to([-1, 3, 0]) text2 = MathTex(r"-", color=BLACK).move_to([1, 3, 0]) text3 = MathTex( r"\vec{E}", color=RED, ).move_to([0, 0.5, 0]) text4 = MathTex(r"\vec{s}", color=ORANGE).move_to([0, -3, 0]) line = Arrow([1.3, 0, 0], [-1.3, 0, 0], color=ORANGE) self.add( cabell, cabelr, plane1, plane2, evec1, evec2, evec3, evec4, evec5, text1, text2, text3, text4, line, ) class ef16(Scene): def construct(self): self.camera.background_color = WHITE cabell = Line([-5, 0, 0], [-1, 0, 0], color=BLACK) cabelr = Line([1, 0, 0], [5, 0, 0], color=BLACK) plane1 = Line([-1, 2, 0], [-1, -2, 0], color=RED) plane2 = Line([1, 2, 0], [1, -2, 0], color=BLUE) evec1 = Arrow([-0.8, 2, 0], [0.8, 2, 0], color=RED) evec2 = Arrow([-0.8, 1, 0], [0.8, 1, 0], color=RED) evec3 = Arrow([-0.8, 0, 0], [0.8, 0, 0], color=RED) evec4 = Arrow([-0.8, -1, 0], [0.8, -1, 0], color=RED) evec5 = Arrow([-0.8, -2, 0], [0.8, -2, 0], color=RED) text1 = MathTex(r"+", color=BLACK).move_to([-1, 3, 0]) text2 = MathTex(r"-", color=BLACK).move_to([1, 3, 0]) text3 = MathTex( r"\vec{D}", color=RED, ).move_to([0, 0.5, 0]) text4 = MathTex(r"A", color=ORANGE).move_to([-0.75, -3, 0]) line = Line([-0.75, 2, 0], [-0.75, -2, 0], color=ORANGE) self.add( cabell, cabelr, plane1, plane2, evec1, evec2, evec3, evec4, evec5, text1, text2, text3, text4, line, ) class ef18(Scene): def construct(self): self.camera.background_color = WHITE cabell = Line([-5, 0, 0], [-1, 0, 0], color=BLACK) cabelr = Line([1, 0, 0], [5, 0, 0], color=BLACK) plane1 = Line([-1, 2, 0], [-1, -2, 0], color=RED) plane2 = Line([1, 2, 0], [1, -2, 0], color=BLUE) text1 = MathTex(r"+", color=BLACK).move_to([-1, 3, 0]) text2 = MathTex(r"-", color=BLACK).move_to([1, 3, 0]) diel = Polygon( [-1, 2, 0], [0, 2, 0], [0, -2, 0], [-1, -2, 0], color=GREEN, fill_color=GREEN, fill_opacity=0.75, ) self.add(diel, cabell, cabelr, plane1, plane2, text1, text2) class ef19(Scene): def construct(self): self.camera.background_color = WHITE cabell = Line([-5, 0, 0], [-1, 0, 0], color=BLACK) cabelr = Line([1, 0, 0], [5, 0, 0], color=BLACK) plane1 = Line([-1, 2, 0], [-1, -2, 0], color=RED) plane2 = Line([1, 2, 0], [1, -2, 0], color=BLUE) text1 = MathTex(r"+", color=BLACK).move_to([-1, 3, 0]) text2 = MathTex(r"-", color=BLACK).move_to([1, 3, 0]) diel = Polygon( [-1, 2, 0], [1, 2, 0], [1, 0, 0], [-1, 0, 0], color=GREEN, fill_color=GREEN, fill_opacity=0.75, ) self.add(diel, cabell, cabelr, plane1, plane2, text1, text2) class ef20(Scene): def construct(self): self.camera.background_color = WHITE c0 = ( Capacitor( label="", ) .move_to([0, 2, 0]) .rotate(90 * DEGREES) ) c1 = ( Capacitor( label="", polarized=False, ) .rotate(90 * DEGREES) .move_to([-1, 0, 0]) .set_color(BLACK) ) c2 = ( Capacitor( label="", polarized=False, ) .rotate(90 * DEGREES) .move_to([0, 0, 0]) .set_color(BLACK) ) cn = ( Capacitor( label="", polarized=False, ) .rotate(90 * DEGREES) .move_to([1, 0, 0]) .set_color(BLACK) ) gnd = Ground(ground_type="earth").move_to([0, -2, 0]) circuit = Circuit() self.add(circuit) circuit.add_components(c1, c2, cn) circuit.add_wire(c0.get_terminals("left"), c2.get_terminals("right")) circuit.add_wire( c1.get_terminals("right"), [c1.get_terminals("right")[0], 1, 0], ) circuit.add_wire( cn.get_terminals("right"), [cn.get_terminals("right")[0], 1, 0], ) circuit.add_wire( [c1.get_terminals("right")[0], 1, 0], [c2.get_terminals("right")[0], 1, 0] ) circuit.add_wire( [c2.get_terminals("right")[0], 1, 0], [cn.get_terminals("right")[0], 1, 0] ) circuit.add_wire(c1.get_terminals("left"), [c1.get_terminals("left")[0], -1, 0]) circuit.add_wire(c2.get_terminals("left"), gnd.get_terminals()) circuit.add_wire(cn.get_terminals("left"), [cn.get_terminals("left")[0], -1, 0]) circuit.add_wire( [c1.get_terminals("left")[0], -1, 0], [c2.get_terminals("left")[0], -1, 0] ) circuit.add_wire( [cn.get_terminals("left")[0], -1, 0], [c2.get_terminals("left")[0], -1, 0] ) circuit.set_color(BLACK) class ef21(Scene): def construct(self): self.camera.background_color = WHITE c0 = ( Capacitor( label="", ) .move_to([0, 2, 0]) .rotate(90 * DEGREES) ) c1 = ( Capacitor( label="", polarized=False, ) .rotate(90 * DEGREES) .move_to([0, 1, 0]) .set_color(BLACK) ) c2 = ( Capacitor( label="", polarized=False, ) .rotate(90 * DEGREES) .move_to([0, 0, 0]) .set_color(BLACK) ) cn = ( Capacitor( label="", polarized=False, ) .rotate(90 * DEGREES) .move_to([0, -1, 0]) .set_color(BLACK) ) gnd = Ground(ground_type="earth").move_to([0, -2, 0]) circuit = Circuit() self.add(circuit) circuit.add_components(c1, c2, cn) circuit.add_wire(c0.get_terminals("left"), c1.get_terminals("right")) circuit.add_wire(c1.get_terminals("left"), c2.get_terminals("right")) circuit.add_wire(c2.get_terminals("left"), cn.get_terminals("right")) circuit.add_wire(cn.get_terminals("left"), gnd.get_terminals()) circuit.set_color(BLACK) class magnet1(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(-1, LEFT) charge2 = Charge(1, RIGHT) field = ElectricField(charge1, charge2) fieldI = Arrow([-1, 0, 0], [1, 0, 0], color=YELLOW) magnetP = Polygon( [-1.5, 0.5, 0], [-1.5, -0.5, 0], [0, -0.5, 0], [0, 0.5, 0], color=BLUE, fill_color=BLUE, fill_opacity=1, ) textP = Text("S").move_to([-1, 0, 0]) magnetN = Polygon( [1.5, 0.5, 0], [1.5, -0.5, 0], [0, -0.5, 0], [0, 0.5, 0], color=RED, fill_color=RED, fill_opacity=1, ) textN = Text("N").move_to([1, 0, 0]) self.add(field, magnetP, magnetN, fieldI, textP, textN) class ssf1(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(1, 1 * LEFT) charge2 = Charge(-1, 1 * RIGHT) wire = Line(1 * LEFT, 1 * RIGHT, color=BLACK) vec = LabeledArrow( "I", label_color=BLACK, frame_fill_color=WHITE, start=0.75 * LEFT + 0.5 * UP, end=0.75 * RIGHT + 0.5 * UP, color=BLACK, ) self.add(charge1, charge2, wire, vec) class ssf2(ThreeDScene): def construct(self): self.camera.background_color = WHITE plate = Polygon( [0, -2.5, 2.5], [0, 2.5, 2.5], [0, 2.5, -2.5], [0, -2.5, -2.5], color=GREY, fill_color=GREY, fill_opacity=0.25, ) vec1 = Arrow3D(start=[-2, 0, 0], end=[2, 0, 0], color=BLUE) vec2 = Arrow3D(start=[-2, -1, 0], end=[2, -1, 0], color=BLUE) vec3 = Arrow3D(start=[-2, 1, 0], end=[2, 1, 0], color=BLUE) vec4 = Arrow3D(start=[-2, 0, -1], end=[2, 0, -1], color=BLUE) vec5 = Arrow3D(start=[-2, 0, 1], end=[2, 0, 1], color=BLUE) label1 = ( MathTex( r"\Delta A", color=BLACK, ) .rotate(160 * DEGREES, [0, 1, 1]) .move_to([-2, 0, 2]) ) label2 = ( MathTex(r"\vec{J}", color=BLUE) .rotate(160 * DEGREES, [0, 1, 1]) .move_to([0, 0, 0.3]) ) self.set_camera_orientation(PI / 3, PI / 4) self.add(vec1, vec2, vec3, vec4, vec5, plate, label1, label2) class ssf3(Scene): def construct(self): self.camera.background_color = WHITE c0 = Charge(1, [1000, 0, 0]) ef = ElectricField(c0) c1 = Charge(1, [2, 3, 0]) c2 = Charge(1, [-2, 2, 0]) c3 = Charge(1, [1, -3, 0]) c4 = Charge(1, [-1, -1, 0]) c5 = Charge(1, [2, -1, 0]) c6 = Charge(-1, [2, 0, 0]) c7 = Charge(-1, [-4, -1, 0]) c8 = Charge(-1, [0, -2, 0]) c9 = Charge(-1, [3, -2, 0]) c10 = Charge(-1, [4, 2, 0]) a1 = Arrow([2, 0, 0], [3, 2, 0], color=BLACK, path_arc=-90 * DEGREES) a2 = Arrow([-4, -1, 0], [-3, 1, 0], color=BLACK, path_arc=-90 * DEGREES) a3 = Arrow([4, 2, 0], [5, 4, 0], color=BLACK, path_arc=-90 * DEGREES) a4 = Arrow([0, -2, 0], [1, 0, 0], color=BLACK, path_arc=-90 * DEGREES) a5 = Arrow([3, -2, 0], [4, 0, 0], color=BLACK, path_arc=-90 * DEGREES) self.add(ef, a1, a2, a3, a4, a5, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) class ssf4(Scene): def construct(self): self.camera.background_color = WHITE plane1 = Polygon( [3, 10, 0], [-10, 10, 0], [-10, -10, 0], [-3, -10, 0], color=BLUE, fill_color=BLUE, fill_opacity=0.25, ) plane2 = Polygon( [3, 10, 0], [10, 10, 0], [10, -10, 0], [-3, -10, 0], color=RED, fill_color=RED, fill_opacity=0.25, ) vec1 = Arrow([-4, -2, 0], [0, 0, 0], color=GREEN) vec2 = Arrow([0, 0, 0], [4, 1, 0], color=GREEN) text1 = MathTex(r"\kappa_1", color=BLACK).move_to([-5, 3, 0]) text2 = MathTex(r"\kappa_2", color=BLACK).move_to([5, 3, 0]) self.add(plane1, plane2, vec1, vec2, text1, text2) class een1(Scene): def construct(self): self.camera.background_color = WHITE r1 = Polygon( [-0.5, 1, 0], [-0.5, 1.5, 0], [0.5, 1.5, 0], [0.5, 1, 0], color=BLACK ) r1c1 = Line([-2, 1.25, 0], [-0.5, 1.25, 0], color=BLACK) r1c2 = Line([0.5, 1.25, 0], [2, 1.25, 0], color=BLACK) i1 = Arrow([0.75, 1.25, 0], [1.75, 1.25, 0], color=RED) vo1 = Arrow([-0.5, 1.75, 0], [0.5, 1.75, 0], color=BLUE) i = MathTex(r"I", color=RED).move_to([1.25, 1.75, 0]) v = MathTex(r"V", color=BLUE).move_to([0, 2.25, 0]) v1 = VoltageSource(direction=UP).rotate(-90 * DEGREES).move_to([0, -1, 0]) i2 = Arrow( [0.75, v1.get_terminals("positive")[1], 0], [1.75, v1.get_terminals("positive")[1], 0], color=RED, ) vo2 = Arrow([0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLUE) circuit = Circuit() self.add(r1, r1c1, r1c2, i1, vo1, i, v, circuit, i2, vo2) circuit.add_components(v1) circuit.add_wire( [-2, v1.get_terminals("negative")[1], 0], v1.get_terminals("negative") ) circuit.add_wire( [2, v1.get_terminals("positive")[1], 0], v1.get_terminals("positive") ) circuit.set_color(BLACK) class een2(Scene): def construct(self): self.camera.background_color = WHITE c1 = ( Capacitor(label=False, direction=LEFT) .move_to([-1, 0, 0]) .rotate(90 * DEGREES) ) r1 = Polygon( [0.75, 0.5, 0], [1.25, 0.5, 0], [1.25, -0.5, 0], [0.75, -0.5, 0], color=BLACK, ) circuit = Circuit() self.add(circuit, r1) circuit.add_components(c1) circuit.add_wire( c1.get_terminals("right"), [c1.get_terminals("right")[0], 1.5, 0], ) circuit.add_wire( [c1.get_terminals("right")[0], 1.5, 0], [1, 1.5, 0], junctions=False ) circuit.add_wire([1, 1.5, 0], [1, 0.5, 0], junctions=False) circuit.add_wire([1, -0.5, 0], [1, -1.5, 0]) circuit.add_wire( [1, -1.5, 0], [c1.get_terminals("left")[0], -1.5, 0], junctions=False ) circuit.add_wire( [c1.get_terminals("left")[0], -1.5, 0], c1.get_terminals("left"), junctions=False, ) circuit.set_color(BLACK) class een3(Scene): def construct(self): self.camera.background_color = WHITE v1 = VoltageSource().move_to([-1.5, 0, 0]) i1 = CurrentSource().move_to([1.5, 0, 0]) vo1 = Arrow([-0.25, 1.5, 0], [-0.25, -1.5, 0], color=BLUE) iv1 = Arrow( i1.get_terminals("positive"), [i1.get_terminals("positive")[0], 1.5, 0], color=RED, ) circuit = Circuit() self.add(circuit, vo1, iv1) circuit.add_components(v1, i1) circuit.add_wire( v1.get_terminals("positive"), [v1.get_terminals("positive")[0], 1.5, 0] ) circuit.add_wire( v1.get_terminals("negative"), [v1.get_terminals("negative")[0], -1.5, 0] ) circuit.add_wire( i1.get_terminals("positive"), [i1.get_terminals("positive")[0], 1.5, 0] ) circuit.add_wire( i1.get_terminals("negative"), [i1.get_terminals("negative")[0], -1.5, 0] ) circuit.set_color(BLACK) class een4(Scene): def construct(self): self.camera.background_color = WHITE p = Dot([-1.5, 1.5, 0], radius=0.08, color=BLACK) r1 = Polygon( [-0.5, 1.25, 0], [-0.5, 1.75, 0], [0.5, 1.75, 0], [0.5, 1.25, 0], color=BLACK, ) r1c1 = Line([-1.5, 1.5, 0], [-0.5, 1.5, 0], color=BLACK) r1c2 = Line([1.5, 1.5, 0], [0.5, 1.5, 0], color=BLACK) r2 = Polygon( [1.25, 0.5, 0], [1.75, 0.5, 0], [1.75, -0.5, 0], [1.25, -0.5, 0], color=BLACK, ) r2c1 = Line([1.5, 1.5, 0], [1.5, 0.5, 0], color=BLACK) r2c2 = Line([1.5, -0.5, 0], [1.5, -1.5, 0], color=BLACK) r3 = Polygon( [-0.5, -1.25, 0], [-0.5, -1.75, 0], [0.5, -1.75, 0], [0.5, -1.25, 0], color=BLACK, ) r3c1 = Line([1.5, -1.5, 0], [0.5, -1.5, 0], color=BLACK) r3c2 = Line([-1.5, -1.5, 0], [-0.5, -1.5, 0], color=BLACK) r4 = Polygon( [-1.25, -0.5, 0], [-1.75, -0.5, 0], [-1.75, 0.5, 0], [-1.25, 0.5, 0], color=BLACK, ) r4c1 = Line([-1.5, -1.5, 0], [-1.5, -0.5, 0], color=BLACK) r4c2 = Line([-1.5, 1.5, 0], [-1.5, 0.5, 0], color=BLACK) pt = MathTex(r"P", color=BLACK).move_to([-1.5, 2, 0]) u1t = MathTex(r"U_1", color=BLUE).move_to([0, 2.5, 0]) u2t = MathTex(r"U_2", color=BLUE).move_to([2.5, 0, 0]) u3t = MathTex(r"U_3", color=BLUE).move_to([0, -2.5, 0]) u4t = MathTex(r"U_4", color=BLUE).move_to([-2.5, 0, 0]) r1t = MathTex(r"R_1", color=BLACK).move_to([0, 1, 0]) r2t = MathTex(r"R_2", color=BLACK).move_to([1, 0, 0]) r3t = MathTex(r"R_3", color=BLACK).move_to([0, -1, 0]) r4t = MathTex(r"R_4", color=BLACK).move_to([-1, 0, 0]) u1a = Arrow([-0.5, 2, 0], [0.5, 2, 0], color=BLUE) u2a = Arrow([2, 0.5, 0], [2, -0.5, 0], color=BLUE) u3a = Arrow([0.5, -2, 0], [-0.5, -2, 0], color=BLUE) u4a = Arrow([-2, -0.5, 0], [-2, 0.5, 0], color=BLUE) self.add( p, r1, r1c1, r1c2, r2, r2c1, r2c2, r3, r3c1, r3c2, r4, r4c1, r4c2, pt, u1t, u2t, u3t, u4t, r1t, r2t, r3t, r4t, u1a, u2a, u3a, u4a, ) class een5(Scene): def construct(self): self.camera.background_color = WHITE p = Dot(ORIGIN, radius=0.08, color=BLACK) c1 = Line([0, 2, 0], ORIGIN, color=BLACK) c2 = Line([2, 0, 0], ORIGIN, color=BLACK) c3 = Line([0, -2, 0], ORIGIN, color=BLACK) c4 = Line([-2, 0, 0], ORIGIN, color=BLACK) ia1 = Arrow([0, 1.5, 0], [0, 0.5, 0], color=RED) ia2 = Arrow([1.5, 0, 0], [0.5, 0, 0], color=RED) ia3 = Arrow([0, -1.5, 0], [0, -0.5, 0], color=RED) ia4 = Arrow([-0.5, 0, 0], [-1.5, 0, 0], color=RED) pt = MathTex(r"P", color=BLACK).move_to([0.5, -0.5, 0]) it1 = MathTex(r"I_1", color=RED).move_to([0.5, 1, 0]) it2 = MathTex(r"I_2", color=RED).move_to([1, 0.5, 0]) it3 = MathTex(r"I_3", color=RED).move_to([0.5, -1, 0]) it4 = MathTex(r"I_4", color=RED).move_to([-1, 0.5, 0]) self.add(p, c1, c2, c3, c4, ia1, ia2, ia3, ia4, pt, it1, it2, it3, it4) class een6(Scene): def construct(self): self.camera.background_color = WHITE r1 = Polygon( [-0.25, 2.5, 0], [0.25, 2.5, 0], [0.25, 1.5, 0], [-0.25, 1.5, 0], color=BLACK, ) r2 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ) r3 = Polygon( [-0.25, -2.5, 0], [0.25, -2.5, 0], [0.25, -1.5, 0], [-0.25, -1.5, 0], color=BLACK, ) c1 = Line([0, 3.5, 0], [0, 2.5, 0], color=BLACK) c2 = Line([0, 1.5, 0], [0, 0.5, 0], color=BLACK) c3 = Line([0, -0.5, 0], [0, -1.5, 0], color=BLACK) c4 = Line([0, -2.5, 0], [0, -3.5, 0], color=BLACK) r1t = MathTex(r"R_1", color=BLACK).move_to([1, 2, 0]) r2t = MathTex(r"R_2", color=BLACK).move_to([1, 0, 0]) r3t = MathTex(r"R_3", color=BLACK).move_to([1, -2, 0]) self.add(r1, r2, r3, c1, c2, c3, c4, r1t, r2t, r3t) class een7(Scene): def construct(self): self.camera.background_color = WHITE r1 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ) r2 = Polygon( [-1.25, 0.5, 0], [-0.75, 0.5, 0], [-0.75, -0.5, 0], [-1.25, -0.5, 0], color=BLACK, ) r3 = Polygon( [1.25, 0.5, 0], [0.75, 0.5, 0], [0.75, -0.5, 0], [1.25, -0.5, 0], color=BLACK, ) c1 = Line([0, 2.5, 0], [0, 0.5, 0], color=BLACK) c2 = Line([-1, 1.5, 0], [1, 1.5, 0], color=BLACK) c3 = Line([-1, 1.5, 0], [-1, 0.5, 0], color=BLACK) c4 = Line([1, 1.5, 0], [1, 0.5, 0], color=BLACK) c5 = Line([0, -2.5, 0], [0, -0.5, 0], color=BLACK) c6 = Line([-1, -1.5, 0], [1, -1.5, 0], color=BLACK) c7 = Line([-1, -1.5, 0], [-1, -0.5, 0], color=BLACK) c8 = Line([1, -1.5, 0], [1, -0.5, 0], color=BLACK) j1 = Dot([0, 1.5, 0], radius=0.08, color=BLACK) j2 = Dot([0, -1.5, 0], radius=0.08, color=BLACK) self.add(r1, r2, r3, c1, c2, c3, c4, c5, c6, c7, c8, j1, j2) class een8(Scene): def construct(self): self.camera.background_color = WHITE v1 = VoltageSource().move_to([-2, 0, 0]).set_color(BLACK) r1 = Polygon( [1.75, 1.5, 0], [2.25, 1.5, 0], [2.25, 0.5, 0], [1.75, 0.5, 0], color=BLACK ) r2 = Polygon( [1.75, -1.5, 0], [2.25, -1.5, 0], [2.25, -0.5, 0], [1.75, -0.5, 0], color=BLACK, ) c1 = Line( v1.get_terminals("positive"), [v1.get_terminals("positive")[0], 2.5, 0], color=BLACK, ) c2 = Line([v1.get_terminals("positive")[0], 2.5, 0], [2, 2.5, 0], color=BLACK) c3 = Line([2, 2.5, 0], [2, 1.5, 0], color=BLACK) c4 = Line([2, 0.5, 0], [2, -0.5, 0], color=BLACK) c5 = Line([2, -2.5, 0], [2, -1.5, 0], color=BLACK) c6 = Line([v1.get_terminals("positive")[0], -2.5, 0], [2, -2.5, 0], color=BLACK) c7 = Line( v1.get_terminals("negative"), [v1.get_terminals("positive")[0], -2.5, 0], color=BLACK, ) r1t = MathTex(r"R_1", color=BLACK).move_to([1, 1, 0]) r2t = MathTex(r"R_2", color=BLACK).move_to([1, -1, 0]) u1t = MathTex(r"U_1", color=BLUE).move_to([3, 1, 0]) u2t = MathTex(r"U_2", color=BLUE).move_to([3, -1, 0]) u1a = Arrow([2.5, 1.5, 0], [2.5, 0.5, 0], color=BLUE) u2a = Arrow([2.5, -0.5, 0], [2.5, -1.5, 0], color=BLUE) self.add(v1, r1, r2, c1, c2, c3, c4, c5, c6, c7, r1t, r2t, u1t, u2t, u1a, u2a) class een9(Scene): def construct(self): self.camera.background_color = WHITE i1 = CurrentSource().move_to([-4, 0, 0]).set_color(BLACK) r1 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ) r2 = Polygon( [3.75, 0.5, 0], [4.25, 0.5, 0], [4.25, -0.5, 0], [3.75, -0.5, 0], color=BLACK, ) c1 = Line( i1.get_terminals("positive"), [i1.get_terminals("positive")[0], 1.5, 0], color=BLACK, ) c2 = Line([i1.get_terminals("positive")[0], 1.5, 0], [4, 1.5, 0], color=BLACK) c3 = Line([0, 1.5, 0], [0, 0.5, 0], color=BLACK) c4 = Line([4, 1.5, 0], [4, 0.5, 0], color=BLACK) c5 = Line([4, -0.5, 0], [4, -1.5, 0], color=BLACK) c6 = Line([4, -1.5, 0], [i1.get_terminals("negative")[0], -1.5, 0], color=BLACK) c7 = Line([0, -1.5, 0], [0, -0.5, 0], color=BLACK) c8 = Line( i1.get_terminals("negative"), [i1.get_terminals("negative")[0], -1.5, 0], color=BLACK, ) j1 = Dot([0, 1.5, 0], radius=0.08, color=BLACK) j2 = Dot([0, -1.5, 0], radius=0.08, color=BLACK) i1a = Arrow([0, -0.5, 0], [0, -1.5, 0], color=RED) i2a = Arrow([4, -0.5, 0], [4, -1.5, 0], color=RED) r1t = MathTex( r"R_1", color=BLACK, ).move_to([1, 0, 0]) r2t = MathTex( r"R_2", color=BLACK, ).move_to([5, 0, 0]) self.add(i1, r1, r2, c1, c2, c3, c4, c5, c6, c7, c8, j1, j2, i1a, i2a, r1t, r2t) class een10(Scene): def construct(self): self.camera.background_color = WHITE v1 = VoltageSource().move_to([-2, -2, 0]).set_color(BLACK) mbody1 = Circle(radius=0.5, color=BLACK) mbody2 = Circle(radius=0.5, color=BLACK) marrow1 = Arrow([-0.5, -0.5, 0], [0.5, 0.5, 0], color=BLACK) marrow2 = Arrow([-0.5, -0.5, 0], [0.5, 0.5, 0], color=BLACK) m1 = VGroup(mbody1, marrow1).move_to([[-1.75, -2, 0]]) m2 = VGroup(mbody2, marrow2).move_to([2.25, 0, 0]) r1 = Polygon( [-2, 0.5, 0], [-2, 1.5, 0], [-1.5, 1.5, 0], [-1.5, 0.5, 0], color=BLACK ) i1 = CurrentSource().move_to([2, 0, 0]).set_color(BLACK) r2 = Polygon( [3.75, 0.5, 0], [3.75, -0.5, 0], [4.25, -0.5, 0], [4.25, 0.5, 0], color=BLACK, ) c1 = Line( [v1.get_terminals("negative")[0], -3, 0], v1.get_terminals("negative"), color=BLACK, ) c2 = Line( v1.get_terminals("positive"), [v1.get_terminals("positive")[0], 0.5, 0], color=BLACK, ) c3 = Line( [v1.get_terminals("positive")[0], 1.5, 0], [v1.get_terminals("positive")[0], 3, 0], color=BLACK, ) c4 = Line( i1.get_terminals("positive"), [i1.get_terminals("positive")[0], 2, 0], color=BLACK, ) c5 = Line([i1.get_terminals("positive")[0], 2, 0], [5, 2, 0], color=BLACK) c6 = Line([4, 2, 0], [4, 0.5, 0], color=BLACK) c7 = Line([4, -0.5, 0], [4, -2, 0], color=BLACK) c8 = Line([5, -2, 0], [i1.get_terminals("negative")[0], -2, 0], color=BLACK) c9 = Line( [i1.get_terminals("negative")[0], -2, 0], i1.get_terminals("negative"), color=BLACK, ) r1t = MathTex(r"R_i", color=BLACK).move_to([-1.25, 1, 0]) r2t = MathTex(r"R_i", color=BLACK).move_to([4.5, 0, 0]) self.add(m1, r1, m2, r2, c1, c2, c3, c4, c5, c6, c7, c8, c9, r1t, r2t) class een11(Scene): def construct(self): self.camera.background_color = WHITE i1 = CurrentSource().move_to([-1, 0, 0]).set_color(BLACK) ri = Polygon( [0.75, 0.5, 0], [1.25, 0.5, 0], [1.25, -0.5, 0], [0.75, -0.5, 0], color=BLACK, ) c1 = Line( [i1.get_terminals("negative")[0], -2, 0], i1.get_terminals("negative"), color=BLACK, ) c2 = Line( i1.get_terminals("positive"), [i1.get_terminals("positive")[0], 2, 0], color=BLACK, ) c3 = Line([i1.get_terminals("positive")[0], 2, 0], [2, 2, 0], color=BLACK) c4 = Line([1, 2, 0], [1, 0.5, 0], color=BLACK) c5 = Line([1, -2, 0], [1, -0.5, 0], color=BLACK) c6 = Line([i1.get_terminals("positive")[0], -2, 0], [2, -2, 0], color=BLACK) j1 = Dot(radius=0.08, color=BLACK).move_to([2, 2, 0]) j2 = Dot(radius=0.08, color=BLACK).move_to([2, -2, 0]) rit = MathTex(r"R_i", color=BLACK).move_to([1.5, 0, 0]) self.add(i1, ri, c1, c2, c3, c4, c5, c6, j1, j2, rit) class een12(Scene): def construct(self): self.camera.background_color = WHITE v1 = VoltageSource().move_to([-0.25, -1, 0]).set_color(BLACK) ri = Polygon( [-0.25, 0.5, 0], [-0.25, 1.5, 0], [0.25, 1.5, 0], [0.25, 0.5, 0], color=BLACK, ) c1 = Line([0, -3, 0], v1.get_terminals("negative"), color=BLACK) c2 = Line(v1.get_terminals("positive"), [0, 0.5, 0], color=BLACK) c3 = Line([0, 1.5, 0], [0, 3, 0], color=BLACK) j1 = Dot(radius=0.08, color=BLACK).move_to([0, 3, 0]) j2 = Dot(radius=0.08, color=BLACK).move_to([0, -3, 0]) rit = MathTex(r"R_i", color=BLACK).move_to([0.5, 1, 0]) self.add(v1, ri, c1, c2, c3, j1, j2, rit) class een13(Scene): def construct(self): self.camera.background_color = WHITE v1 = VoltageSource().set_color(BLACK).move_to([-2, -1, 0]) v2 = VoltageSource().set_color(BLACK).move_to([-2, 1, 0]) v3 = VoltageSource().set_color(BLACK).move_to([1, 0, 0]) v4 = VoltageSource().set_color(BLACK).move_to([3, 0, 0]) c1 = Line( [v1.get_terminals("negative")[0], -3, 0], v1.get_terminals("negative"), color=BLACK, ) c2 = Line( v2.get_terminals("negative"), v1.get_terminals("positive"), color=BLACK ) c3 = Line( v2.get_terminals("positive"), [v2.get_terminals("positive")[0], 3, 0], color=BLACK, ) c4 = Line( [v3.get_terminals("negative")[0], -2, 0], v3.get_terminals("negative"), color=BLACK, ) c5 = Line( [v3.get_terminals("positive")[0], 2, 0], v3.get_terminals("positive"), color=BLACK, ) c6 = Line( [v3.get_terminals("positive")[0], 2, 0], [4, 2, 0], color=BLACK, ) c7 = Line( [v4.get_terminals("positive")[0], 2, 0], v4.get_terminals("positive"), color=BLACK, ) c8 = Line( [v4.get_terminals("positive")[0], -2, 0], v4.get_terminals("negative"), color=BLACK, ) c9 = Line( [4, -2, 0], [v3.get_terminals("positive")[0], -2, 0], color=BLACK, ) j1 = Dot(radius=0.08, color=BLACK).move_to( [v1.get_terminals("positive")[0], 3, 0] ) j2 = Dot(radius=0.08, color=BLACK).move_to( [v1.get_terminals("positive")[0], -3, 0] ) j3 = Dot(radius=0.08, color=BLACK).move_to([4, 2, 0]) j4 = Dot(radius=0.08, color=BLACK).move_to([4, -2, 0]) self.add(v1, v2, v3, v4, c1, c2, c3, c4, c5, c6, c7, c8, c9, j1, j2, j3, j4) class een14(Scene): def construct(self): self.camera.background_color = WHITE v1 = VoltageSource().set_color(BLACK).move_to([-2, 0, 0]) ri = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([0, 2, 0]) rl = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([2, 0, 0]) c1 = Line( v1.get_terminals("positive"), [v1.get_terminals("positive")[0], 2, 0], color=BLACK, ) c2 = Line([v1.get_terminals("positive")[0], 2, 0], [-0.5, 2, 0], color=BLACK) c3 = Line([2, 2, 0], [2, 0.5, 0], color=BLACK) c4 = Line([2, -2, 0], [2, -0.5, 0], color=BLACK) c5 = Line([v1.get_terminals("positive")[0], -2, 0], [2, -2, 0], color=BLACK) c6 = Line( v1.get_terminals("negative"), [v1.get_terminals("positive")[0], -2, 0], color=BLACK, ) c7 = Line([0.5, 2, 0], [2, 2, 0], color=BLACK) rit = MathTex(r"R_i", color=BLACK).move_to([0, 1.3, 0]) rlt = MathTex(r"R_L", color=BLACK).move_to([1.3, 0, 0]) self.add(v1, ri, rl, c1, c2, c3, c4, c5, c6, c7, rit, rlt) class een15(Scene): def construct(self): self.camera.background_color = WHITE ax = Axes( y_range=[0, 10, 10], x_range=[0, 5, 2.5], tips=False, ).set_color(BLACK) labels = ax.get_axis_labels(Tex("R"), Tex("P")).set_color(BLACK) f1 = ax.plot(lambda x: -1.6 * ((x - 2.5) ** 2) + 10, x_range=[0, 5]).set_color( BLACK ) rit = MathTex(r"R_i", color=BLACK).move_to(ax.c2p(2.5, -0.5)) self.add(ax, labels, f1, rit) class een16(Scene): def construct(self): self.camera.background_color = WHITE ax = Axes( y_range=[0, 10, 10], x_range=[0, 5, 2.5], tips=False, ).set_color(BLACK) labels = ax.get_axis_labels(Tex("R"), Tex("")).set_color(BLACK) f1 = ax.plot(lambda x: -1.6 * ((x - 2.5) ** 2) + 10, x_range=[0, 5]).set_color( BLACK ) f2 = Line(ax.c2p(0, 0), ax.c2p(5, 10), color=BLACK) rit = MathTex(r"R_i", color=BLACK).move_to(ax.c2p(2.5, -0.5)) self.add(ax, labels, f1, rit, f2) class een17(Scene): def construct(self): self.camera.background_color = WHITE v1 = VoltageSource().move_to([2, 0, 0]).set_color(BLACK) vmb = Circle(radius=0.5, color=BLACK) vma = Arrow([-0.5, -0.5, 0], [0.5, 0.5, 0], color=BLACK) vm = VGroup(vmb, vma).move_to([-1.5, 0, 0]) r = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([-3, 2, 0]) r1 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([0, 2, 0]) r2 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([-3, -2, 0]) rvr = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ) rva = Arrow([-0.75, -0.75, 0], [0.75, 0.75, 0], color=BLACK) rv = VGroup(rvr, rva).move_to([0, -2, 0]) c1 = Line( v1.get_terminals("positive"), [v1.get_terminals("positive")[0], 3.5, 0], color=BLACK, ) c2 = Line([v1.get_terminals("positive")[0], 3.5, 0], [0, 3.5, 0], color=BLACK) c3 = Line([0, 3.5, 0], [0, 2.5, 0], color=BLACK) c4 = Line([0, 1.5, 0], [0, -1.5, 0], color=BLACK) c5 = Line([0, -2.5, 0], [0, -3.5, 0], color=BLACK) c6 = Line([0, -3.5, 0], [-3, -3.5, 0], color=BLACK) c7 = Line([-3, -3.5, 0], [-3, -2.5, 0], color=BLACK) c8 = Line([-3, -1.5, 0], [-3, 1.5, 0], color=BLACK) c9 = Line([-3, 2.5, 0], [-3, 3.5, 0], color=BLACK) c10 = Line([-3, 3.5, 0], [0, 3.5, 0], color=BLACK) c11 = Line( v1.get_terminals("negative"), [v1.get_terminals("positive")[0], -3.5, 0], color=BLACK, ) c12 = Line( [v1.get_terminals("positive")[0], -3.5, 0], [0, -3.5, 0], color=BLACK ) c13 = Line([0, 0, 0], [-1, 0, 0], color=BLACK) c14 = Line([-2, 0, 0], [-3, 0, 0], color=BLACK) rt = MathTex(r"R", color=BLACK).move_to([-2.5, 2, 0]) r1t = MathTex(r"R_1", color=BLACK).move_to([0.5, 2, 0]) r2t = MathTex(r"R_2", color=BLACK).move_to([-2.5, -2, 0]) rvt = MathTex(r"R_v", color=BLACK).move_to([0.5, -2, 0]) self.add( v1, vm, r, r1, r2, rv, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, rt, r1t, r2t, rvt, ) class een18(Scene): def construct(self): self.camera.background_color = WHITE ic = Polygon( [-2, 2, 0], [2, 2, 0], [2, -2, 0], [-2, -2, 0], color=BLACK ).move_to([-4, 0, 0]) c1 = Line(ORIGIN, [1, 0, 0], color=BLACK).move_to([-1.5, 1.5, 0]) c2 = Line(ORIGIN, [1, 0, 0], color=BLACK).move_to([-1.5, -1.5, 0]) j1 = Dot(radius=0.08, color=BLACK).move_to([-1, 1.5, 0]) j2 = Dot(radius=0.08, color=BLACK).move_to([-1, -1.5, 0]) a = MathTex(r"\Rightarrow", color=BLACK) v1 = VoltageSource().move_to([1.5, -1, 0]).set_color(BLACK) ri = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([1.75, 1, 0]) c3 = Line( v1.get_terminals("negative"), [v1.get_terminals("negative")[0], -2.5, 0], color=BLACK, ) c4 = Line( v1.get_terminals("positive"), [v1.get_terminals("negative")[0], 0.5, 0], color=BLACK, ) c5 = Line( [v1.get_terminals("negative")[0], 1.5, 0], [v1.get_terminals("negative")[0], 2.5, 0], color=BLACK, ) self.add(ic, c1, c2, j1, j2, a, v1, ri, c3, c4, c5) class een19(Scene): def construct(self): self.camera.background_color = WHITE ic = Polygon( [-2, 2, 0], [2, 2, 0], [2, -2, 0], [-2, -2, 0], color=BLACK ).move_to([-4, 0, 0]) c1 = Line(ORIGIN, [1, 0, 0], color=BLACK).move_to([-1.5, 1.5, 0]) c2 = Line(ORIGIN, [1, 0, 0], color=BLACK).move_to([-1.5, -1.5, 0]) j1 = Dot(radius=0.08, color=BLACK).move_to([-1, 1.5, 0]) j2 = Dot(radius=0.08, color=BLACK).move_to([-1, -1.5, 0]) a = MathTex(r"\Rightarrow", color=BLACK) i1 = CurrentSource().move_to([1.75, 0, 0]).set_color(BLACK) ri = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([4, 0, 0]) c3 = Line( i1.get_terminals("negative"), [i1.get_terminals("negative")[0], -1.5, 0], color=BLACK, ) c4 = Line( [i1.get_terminals("negative")[0], -1.5, 0], [5, -1.5, 0], color=BLACK, ) c5 = Line( [4, -1.5, 0], [4, -0.5, 0], color=BLACK, ) c6 = Line( [4, 1.5, 0], [4, 0.5, 0], color=BLACK, ) c7 = Line( i1.get_terminals("positive"), [i1.get_terminals("negative")[0], 1.5, 0], color=BLACK, ) c8 = Line( [i1.get_terminals("negative")[0], 1.5, 0], [5, 1.5, 0], color=BLACK, ) j3 = Dot(radius=0.08, color=BLACK).move_to([5, 1.5, 0]) j4 = Dot(radius=0.08, color=BLACK).move_to([5, -1.5, 0]) self.add(ic, c1, c2, j1, j2, a, i1, ri, c3, c4, c5, c6, c7, c8, j3, j4) class een20(Scene): def construct(self): self.camera.background_color = WHITE j1 = Dot(radius=0.08, color=BLACK).move_to([-3, -1.5, 0]) j2 = Dot(radius=0.08, color=BLACK).move_to([3, -1.5, 0]) j3 = Dot(radius=0.08, color=BLACK).move_to([0, 1.5, 0]) r1 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([-1.5, -1.5, 0]) r2 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([1.5, -1.5, 0]) r3 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ) c1 = Line([-3, -1.5, 0], [-2, -1.5, 0], color=BLACK) c2 = Line([-1, -1.5, 0], [1, -1.5, 0], color=BLACK) c3 = Line([3, -1.5, 0], [2, -1.5, 0], color=BLACK) c4 = Line([0, -1.5, 0], [0, -0.5, 0], color=BLACK) c5 = Line([0, 0.5, 0], [0, 1.5, 0], color=BLACK) r1t = MathTex(r"R_1", color=BLACK).move_to([0.5, 0, 0]) r2t = MathTex(r"R_2", color=BLACK).move_to([-1.5, -1, 0]) r3t = MathTex(r"R_3", color=BLACK).move_to([1.5, -1, 0]) self.add(j1, j2, j3, r1, r2, r3, c1, c2, c3, c4, c5, r1t, r2t, r3t) class een21(Scene): def construct(self): self.camera.background_color = WHITE j1 = Dot(radius=0.08, color=BLACK).move_to([-3, -1.5, 0]) j2 = Dot(radius=0.08, color=BLACK).move_to([3, -1.5, 0]) j3 = Dot(radius=0.08, color=BLACK).move_to([0, 1.5, 0]) r1 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([0, -1.5, 0]) r2 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([-3, 0, 0]) r3 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([3, 0, 0]) c1 = Line([-3, -1.5, 0], [-0.5, -1.5, 0], color=BLACK) c2 = Line([3, -1.5, 0], [0.5, -1.5, 0], color=BLACK) c3 = Line([-3, -1.5, 0], [-3, -0.5, 0], color=BLACK) c4 = Line([3, -1.5, 0], [3, -0.5, 0], color=BLACK) c5 = Line([-3, 1.5, 0], [-3, 0.5, 0], color=BLACK) c6 = Line([3, 1.5, 0], [3, 0.5, 0], color=BLACK) c7 = Line([3, 1.5, 0], [-3, 1.5, 0], color=BLACK) r1t = MathTex(r"R_{23}", color=BLACK).move_to([0, -1, 0]) r2t = MathTex(r"R_{12}", color=BLACK).move_to([-2.25, 0, 0]) r3t = MathTex(r"R_{13}", color=BLACK).move_to([2.25, 0, 0]) self.add(j1, j2, j3, r1, r2, r3, c1, c2, c3, c4, c5, c6, c7, r1t, r2t, r3t) class een22(Scene): def construct(self): self.camera.background_color = WHITE i1 = CurrentSource().set_color(BLACK).move_to([-6.25, 0, 0]) v1 = VoltageSource().set_color(BLACK).move_to([6.25, 0, 0]) r1 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ) r2 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([-3, 0, 0]) r3 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([3, 2, 0]) c1 = Line( i1.get_terminals("positive"), [i1.get_terminals("positive")[0], 2, 0], color=BLACK, ) c2 = Line([i1.get_terminals("positive")[0], 2, 0], [2.5, 2, 0], color=BLACK) c3 = Line([3.5, 2, 0], [v1.get_terminals("positive")[0], 2, 0], color=BLACK) c4 = Line( [v1.get_terminals("positive")[0], 2, 0], v1.get_terminals("positive"), color=BLACK, ) c5 = Line( v1.get_terminals("negative"), [v1.get_terminals("negative")[0], -2, 0], color=BLACK, ) c6 = Line( [v1.get_terminals("negative")[0], -2, 0], [i1.get_terminals("negative")[0], -2, 0], color=BLACK, ) c7 = Line( [i1.get_terminals("negative")[0], -2, 0], i1.get_terminals("negative"), color=BLACK, ) c8 = Line([0, 2, 0], [0, 0.5, 0], color=BLACK) c9 = Line([0, -0.5, 0], [0, -2, 0], color=BLACK) c10 = Line([-3, 2, 0], [-3, 0.5, 0], color=BLACK) c11 = Line([-3, -0.5, 0], [-3, -2, 0], color=BLACK) self.add(v1, i1, r1, r2, r3, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11) class een23(Scene): def construct(self): self.camera.background_color = WHITE i1 = CurrentSource().set_color(BLACK).move_to([-6.25, 0, 0]) r1 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ) r2 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([-3, 0, 0]) r3 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([3, 2, 0]) c1 = Line( i1.get_terminals("positive"), [i1.get_terminals("positive")[0], 2, 0], color=BLACK, ) c2 = Line([i1.get_terminals("positive")[0], 2, 0], [2.5, 2, 0], color=BLACK) c3 = Line([3.5, 2, 0], [6, 2, 0], color=BLACK) c4 = Line([6, 2, 0], [6, -2, 0], color=BLACK) c5 = Line([6, -2, 0], [i1.get_terminals("negative")[0], -2, 0], color=BLACK) c6 = Line( i1.get_terminals("negative"), [i1.get_terminals("negative")[0], -2, 0], color=BLACK, ) c7 = Line([0, 2, 0], [0, 0.5, 0], color=BLACK) c8 = Line([0, -0.5, 0], [0, -2, 0], color=BLACK) c9 = Line([-3, 2, 0], [-3, 0.5, 0], color=BLACK) c10 = Line([-3, -0.5, 0], [-3, -2, 0], color=BLACK) self.add(i1, r1, r2, r3, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) class een24(Scene): def construct(self): self.camera.background_color = WHITE v1 = VoltageSource().set_color(BLACK).move_to([6.25, 0, 0]) r1 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ) r2 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([-3, 0, 0]) r3 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([3, 2, 0]) c1 = Line( v1.get_terminals("positive"), [v1.get_terminals("positive")[0], 2, 0], color=BLACK, ) c2 = Line([v1.get_terminals("positive")[0], 2, 0], [3.5, 2, 0], color=BLACK) c3 = Line([2.5, 2, 0], [-3, 2, 0], color=BLACK) c5 = Line([-3, -2, 0], [v1.get_terminals("negative")[0], -2, 0], color=BLACK) c6 = Line( v1.get_terminals("negative"), [v1.get_terminals("negative")[0], -2, 0], color=BLACK, ) c7 = Line([0, 2, 0], [0, 0.5, 0], color=BLACK) c8 = Line([0, -0.5, 0], [0, -2, 0], color=BLACK) c9 = Line([-3, 2, 0], [-3, 0.5, 0], color=BLACK) c10 = Line([-3, -0.5, 0], [-3, -2, 0], color=BLACK) self.add(v1, r1, r2, r3, c1, c2, c3, c5, c6, c7, c8, c9, c10) class een25(Scene): def construct(self): self.camera.background_color = WHITE v1 = VoltageSource().set_color(BLACK).move_to([-3.25, 0, 0]) r1 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([0, 2, 0]) r2 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([0, -2, 0]) r3 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([0, 1, 0]) r4 = Polygon( [-0.5, 0.25, 0], [0.5, 0.25, 0], [0.5, -0.25, 0], [-0.5, -0.25, 0], color=BLACK, ).move_to([0, -1, 0]) r5 = Polygon( [-0.25, 0.5, 0], [0.25, 0.5, 0], [0.25, -0.5, 0], [-0.25, -0.5, 0], color=BLACK, ).move_to([3, 0, 0]) c1 = Line( v1.get_terminals("positive"), [v1.get_terminals("positive")[0], 2, 0], color=BLACK, ) c2 = Line([v1.get_terminals("positive")[0], 2, 0], [-0.5, 2, 0], color=BLACK) c3 = Line([0.5, 2, 0], [3, 2, 0], color=BLACK) c4 = Line([3, 2, 0], [3, 0.5, 0], color=BLACK) c5 = Line( v1.get_terminals("negative"), [v1.get_terminals("positive")[0], -2, 0], color=BLACK, ) c6 = Line([v1.get_terminals("positive")[0], -2, 0], [-0.5, -2, 0], color=BLACK) c7 = Line([0.5, -2, 0], [3, -2, 0], color=BLACK) c8 = Line([3, -2, 0], [3, -0.5, 0], color=BLACK) c9 = Line([-2, 2, 0], [-2, 1, 0], color=BLACK) c10 = Line([-2, 1, 0], [-0.5, 1, 0], color=BLACK) c11 = Line([1, 1, 0], [0.5, 1, 0], color=BLACK) c12 = Line([1, 1, 0], [1, -2, 0], color=BLACK) c13 = Line([2, 2, 0], [2, -1, 0], color=BLACK) c14 = Line([2, -1, 0], [0.5, -1, 0], color=BLACK) c15 = Line([-2, -1, 0], [-0.5, -1, 0], color=BLACK) c16 = Line([-2, -1, 0], [-2, -2, 0], color=BLACK) j1 = Dot( radius=0.08, color=BLACK, ).move_to([-2, 2, 0]) j2 = Dot( radius=0.08, color=BLACK, ).move_to([2, 2, 0]) j3 = Dot( radius=0.08, color=BLACK, ).move_to([1, -2, 0]) j4 = Dot( radius=0.08, color=BLACK, ).move_to([-2, -2, 0]) self.add( v1, r1, r2, r3, r4, r5, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, j1, j2, j3, j4, ) class een26(Scene): def construct(self): self.camera.background_color = WHITE c1 = Line( [-3, -2, 0], [-3, 2, 0], color=BLACK, ) c2 = Line([-3, 2, 0], [3, 2, 0], color=BLACK) c4 = Line([3, 2, 0], [3, -2, 0], color=BLACK) c6 = Line([3, -2, 0], [-3, -2, 0], color=BLACK) c7 = Line([-3, -2, 0], [-3, 2, 0], color=BLACK) c9 = Line([-2, 2, 0], [-2, 1, 0], color=BLACK) c10 = Line([-2, 1, 0], [1, 1, 0], color=BLACK) c12 = Line([1, 1, 0], [1, -2, 0], color=BLACK) c13 = Line([2, 2, 0], [2, -1, 0], color=BLACK) c14 = Line([2, -1, 0], [-2, -1, 0], color=BLACK) c16 = Line([-2, -1, 0], [-2, -2, 0], color=BLACK) j1 = Dot( radius=0.08, color=BLACK, ).move_to([-2, 2, 0]) j2 = Dot( radius=0.08, color=BLACK, ).move_to([2, 2, 0]) j3 = Dot( radius=0.08, color=BLACK, ).move_to([1, -2, 0]) j4 = Dot( radius=0.08, color=BLACK, ).move_to([-2, -2, 0]) self.add( c1, c2, c4, c6, c7, c9, c10, c12, c13, c14, c16, j1, j2, j3, j4, ) class een27(Scene): def construct(self): self.camera.background_color = WHITE c1 = Line( [-3, -2, 0], [-3, 2, 0], color=BLACK, ) c2 = Line([-3, 2, 0], [3, 2, 0], color=BLACK) c4 = Line([3, 2, 0], [3, -2, 0], color=BLACK) c6 = Line([3, -2, 0], [-3, -2, 0], color=BLACK) c7 = Line([-3, -2, 0], [-3, 2, 0], color=BLACK) c9 = Line([-2, 2, 0], [-2, 1, 0], color=BLACK) c10 = Line([-2, 1, 0], [1, 1, 0], color=BLACK) c12 = Line([1, 1, 0], [1, -2, 0], color=BLACK) c13 = Line([2, 2, 0], [2, -1, 0], color=BLACK) c14 = Line([2, -1, 0], [-2, -1, 0], color=BLACK) c16 = Line([-2, -1, 0], [-2, -2, 0], color=BLACK) j1 = Dot( radius=0.08, color=BLACK, ).move_to([-2, 2, 0]) j2 = Dot( radius=0.08, color=BLACK, ).move_to([2, 2, 0]) j3 = Dot( radius=0.08, color=BLACK, ).move_to([1, -2, 0]) j4 = Dot( radius=0.08, color=BLACK, ).move_to([-2, -2, 0]) ia1 = Arrow([-0.5, 0, 0], [0.5, 0, 0], color=RED).move_to([0, 2, 0]) ia2 = Arrow([-0.5, 0, 0], [0.5, 0, 0], color=RED).move_to([0, 1, 0]) ia3 = Arrow([0.5, 0, 0], [-0.5, 0, 0], color=RED).move_to([0, -1, 0]) ia4 = Arrow([0.5, 0, 0], [-0.5, 0, 0], color=RED).move_to([0, -2, 0]) ia5 = Arrow([0, 0.5, 0], [0, -0.5, 0], color=RED).move_to([3, 0, 0]) ia6 = Arrow([0, -0.5, 0], [0, 0.5, 0], color=RED).move_to([-3, 0, 0]) self.add( c1, c2, c4, c6, c7, c9, c10, c12, c13, c14, c16, j1, j2, j3, j4, ia1, ia2, ia3, ia4, ia5, ia6, ) class een28(Scene): def construct(self): self.camera.background_color = WHITE c1 = Line( [-3, -2, 0], [-3, 2, 0], color=BLACK, ) c2 = Line([-3, 2, 0], [3, 2, 0], color=BLACK) c3 = Line([3, -2, 0], [1, -2, 0], color=BLACK) c4 = Line([3, 2, 0], [3, -2, 0], color=BLACK) c5 = DashedLine([1, -2, 0], [-2, -2, 0], color=RED) c6 = Line([-2, -2, 0], [-3, -2, 0], color=BLACK) c7 = Line([-3, -2, 0], [-3, 2, 0], color=BLACK) c9 = DashedLine([-2, 2, 0], [-2, 1, 0], color=BLUE) c10 = DashedLine([-2, 1, 0], [1, 1, 0], color=BLUE) c12 = DashedLine([1, 1, 0], [1, -2, 0], color=BLUE) c13 = DashedLine([2, 2, 0], [2, -1, 0], color=GREEN) c14 = DashedLine([2, -1, 0], [-2, -1, 0], color=GREEN) c16 = DashedLine([-2, -1, 0], [-2, -2, 0], color=GREEN) j1 = Dot( radius=0.08, color=BLACK, ).move_to([-2, 2, 0]) j2 = Dot( radius=0.08, color=BLACK, ).move_to([2, 2, 0]) j3 = Dot( radius=0.08, color=BLACK, ).move_to([1, -2, 0]) j4 = Dot( radius=0.08, color=BLACK, ).move_to([-2, -2, 0]) self.add( c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c13, c14, c16, j1, j2, j3, j4, ) class een29(Scene): def construct(self): self.camera.background_color = WHITE c1 = Line([-3, -2, 0], [-3, 2, 0], color=BLACK) c2 = Line([-3, 2, 0], [-2, 2, 0], color=BLACK) c3 = Line([-2, 2, 0], [3, 2, 0], color=BLUE) c4 = Line([3, 2, 0], [3, -2, 0], color=BLUE) c6 = Line([3, -2, 0], [1, -2, 0], color=BLUE) c7 = Line([1, -2, 0], [-3, -2, 0], color=BLACK) c8 = Line([-3, -2, 0], [-3, 2, 0], color=BLACK) c9 = Line([-2, 2, 0], [-2, 1, 0], color=BLUE) c10 = Line([-2, 1, 0], [1, 1, 0], color=BLUE) c12 = Line([1, 1, 0], [1, -2, 0], color=BLUE) c13 = Line([2, 2, 0], [2, -1, 0], color=BLACK) c14 = Line([2, -1, 0], [-2, -1, 0], color=BLACK) c16 = Line([-2, -1, 0], [-2, -2, 0], color=BLACK) j1 = Dot( radius=0.08, color=BLACK, ).move_to([-2, 2, 0]) j2 = Dot( radius=0.08, color=BLACK, ).move_to([2, 2, 0]) j3 = Dot( radius=0.08, color=BLACK, ).move_to([1, -2, 0]) j4 = Dot( radius=0.08, color=BLACK, ).move_to([-2, -2, 0]) self.add( c1, c2, c3, c4, c6, c7, c8, c9, c10, c12, c13, c14, c16, j1, j2, j3, j4 ) class een30(Scene): def construct(self): self.camera.background_color = WHITE c1 = Line( [-3, -2, 0], [-3, 2, 0], color=BLACK, ) c2 = Line([-3, 2, 0], [3, 2, 0], color=RED) c4 = Line([3, 2, 0], [3, -2, 0], color=RED) c6 = Line([3, -2, 0], [-3, -2, 0], color=RED) c7 = Line([-3, -2, 0], [-3, 2, 0], color=RED) c13 = Line([2, 2, 0], [2, -1, 0], color=BLACK) c14 = Line([2, -1, 0], [-2, -1, 0], color=BLACK) c16 = Line([-2, -1, 0], [-2, -2, 0], color=BLACK) j2 = Dot( radius=0.08, color=BLACK, ).move_to([2, 2, 0]) j4 = Dot( radius=0.08, color=BLACK, ).move_to([-2, -2, 0]) self.add( c1, c2, c4, c6, c7, c13, c14, c16, j2, j4, ) class een31(Scene): def construct(self): self.camera.background_color = WHITE c1 = Line( [-3, -2, 0], [-3, 2, 0], color=BLACK, ) c1 = Line([2, 2, 0], [3, 2, 0], color=BLACK) c2 = Line([-3, 2, 0], [2, 2, 0], color=GREEN) c3 = Line([-2, -2, 0], [-3, -2, 0], color=GREEN) c4 = Line([3, 2, 0], [3, -2, 0], color=BLACK) c6 = Line([3, -2, 0], [2, -2, 0], color=BLACK) c7 = Line([-3, -2, 0], [-3, 2, 0], color=GREEN) c13 = Line([2, 2, 0], [2, -1, 0], color=GREEN) c14 = Line([2, -1, 0], [-2, -1, 0], color=GREEN) c16 = Line([-2, -1, 0], [-2, -2, 0], color=GREEN) j2 = Dot( radius=0.08, color=BLACK, ).move_to([2, 2, 0]) j4 = Dot( radius=0.08, color=BLACK, ).move_to([-2, -2, 0]) self.add( c1, c2, c3, c4, c6, c7, c13, c14, c16, j2, j4, ) class slm1(Scene): def construct(self): self.camera.background_color = WHITE wl = Line([0, 2.5, 0], [0, -2.5, 0], color=BLACK).move_to([-5, 0, 0]) wr = Line([0, 2.5, 0], [0, -2.5, 0], color=BLACK).move_to([5, 0, 0]) wb = Line([-5, 0, 0], [5, 0, 0], color=BLACK).move_to([0, -2.5, 0]) e1 = Polygon( [-0.5, 1.5, 0], [0.5, 1.5, 0], [0.5, -1.5, 0], [-0.5, -1.5, 0], color=BLACK ).move_to([-4, 1, 0]) e2 = Polygon( [-0.5, 1.5, 0], [0.5, 1.5, 0], [0.5, -1.5, 0], [-0.5, -1.5, 0], color=BLACK ).move_to([4, 1, 0]) w = Polygon( [-5, 1.5, 0], [5, 1.5, 0], [5, -2.5, 0], [-5, -2.5, 0], stroke_width=0, fill_color=BLUE, fill_opacity=0.75, ) pt = MathTex(r"+\\+\\+", color=BLACK).move_to([4, 1, 0]) nt = MathTex(r"-\\-\\-", color=BLACK).move_to([-4, 1, 0]) vmb = Circle(radius=0.5, color=BLACK) vma = Arrow([-0.5, -0.5, 0], [0.5, 0.5, 0], color=BLACK) vm = VGroup(vmb, vma).move_to([0, 3, 0]) c1 = Line([4, 2.5, 0], [4, 3, 0], color=BLACK) c2 = Line([4, 3, 0], [0.5, 3, 0], color=BLACK) c3 = Line([-4, 3, 0], [-0.5, 3, 0], color=BLACK) c4 = Line([-4, 2.5, 0], [-4, 3, 0], color=BLACK) self.add(wr, wl, wb, e1, e2, w, pt, nt, vm, c1, c2, c3, c4) class slm2(Scene): def construct(self): self.camera.background_color = WHITE wl = Line([0, 2.5, 0], [0, -2.5, 0], color=BLACK).move_to([-5, 0, 0]) wr = Line([0, 2.5, 0], [0, -2.5, 0], color=BLACK).move_to([5, 0, 0]) wb = Line([-5, 0, 0], [5, 0, 0], color=BLACK).move_to([0, -2.5, 0]) e1 = Polygon( [-0.5, 1.5, 0], [0.5, 1.5, 0], [0.5, -1.5, 0], [-0.5, -1.5, 0], color=BLACK ).move_to([-4, 1, 0]) e2 = Polygon( [-0.5, 1.5, 0], [0.5, 1.5, 0], [0.5, -1.5, 0], [-0.5, -1.5, 0], color=BLACK ).move_to([4, 1, 0]) w = Polygon( [-5, 1.5, 0], [5, 1.5, 0], [5, -2.5, 0], [-5, -2.5, 0], stroke_width=0, fill_color=BLUE, fill_opacity=0.75, ) pt = MathTex(r"+\\+\\+", color=BLACK).move_to([4, 1, 0]) nt = MathTex(r"-\\-\\-", color=BLACK).move_to([-4, 1, 0]) vmb = Circle(radius=0.5, color=BLACK) vma = Arrow([-0.5, -0.5, 0], [0.5, 0.5, 0], color=BLACK) vm = VGroup(vmb, vma).move_to([0, 3, 0]) c1 = Line([4, 2.5, 0], [4, 3, 0], color=BLACK) c2 = Line([4, 3, 0], [0.5, 3, 0], color=BLACK) c3 = Line([-4, 3, 0], [-0.5, 3, 0], color=BLACK) c4 = Line([-4, 2.5, 0], [-4, 3, 0], color=BLACK) nam = Circle(radius=0.5, color=BLACK) nat = MathTex(r"Na^+", color=BLACK) nav = Arrow([-0.25, 0, 0], [-1.75, 0, 0], color=BLACK) na = VGroup(nam, nat, nav).move_to([-2, 0, 0]) fem = Circle(radius=0.5, color=BLACK) fet = MathTex(r"Fe^-", color=BLACK) fev = Arrow([0.25, 0, 0], [1.75, 0, 0], color=BLACK) fe = VGroup(fem, fet, fev).move_to([2, 1, 0]) self.add(wr, wl, wb, e1, e2, w, pt, nt, vm, c1, c2, c3, c4, na, fe) class slm3(Scene): def construct(self): self.camera.background_color = WHITE d1b = Polygon([-0.5, 1, 0], [-0.5, -1, 0], [0.5, 0, 0], color=BLACK) d1i = Line([0.5, 1, 0], [0.5, -1, 0], color=BLACK) d1 = VGroup(d1b, d1i) c1 = Line([-2.5, 0, 0], [-0.5, 0, 0], color=BLACK) c2 = Line([2.5, 0, 0], [0.5, 0, 0], color=BLACK) j1 = Dot(radius=0.08, color=BLACK).move_to([2.5, 0, 0]) j2 = Dot(radius=0.08, color=BLACK).move_to([-2.5, 0, 0]) i1a = Arrow([-1.5, 1.5, 0], [1.5, 1.5, 0], color=GREEN) i2a = Arrow([1.5, -1.5, 0], [-1.5, -1.5, 0], color=RED) i1t = Tex("Leitet", color=GREEN).move_to([0, 2, 0]) i2t = Tex("Sperrt", color=RED).move_to([0, -2, 0]) self.add(d1, c1, c2, j1, j2, i1a, i2a, i1t, i2t) class magnet2(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(-1, 3 * LEFT) charge2 = Charge(1, 1 * LEFT) charge3 = Charge(-1, 1 * RIGHT) charge4 = Charge(1, 3 * RIGHT) field = ElectricField(charge1, charge2, charge3, charge4) magnetP1 = Polygon( [-3.5, 0.5, 0], [-3.5, -0.5, 0], [-2, -0.5, 0], [-2, 0.5, 0], color=BLUE, fill_color=BLUE, fill_opacity=1, ) textP1 = Text("S").move_to([-3, 0, 0]) magnetN1 = Polygon( [-0.5, 0.5, 0], [-0.5, -0.5, 0], [-2, -0.5, 0], [-2, 0.5, 0], color=RED, fill_color=RED, fill_opacity=1, ) textN1 = Text("N").move_to([-1, 0, 0]) magnetP2 = Polygon( [0.5, 0.5, 0], [0.5, -0.5, 0], [2, -0.5, 0], [2, 0.5, 0], color=BLUE, fill_color=BLUE, fill_opacity=1, ) textP2 = Text("S").move_to([1, 0, 0]) magnetN2 = Polygon( [3.5, 0.5, 0], [3.5, -0.5, 0], [2, -0.5, 0], [2, 0.5, 0], color=RED, fill_color=RED, fill_opacity=1, ) textN2 = Text("N").move_to([3, 0, 0]) self.add( field, magnetP1, magnetN1, textP1, textN1, magnetP2, magnetN2, textP2, textN2, ) class magnet3(Scene): def construct(self): self.camera.background_color = WHITE charge1 = Charge(1, 3 * LEFT) charge2 = Charge(-1, 1 * LEFT) charge3 = Charge(-1, 1 * RIGHT) charge4 = Charge(1, 3 * RIGHT) field = ElectricField(charge1, charge2, charge3, charge4) magnetP1 = Polygon( [-3.5, 0.5, 0], [-3.5, -0.5, 0], [-2, -0.5, 0], [-2, 0.5, 0], color=RED, fill_color=RED, fill_opacity=1, ) textP1 = Text("N").move_to([-3, 0, 0]) magnetN1 = Polygon( [-0.5, 0.5, 0], [-0.5, -0.5, 0], [-2, -0.5, 0], [-2, 0.5, 0], color=BLUE, fill_color=BLUE, fill_opacity=1, ) textN1 = Text("S").move_to([-1, 0, 0]) magnetP2 = Polygon( [0.5, 0.5, 0], [0.5, -0.5, 0], [2, -0.5, 0], [2, 0.5, 0], color=BLUE, fill_color=BLUE, fill_opacity=1, ) textP2 = Text("S").move_to([1, 0, 0]) magnetN2 = Polygon( [3.5, 0.5, 0], [3.5, -0.5, 0], [2, -0.5, 0], [2, 0.5, 0], color=RED, fill_color=RED, fill_opacity=1, ) textN2 = Text("N").move_to([3, 0, 0]) error = Polygon( [-0.2, 0.2, 0], [-0.2, -0.2, 0], [0.2, -0.2, 0], [0.2, 0.2, 0], color=WHITE, fill_color=WHITE, fill_opacity=1, ) self.add( field, magnetP1, magnetN1, textP1, textN1, magnetP2, magnetN2, textP2, textN2, error, ) class LF1(Scene): def construct(self): self.camera.background_color = WHITE wire = Wire(Line([0, 0, -1000], [0, 0, 1000])) magf = MagneticField(wire) dot = Dot(point=ORIGIN, color=BLACK) self.add(magf, dot) class LF2(Scene): def construct(self): self.camera.background_color = WHITE func = lambda pos: pos - DOWN * 1000 vf = ArrowVectorField(func, color=BLUE) charge1 = Charge(3, ORIGIN) velvec = LabeledArrow( r"\vec{v}", start=ORIGIN, end=2 * RIGHT, color=BLACK, label_position=0.5, label_color=BLACK, frame_fill_color=WHITE, ) lkvec = LabeledArrow( r"\vec{F}", start=[0, 0, 0], end=[-2, -2, 0], color=RED, label_position=0.5, label_color=BLACK, frame_fill_color=WHITE, ) self.add(vf, charge1, velvec, lkvec) class mf1(Scene): def construct(self): self.camera.background_color = WHITE wire = Wire(Line([0, 0, -1000], [0, 0, 1000])) magf = MagneticField(wire) dot = Dot(point=ORIGIN, color=BLACK) fvec1 = Arrow(3 * RIGHT, 3 * RIGHT + 2 * UP, color=RED) fvec2 = Arrow(5 * RIGHT, 5 * RIGHT + 1 * UP, color=RED) self.add(magf, dot, fvec1, fvec2) class mf2(ThreeDScene): def construct(self): self.camera.background_color = WHITE wire1 = Wire( ParametricFunction( lambda u: ( u * 0.07, 2 * np.cos(u), 2 * np.sin(u), ), t_range=(-11 / 4 * TAU, 11 / 4 * TAU, 0.01), ), color=BLACK, ) mag_field = MagneticField( wire1, x_range=[-1, 1], y_range=[-1, 1], ) self.set_camera_orientation(PI / 3, PI / 4) # self.set_camera_orientation(PI / 2) self.add(wire1, mag_field) class mf3(Scene): def construct(self): self.camera.background_color = WHITE wire = Wire(Circle(7).rotate(PI / 2, RIGHT)) mag_field = MagneticField( wire, x_range=[-2, 1], y_range=[-2, 3], ) magnetP = Polygon( [-2, 2, 0], [-2, 3, 0], [1, 3, 0], [1, 2, 0], color=RED, fill_color=RED, fill_opacity=1, ) textP = Text("N").move_to([-0.5, 2.5, 0]) magnetM = Polygon( [1, 3, 0], [1, -3, 0], [2, -3, 0], [2, 3, 0], color=GREY, fill_color=GREY, fill_opacity=1, ) textN = Text("S").move_to([-0.5, -2.5, 0]) magnetN = Polygon( [-2, -2, 0], [-2, -3, 0], [1, -3, 0], [1, -2, 0], color=BLUE, fill_color=BLUE, fill_opacity=1, ) self.add(mag_field, magnetP, magnetM, magnetN, textP, textN) class mf4(ThreeDScene): def construct(self): self.camera.background_color = WHITE wire = Wire(Circle(10).rotate(PI / 2, UP)) mag_field1 = MagneticField( wire, x_range=[-1, 1], y_range=[-3, 3], ).move_to([0, 0, 2]) mag_field2 = MagneticField( wire, x_range=[-1, 1], y_range=[-3, 3], ).move_to([0, 0, 1]) mag_field3 = MagneticField( wire, x_range=[-1, 1], y_range=[-3, 3], ) mag_field4 = MagneticField( wire, x_range=[-1, 1], y_range=[-3, 3], ).move_to([0, 0, -1]) mag_field5 = MagneticField( wire, x_range=[-1, 1], y_range=[-3, 3], ).move_to([0, 0, -2]) plate = Polygon( [0, -2.5, 2.5], [0, 3.5, 2.5], [0, 3.5, -1.5], [0, -2.5, -1.5], color=GREY, fill_color=GREY, fill_opacity=0.25, ) self.set_camera_orientation(PI / 3, PI / 4) self.add(plate, mag_field1, mag_field2, mag_field3, mag_field4, mag_field5) class mf5(Scene): def construct(self): self.camera.background_color = WHITE tran = Line(start=[0, 5, 0], end=[0, -5, 0], color=BLACK) b1 = LabeledArrow( r"\vec{B}_1", label_color=BLACK, frame_fill_color=WHITE, start=[-3, -3, 0], end=[0, 0, 0], color=RED, ) b2 = LabeledArrow( r"\vec{B}_2", label_color=BLACK, frame_fill_color=WHITE, start=[0, 0, 0], end=[3, 1, 0], color=BLUE, ) mu1 = MathTex(r"\mu_1", color=BLACK).move_to([-1, 3, 0]) mu2 = MathTex(r"\mu_2", color=BLACK).move_to([1, 3, 0]) self.add(tran, b1, b2, mu1, mu2) class zef1(Scene): def construct(self): self.camera.background_color = WHITE metal = Polygon( [-1, 3, 0], [1, 3, 0], [1, -3, 0], [-1, -3, 0], color=BLACK, fill_color=GREY, fill_opacity=0.75, ) vv = Arrow3D([0, 0, 1], [0, 0, 3], color=RED) c = Charge(1, [1000, 0, 0]) ef = ElectricField(c) c1 = Charge(-10, [0, 2.5, 0]) c2 = Charge(10, [0, -2.5, 0]) self.add(metal, vv, ef, c1, c2) class zef2(Scene): def construct(self): self.camera.background_color = WHITE l11 = Line([-1, 0, 0], [-0.5, 0, 0], path_arc=-180 * DEGREES) l12 = Line([-0.5, 0, 0], ORIGIN, path_arc=-180 * DEGREES) l13 = Line([1, 0, 0], [0.5, 0, 0], path_arc=180 * DEGREES) l14 = Line([0.5, 0, 0], ORIGIN, path_arc=180 * DEGREES) l1 = VGroup(l11, l12, l13, l14).move_to([-2, 0, 0]).set_color(BLACK) l21 = Line([-1, 0, 0], [-0.5, 0, 0], path_arc=-180 * DEGREES) l22 = Line([-0.5, 0, 0], ORIGIN, path_arc=-180 * DEGREES) l23 = Line([1, 0, 0], [0.5, 0, 0], path_arc=180 * DEGREES) l24 = Line([0.5, 0, 0], ORIGIN, path_arc=180 * DEGREES) l2 = VGroup(l21, l22, l23, l24).move_to([2, 0, 0]).set_color(BLACK) c1 = Line([-4, -0.1, 0], [-3, -0.1, 0], color=BLACK) c2 = Line([4, -0.1, 0], [3, -0.1, 0], color=BLACK) c3 = Line([1, -0.1, 0], [-1, -0.1, 0], color=BLACK) j1 = Dot([-4, -0.1, 0], radius=0.08, color=BLACK) j2 = Dot([4, -0.1, 0], radius=0.08, color=BLACK) lt1 = MathTex(r"L_1", color=BLACK).move_to([-2, 1, 0]) lt2 = MathTex(r"L_2", color=BLACK).move_to([2, 1, 0]) self.add(l1, l2, c1, c2, c3, j1, j2, lt1, lt2) class zef3(Scene): def construct(self): self.camera.background_color = WHITE l11 = Line([-1, 0, 0], [-0.5, 0, 0], path_arc=-180 * DEGREES) l12 = Line([-0.5, 0, 0], ORIGIN, path_arc=-180 * DEGREES) l13 = Line([1, 0, 0], [0.5, 0, 0], path_arc=180 * DEGREES) l14 = Line([0.5, 0, 0], ORIGIN, path_arc=180 * DEGREES) l1 = VGroup(l11, l12, l13, l14).move_to([0, 1, 0]).set_color(BLACK) l21 = Line([-1, 0, 0], [-0.5, 0, 0], path_arc=-180 * DEGREES) l22 = Line([-0.5, 0, 0], ORIGIN, path_arc=-180 * DEGREES) l23 = Line([1, 0, 0], [0.5, 0, 0], path_arc=180 * DEGREES) l24 = Line([0.5, 0, 0], ORIGIN, path_arc=180 * DEGREES) l2 = VGroup(l21, l22, l23, l24).move_to([0, -1, 0]).set_color(BLACK) c1 = Line([-3, -0.1, 0], [-2, -0.1, 0], color=BLACK) c2 = Line([3, -0.1, 0], [2, -0.1, 0], color=BLACK) c3 = Line([2, 0.9, 0], [2, -1.1, 0], color=BLACK) c4 = Line([2, 0.9, 0], [1, 0.9, 0], color=BLACK) c5 = Line([-1, 0.9, 0], [-2, 0.9, 0], color=BLACK) c6 = Line([2, -1.1, 0], [1, -1.1, 0], color=BLACK) c7 = Line([-2, -1.1, 0], [-1, -1.1, 0], color=BLACK) c8 = Line([-2, 0.9, 0], [-2, -1.1, 0], color=BLACK) j1 = Dot([-3, -0.1, 0], radius=0.08, color=BLACK) j2 = Dot([3, -0.1, 0], radius=0.08, color=BLACK) lt1 = MathTex(r"L_1", color=BLACK).move_to([0, 2, 0]) lt2 = MathTex(r"L_2", color=BLACK).move_to(ORIGIN) self.add(l1, l2, c1, c2, c3, c4, c5, c6, c7, c8, j1, j2, lt1, lt2) class zef4(Scene): def construct(self): self.camera.background_color = WHITE ax = Axes( y_range=[-1.5, 1.5, 3], x_range=[0, (5 * PI) / 2, PI / 2], tips=False, ).set_color(BLACK) labels = ax.get_axis_labels(Tex("t"), Tex("U")).set_color(BLACK) f1 = ax.plot(lambda x: np.sin(x), color=RED) self.add(ax, labels, f1) class zef5(Scene): def construct(self): self.camera.background_color = WHITE ax = Axes( y_range=[-1.5, 1.5, 3], x_range=[0, (5 * PI) / 2, PI / 2], tips=False, ).set_color(BLACK) labels = ax.get_axis_labels(Tex("t"), Tex("U")).set_color(BLACK) f1 = ax.plot(lambda x: np.sin(x), color=RED) f2 = ax.plot(lambda x: np.sin(x + 120 * DEGREES), color=BLUE) self.add(ax, labels, f1, f2) class zef5(Scene): def construct(self): self.camera.background_color = WHITE ax = Axes( y_range=[-1.5, 1.5, 3], x_range=[0, (5 * PI) / 2, PI / 2], tips=False, ).set_color(BLACK) labels = ax.get_axis_labels(Tex("t"), Tex("U")).set_color(BLACK) f1 = ax.plot(lambda x: np.sin(x), color=RED) f2 = ax.plot(lambda x: np.sin(x + 120 * DEGREES), color=BLUE) f3 = ax.plot(lambda x: np.sin(x + 240 * DEGREES), color=GREEN) self.add(ax, labels, f1, f2, f3)