Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete lines while rendering #2295

Open
RishithRajRaizada opened this issue Jan 5, 2025 · 0 comments
Open

Incomplete lines while rendering #2295

RishithRajRaizada opened this issue Jan 5, 2025 · 0 comments
Labels

Comments

@RishithRajRaizada
Copy link

RishithRajRaizada commented Jan 5, 2025

I tried to code the Lorenz Attractor recently mentioned in the 3b1b. However, on rendering the Lorenz Attractor the curve breaks in between as some places.

Code:

from manimlib import *
from scipy.integrate import solve_ivp
import numpy as np

def lorenz_system(t, state, sigma=10, rho=28, beta=8/3):
	x,y,z = state
	dxdt = sigma*(y-x)
	dydt = x*(rho-z)-y
	dzdt = x*y-beta*z
	return [dxdt, dydt, dzdt]

def ode_solution_points(function, state0, time, dt=0.01):
	solution = solve_ivp(
			function,
			t_span = (0,time),
			y0=state0,
			t_eval=np.arange(0, time, dt)
		)
	return solution.y.T

class LorenzButterfly(Scene):
	def construct(self):
		axes = ThreeDAxes(
			x_range = [-50, 50, 5],
			y_range = [-50, 50, 5],
			z_range = [0, 50, 5],
			width = 16,
			height = 16,
			depth = 8
		)
		axes.set_width(FRAME_WIDTH)
		axes.center()

		self.frame.reorient(43, 76, 1, IN,10)
		self.add(axes)

		state0 = [10,10,10]
		points = ode_solution_points(lorenz_system, state0, 30)
		curve = VMobject().set_points_as_corners(axes.c2p(*points.T))
		self.add(curve)

Wrong display or Error traceback:
image

Additional context

I had cloned the repository on 4th January, 2025. The python version I am using is 3.13.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant