TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Runge Kutta fourth order method implementation More...
#include <cassert>
#include <cstdint>
#include <iostream>
#include <vector>
Go to the source code of this file.
Namespaces | |
namespace | numerical_methods |
for assert | |
namespace | runge_kutta |
Functions for Runge Kutta fourth order method. | |
Functions | |
double | numerical_methods::runge_kutta::rungeKutta (double init_x, const double &init_y, const double &x, const double &h) |
the Runge Kutta method finds the value of integration of a function in the given limits. the lower limit of integration as the initial value and the upper limit is the given x | |
static double | change (double x, double y) |
asserting the test functions | |
static void | test () |
Tests to check algorithm implementation. | |
int | main () |
Main function. | |
Runge Kutta fourth order method implementation
It solves the unknown value of y for a given value of x only first order differential equations can be solved
Definition in file rungekutta.cpp.
|
static |
asserting the test functions
for io operations for using the vector container
The change() function is used to return the updated iterative value corresponding to the given function
x | is the value corresponding to the x coordinate |
y | is the value corresponding to the y coordinate |
Definition at line 33 of file rungekutta.cpp.
int main | ( | void | ) |
Main function.
Definition at line 130 of file rungekutta.cpp.
double numerical_methods::runge_kutta::rungeKutta | ( | double | init_x, |
const double & | init_y, | ||
const double & | x, | ||
const double & | h ) |
the Runge Kutta method finds the value of integration of a function in the given limits. the lower limit of integration as the initial value and the upper limit is the given x
init_x | is the value of initial x and is updated after each call |
init_y | is the value of initial x and is updated after each call |
x | is current iteration at which the function needs to be evaluated |
h | is the step value |
Definition at line 57 of file rungekutta.cpp.
|
static |
Tests to check algorithm implementation.
Definition at line 100 of file rungekutta.cpp.