<commit_before>#include <iostream>
#include <cmath>
#include <list>
#include <fstream>
#include <vector>
#include "gnuplot_i.hpp"

#define GNUPLOT_PATH "C:/gnuplot/bin"

using namespace std;

double start, stop;

double M = 5.974e24;
double G = 6.67e-11;
double h = 1; //wielkosc kroku calkowania
const int table_size = 30000;

double x[table_size];
double y[table_size];
double vx[table_size];
double vy[table_size];

double func1(double y2){
    return y2;
}

double func2(double y1, double y3 ){
    double r = sqrt(y1*y1+y3*y3);
    return -G*M*y1/(r*r*r);
}

double func3(double y4 ){
    return y4;
}

double func4(double y1, double y3){
    double r = sqrt(y1*y1+y3*y3);
    return -G*M*y3/(r*r*r);
}

void RungeKutta(double *y1, double *y2, double *y3, double *y4 ){

    for(int i=0; i<table_size-1; i++){
        double k11=h*func1(y2[i]);
        double k21=h*func2(y1[i], y3[i]);
        double k31=h*func3(y4[i]);
        double k41=h*func4(y1[i], y3[i]);

        double k12=h*func1(0.5*k21+y2[i]);
        double k22=h*func2(0.5*k11+y1[i], 0.5*k31+y3[i]);
        double k32=h*func3(0.5*k41+y4[i]);
        double k42=h*func4(0.5*k11+y1[i], 0.5*k31+y3[i]);

        double k13=h*func1(0.5*k22+y2[i]);
        double k23=h*func2(0.5*k12+y1[i], 0.5*k32+y3[i]);
        double k33=h*func3(0.5*k42+y4[i]);
        double k43=h*func4(0.5*k12+y1[i], 0.5*k32+y3[i]);

        double k14=h*func1(k23+y2[i]);
        double k24=h*func2(k13+y1[i], k33+y3[i]);
        double k34=h*func3(k43+y4[i]);
        double k44=h*func4(k13+y1[i], k33+y3[i]);

        y1[i+1] = y1[i] + (k11+2*k12+2*k13+k14)/6;
        y2[i+1] = y2[i] + (k21+2*k22+2*k23+k24)/6;
        y3[i+1] = y3[i] + (k31+2*k32+2*k33+k34)/6;
        y4[i+1] = y4[i] + (k41+2*k42+2*k43+k44)/6;
    }

}

double min(double *tab){
    double mini = tab[0];
    for (int i=1; i< table_size; i++){
        if (tab[i] < mini) mini = tab[i];
    }

    return mini;
}

double max(double *tab){
    double maxi = tab[0];
    for (int i=1; i< table_size; i++){
        if (tab[i] > maxi) maxi = tab[i];
    }

    return maxi;
}

void wybierzFunk(){
    cout << "Wybierz przypadek [1-3]: \n> ";
    int wybor;

    cin >> wybor;
    x[0] = 6.578e6;
    y[0] = 0;
    vx[0] = 0;
    switch(wybor){
    case 1:
        vy[0] = 7900;
        break;
    case 2:
        vy[0] = 9000;
        break;
    case 3:
        vy[0] = 11200;
        break;
    default:
        throw string("Example not found");
    }
}

int main()
{<commit_msg>Ostry przykład.<commit_after>#include <iostream>
#include <cmath>
#include <list>
#include <fstream>
#include <vector>
#include "gnuplot_i.hpp"

#define GNUPLOT_PATH "C:/gnuplot/bin"

using namespace std;

double start, stop;

double M = 5.974e24;
double G = 6.67e-11;
double h = 1; //wielkosc kroku calkowania
const int table_size = 21500;

double x[table_size];
double y[table_size];
double vx[table_size];
double vy[table_size];

double func1(double y2){
    return y2;
}

double func2(double y1, double y3 ){
    double r = sqrt(y1*y1+y3*y3);
    return -G*M*y1/(r*r*r);
}

double func3(double y4 ){
    return y4;
}

double func4(double y1, double y3){
    double r = sqrt(y1*y1+y3*y3);
    return -G*M*y3/(r*r*r);
}

void RungeKutta(double *y1, double *y2, double *y3, double *y4 ){

    for(int i=0; i<table_size-1; i++){
        double k11=h*func1(y2[i]);
        double k21=h*func2(y1[i], y3[i]);
        double k31=h*func3(y4[i]);
        double k41=h*func4(y1[i], y3[i]);

        double k12=h*func1(0.5*k21+y2[i]);
        double k22=h*func2(0.5*k11+y1[i], 0.5*k31+y3[i]);
        double k32=h*func3(0.5*k41+y4[i]);
        double k42=h*func4(0.5*k11+y1[i], 0.5*k31+y3[i]);

        double k13=h*func1(0.5*k22+y2[i]);
        double k23=h*func2(0.5*k12+y1[i], 0.5*k32+y3[i]);
        double k33=h*func3(0.5*k42+y4[i]);
        double k43=h*func4(0.5*k12+y1[i], 0.5*k32+y3[i]);

        double k14=h*func1(k23+y2[i]);
        double k24=h*func2(k13+y1[i], k33+y3[i]);
        double k34=h*func3(k43+y4[i]);
        double k44=h*func4(k13+y1[i], k33+y3[i]);

        y1[i+1] = y1[i] + (k11+2*k12+2*k13+k14)/6;
        y2[i+1] = y2[i] + (k21+2*k22+2*k23+k24)/6;
        y3[i+1] = y3[i] + (k31+2*k32+2*k33+k34)/6;
        y4[i+1] = y4[i] + (k41+2*k42+2*k43+k44)/6;
    }

}

double min(double *tab){
    double mini = tab[0];
    for (int i=1; i< table_size; i++){
        if (tab[i] < mini) mini = tab[i];
    }

    return mini;
}

double max(double *tab){
    double maxi = tab[0];
    for (int i=1; i< table_size; i++){
        if (tab[i] > maxi) maxi = tab[i];
    }

    return maxi;
}

void wybierzFunk(){
    cout << "Wybierz przypadek [1-4]: \n> ";
    int wybor;

    cin >> wybor;
    x[0] = 6.578e6;
    y[0] = 0;
    vx[0] = 0;
    switch(wybor){
    case 1:
        vy[0] = 7900;
        break;
    case 2:
        vy[0] = 9000;
        break;
    case 3:
        vy[0] = 11200;
        break;
    case 4:
        x[0] = 42e6;
        vy[0] = 3000;
        break;
    default:
        throw string("Example not found");
    }
}

int main()
{
{'fraction_non_alphanumeric': 0.19726948951325682, 'fraction_numerical': 0.10803324099722991, 'mean_word_length': 2.711453744493392, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6220987', 'n_tokens_mistral': 2614, 'n_tokens_neox': 2417, 'n_words': 444}