0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

wslでmanim その22

Last updated at Posted at 2024-09-14

概要

wslでmanimやってみた。
練習問題やってみた。

練習問題

おっぱい関数を表示せよ。

参考にしたページ

成果物

ManimGraph_ManimCE_v0.18.1.gif

サンプルコード


from manim import *

def oppai(y, t):
	x_1 = (1.5 * np.exp((0.12 * np.sin(t) - 0.5) * (y + 0.16 * np.sin(t)) ** 2)) / (1 + np.exp(-20 * (5 * y + np.sin(t))))
	x_2 = ((1.5 + 0.8 * (y + 0.2 * np.sin(t)) ** 3) * (1 + np.exp(20 * (5 * y + np.sin(t)))) ** -1)
	x_3 = (1 + np.exp(-(100 * (y + 1) + 16 * np.sin(t))))
	x_4 = (0.2 * (np.exp(-(y + 1) ** 2) + 1)) / (1 + np.exp(100 * (y + 1) + 16 * np.sin(t)))
	x_5 = (0.1 / np.exp(2 * (10 * y + 1.2 * (2 + np.sin(t)) * np.sin(t)) ** 4))
	x = x_1 + (x_2 / x_3) + x_4 + x_5
	return x

class ManimGraph(Scene):
	def construct(self):
		t = np.arange(300) / 50 - 3.0
		y = oppai(t, 0.1)
		axes = Axes(x_range = (-3.2, 3.2, 0.4), y_range = (0, 2, 0.4), tips = False)
		axes.add_coordinates() 
		name = Text("Graph").next_to(axes, UP, buff = 0)
		graph = axes.plot_line_graph(t[1:300], y[1:300], add_vertex_dots = False, line_color = RED)
		self.play(Write(axes), Write(name))
		self.play(Write(graph))
		self.wait()



以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?