diff --git a/S2/TP4/.gitignore b/S2/TP4/.gitignore index c6af96f..3e19efc 100644 --- a/S2/TP4/.gitignore +++ b/S2/TP4/.gitignore @@ -1 +1 @@ -tri_insertion_moyen.txt \ No newline at end of file +tri_insertion_moyen.* \ No newline at end of file diff --git a/S2/TP4/Makefile b/S2/TP4/Makefile index c21cd48..70617db 100644 --- a/S2/TP4/Makefile +++ b/S2/TP4/Makefile @@ -1,5 +1,14 @@ -tri_insertion_moyen.txt: analyse_en_moyenne.py +NOM=tri_insertion_moyen +GNUPLOT_EXT=png svg eps +COURBE=0.287*x**2-2*x+1 + +default: $(NOM).png + +$(NOM).txt: analyse_en_moyenne.py python3 $< --brut > $@ +$(addprefix $(NOM).,$(GNUPLOT_EXT)): $(NOM).txt + gnuplot -e "set terminal $(subst $(NOM).,,$@); set output '$(NOM).$(subst $(NOM).,,$@)'; plot '$(NOM).txt', $(COURBE) with lines" + clean: - rm tri_insertion_moyen.txt \ No newline at end of file + rm $(NOM).* \ No newline at end of file diff --git a/S2/TP4/analyse_tris.py b/S2/TP4/analyse_tris.py index f80b48f..d8bc21f 100755 --- a/S2/TP4/analyse_tris.py +++ b/S2/TP4/analyse_tris.py @@ -379,7 +379,9 @@ question(1) reponse("Graphiquement, on trouve que cette fonction a pour expression 0,287 × x² - 2 × x + 1\n\ Cette fonction correspond à la commande suivante : \n\ -gnuplot> plot 'tri_insertion_moyen.txt', 0.287*x**2-2*x +1 with lines\n\ +gnuplot> plot 'tri_insertion_moyen.txt', 0.287*x**2-2*x+1 with lines\n\ On peut aussi trouver des valeurs plus précises en faisant une regression polynôminale des données \ avec la fonction polyfit de numpy. Je vous invite à lancer la commande suivante :\n\ -python3 analyse_en_moyenne.py --brut --poly --graph") +python3 analyse_en_moyenne.py --brut --poly --graph\n\ +Je vous invite aussi à éxecuter la commande suivante qui permet de générer le graphique Gnuplot :\n\ +make tri_insertion_moyen.png")