Skip to content

Conversation

@catastropiyush
Copy link

gave user input to variables

gave user input to variables
@catastropiyush
Copy link
Author

I am trying to implement RK-4 method to solve the differential equation for the Pendulum

@SamMachariaPhD
Copy link
Member

Hello @catastropiyush

1pendulum.py used a simple Euler's method for numerical integration, which calculates the new angle and velocity based on the previous angle and velocity. This method is less accurate, especially for longer simulations or larger time steps.

You could modify the code to implement the RK-4 method, which is a more advanced and accurate numerical integration technique. It calculates the new angle and velocity by considering intermediate estimates within each time step, which leads to a better approximation of the solution to the differential equation.

1pendulum.py was set to simulate a single period of the pendulum motion. In the modified code, the simulation could run for a fixed number of steps specified by, say, num_steps. This would allow you to easily adjust the simulation length by changing the value of num_steps.

@SamMachariaPhD
Copy link
Member

@catastropiyush, pendulum/1pendulum-rk4.py might be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants