update independent variable in the main loop

This commit is contained in:
Krishna Vedala 2020-06-10 12:50:09 -04:00
parent beade2db10
commit 63ea12bc3d
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7
2 changed files with 2 additions and 0 deletions

View File

@ -116,6 +116,7 @@ int main(int argc, char *argv[])
{
fprintf(fp, "%.4g,%.4g,%.4g\n", x, y[0], y[1]); // write to file
forward_euler(dx, &x, y, dy); // perform integration
x += dx; // update step
} while (x <= X_MAX); // till upper limit of independent variable
/* end of integration */

View File

@ -124,6 +124,7 @@ int main(int argc, char *argv[])
{
fprintf(fp, "%.4g,%.4g,%.4g\n", x, y[0], y[1]); // write to file
midpoint_euler(dx, &x, y, dy); // perform integration
x += dx; // update step
} while (x <= X_MAX); // till upper limit of independent variable
/* end of integration */