Commit 6d2f51b7 authored by Taddeüs Kroes's avatar Taddeüs Kroes

ModSim ass3: Added harmonic oscillator assignment.

parent eb5a865f
......@@ -16,11 +16,13 @@
INTEGRATE(RungeKutta2, t0, t1); \
INTEGRATE(RungeKutta4, t0, t1); \
}
/*
extern log_function log_func;
void log(double t, double *y) {
printf("%f,%f,%f\n", t, y[0], y[1]);
}
*/
int f_osc(double t, double *y, double *dy, void *params) {
dy[0] = y[1];
dy[1] = -*(double *)(params) * y[0];
......@@ -31,6 +33,8 @@ int f_osc(double t, double *y, double *dy, void *params) {
int main(void) {
double k = .5, y0[2] = {.0, 5.0}, y1[2] = {.0, .0};
log_func = &log;
COMPARE(.0, 10.0)
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment