Tell me Pi is irrational without actually telling me Pi is irrational
Vložit
- čas přidán 23. 10. 2023
- Here is the original 10 minute slow version of my viral Pi reel on Instagram! Also provided the python code on how to use the equation to draw the graph! The code is not for the animation, but just a steady graph.
Hope this might answer your questions!
Here is the link to the Pi reel : reelCyrFBp...
Detailed explanation of Pi post by angzt from reddit :
/ gnprzizzgh
Python code :
import numpy as np
import matplotlib.pyplot as plt
Create an array of theta values in degrees (e.g., from 0 to 113*360 degrees)
theta_degrees = np.linspace(0, 113*360, 10000)
Convert degrees to radians
theta_radians = np.deg2rad(theta_degrees)
Calculate z(theta) using the formula , 1j is imaginary number
z = np.exp(theta_radians * 1j) + np.exp(np.pi * theta_radians * 1j)
Separate the real and imaginary parts of z
x = np.real(z)
y = np.imag(z)
Create a plot with specific settings
plt.figure(figsize=(10, 10)) # Set a square figure 10x10 inches
plt.plot(x, y, color='white', linewidth=0.5) # Set line color to white and line width to 0.5
plt.gca().set_facecolor('black') # Set background color to black
plt.gca().set_aspect('equal') # Equal aspect ratio
plt.grid(False) # Turn off the grids
plt.xlim(-2.5, 2.5) # X-axis limit
plt.ylim(-2.5, 2.5) # Y-axis limit
plt.show() # Display the plot - Krátké a kreslené filmy
When I clicked I was hoping to see more than I did in the Short, not just a slowed-down version. Why not just keep it running quickly for an hour and check out the almost perfect circle?
Same, i got so mesmerized I started looking to see if there was an extended clip 💀
It’s about FPS ( frames per second) and collecting each point at each frame, I had to render 40000 frames ( for 40000 points ) for just one minute video. Imagine let alone 5 minutes ( 200K frames ) . I don’t have enough RAM nor my laptop is capable of performing such a long calculation.
@@fascinating.fractals I see, thanks.
If you want hours of a perfect circle, spotify got you
@amazingfireboy1848 well, why don't you run it yourself then with all the parameters you want? Change speed and whatsoever. Read documentation of matplolith, it will be there
Thank you so much for the code ☺️☺️
Underrated you tube channel 😅
hi
so cool, can you paste de code for the motion ?
Thank you !
Simplemente fascinante, gracias por compartirlo, saludos desde Uruguay
Thanks for the code. I tried to run it, but it just shows a finished plot. How can i make the animation with the two lines?
Great work
Should keep this going a ridiculous amount of time
can u explain how it shows the ration between the diamter and circumfrence
how did u animate the whole process? when u run this code it only returns the ploted graph
Animation is much more complex, especially the camera navigation part. You need to manipulate xlim,ylim value ranges manually for each frame, for zoom and for tracking the point.
@@fascinating.fractals do you have an example for the animation code somewhere? Do you use GitHub?
@fascinating.fractals I see and do u also animate using matplotlib? Or other software?
WHERE I CAN WRITE THIS CODE ?
Can you provide code for animation pls
please
Make a tutorial with details
Please please please 🙏🙏🙏🙏
Please reply how to make the animation
Ty
Satisfying
Can you provide a code for animating this pattern??
Its on screen my man.
@@true_xander It's for the plot not the animation.
Check description bro
I asked ChatGPT to get the code. The first few seconds seem promising:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
# Create an array of theta values
theta_degrees = np.linspace(0, 113*360, 10000)
theta_radians = np.deg2rad(theta_degrees)
# Calculate z(theta) using the formula, 1j is imaginary number
z = np.exp(theta_radians * 1j) + np.exp(np.pi * theta_radians * 1j)
# Separate the real and imaginary parts of z
x = np.real(z)
y = np.imag(z)
# Create a figure and an axes
fig, ax = plt.subplots(figsize=(10, 10))
# Set up the plot
line, = ax.plot([], [], color='white', linewidth=0.5)
ax.set_facecolor('black')
ax.set_aspect('equal')
ax.grid(False)
ax.set_xlim(-2.5, 2.5)
ax.set_ylim(-2.5, 2.5)
# Initialization function: plot the background of each frame
def init():
line.set_data([], [])
return line,
# Animation function: this is called sequentially
def animate(i):
line.set_data(x[:i], y[:i])
return line,
# Call the animator
ani = FuncAnimation(fig, animate, init_func=init, frames=len(theta_radians), interval=20, blit=True)
# To save the animation, use the following line
# ani.save('pi_circle_animation.mp4', fps=30, extra_args=['-vcodec', 'libx264'])
plt.show()
bro it's showing no module named "numpy" error
run "pip install numpy" in terminal
If you don't understand that error, you should start with the very basics, before trying to mess around with plotting graphs.
Tutorial
The program is there just to sell you
Stolen content
Bro, this guy made the original YOU DUMB FU- i mean, stfu