Skip to content
View equalbox's full-sized avatar
🌴
On vacation
🌴
On vacation

Block or report equalbox

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
equalbox/README.md

Caution

I am not responsible for the use of my projects for bad purposes.

#include <iostream>
#include <iomanip>
#include <cmath>
#include <chrono>
#include <thread>

int main() {
    constexpr double g = 9.81;        
    constexpr double L = 1.0;        
    constexpr double damping = 0.05;  
    constexpr double dt = 0.01;      
    constexpr int steps = 1500;      

    double theta = M_PI / 4;         
    double omega = 0.0;              

    std::cout << std::fixed << std::setprecision(4);
    for (int i = 0; i < steps; ++i) {
        double alpha = - (g / L) * std::sin(theta) - damping * omega;
        omega += alpha * dt;
        theta += omega * dt;

        double x = L * std::sin(theta); 
        std::cout << "[θ]: " << theta << " rad\t| ";
        std::cout << "[x]: " << x << " m\n";

        std::this_thread::sleep_for(std::chrono::milliseconds(10));
    }
}

@equalbox's activity is private