{"id":1230,"date":"2019-05-21T17:43:32","date_gmt":"2019-05-21T15:43:32","guid":{"rendered":"https:\/\/www.mathweb.fr\/euclide\/?p=1230"},"modified":"2022-10-01T17:15:16","modified_gmt":"2022-10-01T15:15:16","slug":"construire-le-graphe-dune-suite-avec-python","status":"publish","type":"post","link":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/","title":{"rendered":"Construire le graphe d&#8217;une suite avec Python"},"content":{"rendered":"\n<p>Comment construire simplement le graphe d&#8217;une suite d\u00e9finie par \\(u_{n+1}=f(u_n)\\) \u00e0 l&#8217;aide Python ?<\/p>\n\n\n\n<p>Mon objectif est de cr\u00e9er un programme Python qui demande \u00e0 la personne utilisatrice :<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>la fonction;<\/li><li>le premier terme de la suite;<\/li><li>le nombre de termes \u00e0 construire;<\/li><li>la fen\u00eatre \\( (x_{\\min}) \\),  \\( (x_{\\max}) \\),   \\( (y_{\\min}) \\) et  \\( (y_{\\max}) \\);<\/li><li>le nom sous lequel la figure sera sauvegard\u00e9e (vide si on ne souhaite pas la sauvegarder).<\/li><\/ul>\n\n\n\n<p>puis de tracer les premiers termes de la suite pour obtenir quelque chose comme ceci:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite.png\" rel=\"graphe_suite\" data-fancybox=\"gallery\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"238\" src=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite-300x238.png\" alt=\"\" class=\"wp-image-1238\" srcset=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite-300x238.png 300w, https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite-600x475.png 600w, https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite.png 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption>R\u00e9sultat obtenu<\/figcaption><\/figure>\n<\/div>\n\n\n<!--more-->\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-white ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Au menu sur cette page...<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#Graphe_dune_suite_avec_Python_les_modules\" >Graphe d&#8217;une suite avec Python: les modules<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#Graphe_dune_suite_avec_Python_saisie_de_la_fonction\" >Graphe d&#8217;une suite avec Python: saisie de la fonction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#Les_autres_saisies\" >Les autres saisies<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#La_fonction_de_construction_du_graphe\" >La fonction de construction du graphe<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#Graphe_dune_suite_trace_de_la_grille\" >Graphe d&#8217;une suite: trac\u00e9 de la grille<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#Graphe_dune_suite_trace_de_la_courbe\" >Graphe d&#8217;une suite: trac\u00e9 de la courbe<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#Construction_des_termes\" >Construction des termes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#Le_titre\" >Le titre<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#Fonction_principale\" >Fonction principale<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Graphe_dune_suite_avec_Python_les_modules\"><\/span>Graphe d&#8217;une suite avec Python: les modules<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\nimport matplotlib.pyplot as plt\nfrom sympy import *\nx=Symbol('x')<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Nous aurons besoin du module <em>numpy<\/em> pour effectuer quelques calculs;<\/li><li>ensuite, <em>matplotlib<\/em> nous servira \u00e0 effectuer les trac\u00e9s;<\/li><li>le module <em>sympy<\/em> nous servira \u00e0 interpr\u00e9ter la saisie de la fonction comme une fonction. \u00c0 ce titre, on indique que le symbole de la variable est &#8216;x&#8217;.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Graphe_dune_suite_avec_Python_saisie_de_la_fonction\"><\/span>Graphe d&#8217;une suite avec Python: saisie de la fonction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def definite_function():\n    fonction = input(\"Entrez l'expression de la fonction : \")\n    # convertit la cha\u00eene de caract\u00e8res en 'fonction'\n    f = lambdify(x,fonction,'math') # on utilise le module 'math' ici plut\u00f4t que 'numpy' car plus pratique\n    fonction_latex = input('Syntaxe LaTeX : ')\n    return f,fonction_latex<\/pre>\n\n\n\n<p>Ici, on demande de saisir d&#8217;une part la fonction (avec une syntaxe &#8220;classique&#8221;), cha\u00eene de caract\u00e8res que l&#8217;on s&#8217;empresse tout de suite de transformer en fonction avec la fonction <em>lambdify<\/em> du module <em>simpy<\/em>. Puis, on demande la syntaxe \\(\\LaTeX\\) pour que l&#8217;affichage du titre soit plus joli. La fonction retourne un couple constitu\u00e9 de la fonction et de la syntaxe &#8220;latexienne&#8221; de la fonction.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Les_autres_saisies\"><\/span>Les autres saisies<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def window():\n    xmin = float(input('xmin = '))\n    xmax = float(input('xmax = '))\n    ymin = float(input('ymin = '))\n    ymax = float(input('ymax = '))\n    return xmin,xmax,ymin,ymax\n    \ndef definite_first_term():\n    u = float(input(\"Entrez le premier terme : \"))\n    return u\n\ndef definite_nb_terms():\n    n = int(input('Nombre de termes \u00e0 construire : '))\n    return n\n\ndef definite_name():\n    name = input(\"Entrez le nom de l'image \u00e0 sauvegarder (appuyez sur [Entr\u00e9e] si vous ne voulez pas sauvegarder l'image) : \")\n    return name<\/pre>\n\n\n\n<p>Rien de bien compliqu\u00e9 pour ces quelques fonctions qui permettent de saisir le reste des param\u00e8tres.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"La_fonction_de_construction_du_graphe\"><\/span>La fonction de construction du graphe<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Nous allons la nommer :<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def construct_graph(xmin,xmax,ymin,ymax,f,fonction,u,n,name):<\/pre>\n\n\n\n<p>et pour commencer, nous allons nommer la figure:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">fig = plt.figure()<\/pre>\n\n\n\n<p>dans l&#8217;objectif de la sauvegarder (\u00e9ventuellement) plus tard.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Graphe_dune_suite_trace_de_la_grille\"><\/span>Graphe d&#8217;une suite: trac\u00e9 de la grille<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Attention: les derni\u00e8res version de matplotlib font que si on affiche ce qui suit, le graphe de la suite ne s&#8217;affiche plus. Je vous conseille donc de ne pas afficher ce qui est dans ce paragraphe. Et honn\u00eatement, il faudrait passer une ann\u00e9e enti\u00e8re \u00e0 \u00e9tudier matplotlib pour en comprendre le fonctionnement&#8230; C&#8217;est une vraie usine \u00e0 gaz !<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># trac\u00e9 du rep\u00e8re et de la grille\n    ax = fig.add_subplot(111, aspect='equal')\n    ax.grid()\n    ax.spines['bottom'].set_position('zero')\n    ax.spines['left'].set_position('zero')\n    ax.spines['top'].set_visible(False)\n    ax.spines['right'].set_visible(False)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Graphe_dune_suite_trace_de_la_courbe\"><\/span>Graphe d&#8217;une suite: trac\u00e9 de la courbe<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># trac\u00e9 des courbes\n    x = np.linspace(xmin, xmax, 201)\n    y = [f(x) for x in [xmin+i*(xmax-xmin)\/200 for i in range(201)]]\n    plt.plot(x,y,color='green')\n    plt.plot(x,x,color='red')<\/pre>\n\n\n\n<p>On trace ici la courbe repr\u00e9sentative de la fonction <em>f<\/em> ainsi que la droite d&#8217;\u00e9quation \\(y=x\\).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Construction_des_termes\"><\/span>Construction des termes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># 1er terme\n    x = [u,u]\n    y = [0,f(u)]\n    plt.plot(x,y,linestyle='--',color='blue',linewidth=0.5)\n    # construction des termes\n    for i in range(0,n):\n        x = [u,u]\n        y = [u,f(u)]\n        plt.plot(x,y,linestyle='--',color='blue',linewidth=0.5)\n        x = [u,f(u)]\n        y = [f(u),f(u)]\n        plt.plot(x,y,linestyle='--',color='blue',linewidth=0.5)\n        if i != n-1:\n            x = [f(u),f(u)]\n            y = [f(u),0]\n            plt.plot(x,y,linestyle='--',color='orange',linewidth=0.5)\n        if i%2 == 0:\n            yunder=-0.05\n        else:\n            yunder = -0.1\n        plt.text(u-0.02,yunder,np.around(u,2))\n        u = f(u)<\/pre>\n\n\n\n<p>On fait une boucle dont le nombre d&#8217;it\u00e9rations est \u00e9gal au nombre de points que l&#8217;on veut. Dans un premier temps, on trace en pointill\u00e9s la ligne verticale qui va de (u,0) \u00e0 (u,f(u)), dans un deuxi\u00e8me temps, la ligne horizontale qui va de (u,f(u)) \u00e0 (f(u),f(u)) puis la ligne verticale qui va de (f(u),f(u)) \u00e0 (f(u),0) pour avoir le terme suivant sur l&#8217;axe des abscisses.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Le_titre\"><\/span>Le titre<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    params = {'mathtext.default': 'regular' }\n    plt.rcParams.update(params)\n    plt.rc('text', usetex = True)\n    # plt.rc('font', family = 'serif')\n    title = \"Construction des \"+str(n)+\" premiers termes de la suite d\u00e9finie par\\n$u_{n+1}=f(u_n)$ avec $f(x)=\"+fonction+\"$\"\n    plt.title(title)\n    if name != '':\n        fig.savefig(name+'.png',dpi=100,bbox_inches='tight')\n    plt.show()<\/pre>\n\n\n\n<p>On ins\u00e8re maintenant le titre; les deux premi\u00e8res lignes comment\u00e9es affichent un titre avec une police de caract\u00e8res par d\u00e9faut sous Python (ce qui ne me convient pas, mais qui peut plaire \u00e0 certaines personnes). Les deux lignes suivantes sp\u00e9cifient que l&#8217;on souhaite un affichage \\(\\LaTeX\\). <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Fonction_principale\"><\/span>Fonction principale<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">if __name__ == '__main__':\n    f,fonction = definite_function()\n    u = definite_first_term()\n    xmin,xmax,ymin,ymax = window()\n    n = definite_nb_terms()\n    name = definite_name()\n    construct_graph(xmin,xmax,ymin,ymax,f,fonction,u,n,name)<\/pre>\n\n\n\n<p>En ex\u00e9cutant ce programme avec les param\u00e8tres suivants:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/graphe_suite.png\" rel=\"graphe_suite\" data-fancybox=\"gallery\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"126\" src=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/graphe_suite-300x126.png\" alt=\"\" class=\"wp-image-1234\" srcset=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/graphe_suite-300x126.png 300w, https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/graphe_suite-600x251.png 600w, https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/graphe_suite.png 669w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption>Saisie<\/figcaption><\/figure>\n<\/div>\n\n\n<p>on obtient l&#8217;image donn\u00e9e en pr\u00e9ambule de cet article.<\/p>\n\n\n\n<p>Retrouvez le programme complet ci-dessous pour les abonn\u00e9\u00b7e\u00b7s:<\/p>\n\n\n\n<div class=\"wp-block-file aligncenter um_article\"><a id=\"wp-block-file--media-f1e67dab-318a-4924-b07c-235add6a480c\" href=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite.zip\">suite<\/a><a href=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite.zip\" class=\"wp-block-file__button\" download aria-describedby=\"wp-block-file--media-f1e67dab-318a-4924-b07c-235add6a480c\">T\u00e9l\u00e9charger<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Comment construire simplement le graphe d&#8217;une suite d\u00e9finie par \\(u_{n+1}=f(u_n)\\) \u00e0 l&#8217;aide Python ? Mon objectif est de cr\u00e9er un programme Python qui demande \u00e0 la personne utilisatrice : la fonction; le premier terme de la suite; le nombre de termes \u00e0 construire; la fen\u00eatre \\( (x_{\\min}) \\), \\( (x_{\\max}) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[109,108],"class_list":["post-1230","post","type-post","status-publish","format-standard","hentry","category-mathematiques","category-python","tag-graphe","tag-suites"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Construire le graphe d&#039;une suite avec Python - Mathweb.fr<\/title>\n<meta name=\"description\" content=\"Construire le graphe d&#039;une suite \u00e0 l&#039;aide de Python, c&#039;est-\u00e0-dire construire ses premiers termes sur l&#039;axe des abscisses, est possible...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Construire le graphe d&#039;une suite avec Python - Mathweb.fr\" \/>\n<meta property=\"og:description\" content=\"Construire le graphe d&#039;une suite \u00e0 l&#039;aide de Python, c&#039;est-\u00e0-dire construire ses premiers termes sur l&#039;axe des abscisses, est possible...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Mathweb.fr\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-21T15:43:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-01T15:15:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite-300x238.png\" \/>\n<meta name=\"author\" content=\"St\u00e9phane Pasquet\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"St\u00e9phane Pasquet\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/\"},\"author\":{\"name\":\"St\u00e9phane Pasquet\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#\\\/schema\\\/person\\\/e4d3bb07968238378f0d5052a70dcd69\"},\"headline\":\"Construire le graphe d&#8217;une suite avec Python\",\"datePublished\":\"2019-05-21T15:43:32+00:00\",\"dateModified\":\"2022-10-01T15:15:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/\"},\"wordCount\":554,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#\\\/schema\\\/person\\\/e4d3bb07968238378f0d5052a70dcd69\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/suite-300x238.png\",\"keywords\":[\"graphe\",\"suites\"],\"articleSection\":[\"Math\u00e9matiques\",\"Python\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/\",\"url\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/\",\"name\":\"Construire le graphe d'une suite avec Python - Mathweb.fr\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/suite-300x238.png\",\"datePublished\":\"2019-05-21T15:43:32+00:00\",\"dateModified\":\"2022-10-01T15:15:16+00:00\",\"description\":\"Construire le graphe d'une suite \u00e0 l'aide de Python, c'est-\u00e0-dire construire ses premiers termes sur l'axe des abscisses, est possible...\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/suite.png\",\"contentUrl\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/suite.png\",\"width\":640,\"height\":507},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/2019\\\/05\\\/21\\\/construire-le-graphe-dune-suite-avec-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Construire le graphe d&rsquo;une suite avec Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#website\",\"url\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/\",\"name\":\"Mathweb.fr\",\"description\":\"Math\u00e9matiques, LaTeX et Python\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#\\\/schema\\\/person\\\/e4d3bb07968238378f0d5052a70dcd69\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/#\\\/schema\\\/person\\\/e4d3bb07968238378f0d5052a70dcd69\",\"name\":\"St\u00e9phane Pasquet\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-logo-mathweb.webp\",\"url\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-logo-mathweb.webp\",\"contentUrl\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-logo-mathweb.webp\",\"width\":74,\"height\":77,\"caption\":\"St\u00e9phane Pasquet\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.mathweb.fr\\\/euclide\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/cropped-logo-mathweb.webp\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Construire le graphe d'une suite avec Python - Mathweb.fr","description":"Construire le graphe d'une suite \u00e0 l'aide de Python, c'est-\u00e0-dire construire ses premiers termes sur l'axe des abscisses, est possible...","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/","og_locale":"fr_FR","og_type":"article","og_title":"Construire le graphe d'une suite avec Python - Mathweb.fr","og_description":"Construire le graphe d'une suite \u00e0 l'aide de Python, c'est-\u00e0-dire construire ses premiers termes sur l'axe des abscisses, est possible...","og_url":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/","og_site_name":"Mathweb.fr","article_published_time":"2019-05-21T15:43:32+00:00","article_modified_time":"2022-10-01T15:15:16+00:00","og_image":[{"url":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite-300x238.png","type":"","width":"","height":""}],"author":"St\u00e9phane Pasquet","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"St\u00e9phane Pasquet","Dur\u00e9e de lecture estim\u00e9e":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#article","isPartOf":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/"},"author":{"name":"St\u00e9phane Pasquet","@id":"https:\/\/www.mathweb.fr\/euclide\/#\/schema\/person\/e4d3bb07968238378f0d5052a70dcd69"},"headline":"Construire le graphe d&#8217;une suite avec Python","datePublished":"2019-05-21T15:43:32+00:00","dateModified":"2022-10-01T15:15:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/"},"wordCount":554,"commentCount":2,"publisher":{"@id":"https:\/\/www.mathweb.fr\/euclide\/#\/schema\/person\/e4d3bb07968238378f0d5052a70dcd69"},"image":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite-300x238.png","keywords":["graphe","suites"],"articleSection":["Math\u00e9matiques","Python"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/","url":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/","name":"Construire le graphe d'une suite avec Python - Mathweb.fr","isPartOf":{"@id":"https:\/\/www.mathweb.fr\/euclide\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#primaryimage"},"image":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite-300x238.png","datePublished":"2019-05-21T15:43:32+00:00","dateModified":"2022-10-01T15:15:16+00:00","description":"Construire le graphe d'une suite \u00e0 l'aide de Python, c'est-\u00e0-dire construire ses premiers termes sur l'axe des abscisses, est possible...","breadcrumb":{"@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#primaryimage","url":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite.png","contentUrl":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2019\/05\/suite.png","width":640,"height":507},{"@type":"BreadcrumbList","@id":"https:\/\/www.mathweb.fr\/euclide\/2019\/05\/21\/construire-le-graphe-dune-suite-avec-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.mathweb.fr\/euclide\/"},{"@type":"ListItem","position":2,"name":"Construire le graphe d&rsquo;une suite avec Python"}]},{"@type":"WebSite","@id":"https:\/\/www.mathweb.fr\/euclide\/#website","url":"https:\/\/www.mathweb.fr\/euclide\/","name":"Mathweb.fr","description":"Math\u00e9matiques, LaTeX et Python","publisher":{"@id":"https:\/\/www.mathweb.fr\/euclide\/#\/schema\/person\/e4d3bb07968238378f0d5052a70dcd69"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mathweb.fr\/euclide\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":["Person","Organization"],"@id":"https:\/\/www.mathweb.fr\/euclide\/#\/schema\/person\/e4d3bb07968238378f0d5052a70dcd69","name":"St\u00e9phane Pasquet","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2025\/06\/cropped-logo-mathweb.webp","url":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2025\/06\/cropped-logo-mathweb.webp","contentUrl":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2025\/06\/cropped-logo-mathweb.webp","width":74,"height":77,"caption":"St\u00e9phane Pasquet"},"logo":{"@id":"https:\/\/www.mathweb.fr\/euclide\/wp-content\/uploads\/2025\/06\/cropped-logo-mathweb.webp"}}]}},"_links":{"self":[{"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/posts\/1230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/comments?post=1230"}],"version-history":[{"count":0,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/posts\/1230\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/media?parent=1230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/categories?post=1230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mathweb.fr\/euclide\/wp-json\/wp\/v2\/tags?post=1230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}