diff --git a/travaux_pratiques/tpChaos/map.c b/travaux_pratiques/tpChaos/map.c new file mode 100644 index 0000000000000000000000000000000000000000..5750975a5cc7381281773da7f57eecb797082152 --- /dev/null +++ b/travaux_pratiques/tpChaos/map.c @@ -0,0 +1,23 @@ +#include <stdio.h> + +double map(double x, double lambda) { + return lambda * x * (1.0 - x); +} + +int main() { + const double lambda_min = 0.0; + const double lambda_max = 4.0; + const int N = 100; + const double dl = (lambda_max - lambda_min) / N; + + int max_iter = 1000; + for (double lambda = 0.0; lambda < lambda_max; lambda += dl) { + double x = 0.5; + for (int i = 0; i < max_iter; ++i) { + printf("x(%d, %g) = %g\n", i, lambda, x); + x = map(x, lambda); + } + printf("\n"); + } + +}