{"id":31,"date":"2025-09-07T18:41:44","date_gmt":"2025-09-07T16:41:44","guid":{"rendered":"https:\/\/yb-isn.fr\/2025\/nsi\/?p=31"},"modified":"2025-09-11T09:03:48","modified_gmt":"2025-09-11T07:03:48","slug":"2-operations-mathematiques","status":"publish","type":"post","link":"https:\/\/yb-isn.fr\/2025\/nsi\/2025\/09\/07\/2-operations-mathematiques\/","title":{"rendered":"2-Op\u00e9rations math\u00e9matiques"},"content":{"rendered":"\n<marquee>corrig\u00e9s disponibles<\/marquee>\n\n\n<p><!--more--><\/p>\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/capytale2.ac-paris.fr\/web\/c\/7669-3848492\">https:\/\/capytale2.ac-paris.fr\/web\/c\/7669-3848492<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2024\/nsi\/wp-content\/uploads\/2024\/08\/image-4-1024x517.png\" alt=\"\" class=\"wp-image-118\" style=\"width:426px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"has-black-color has-text-color has-background has-link-color wp-elements-635d3f4e392e5846b259d78947614143 wp-block-paragraph\" style=\"background:linear-gradient(135deg,rgb(216,244,179) 0%,rgb(17,184,81) 100%)\"><strong>1-) Op\u00e9rations math\u00e9matiques de base<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-fd090ebe\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f op\u00e9rateurs \u00e0 tester<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tester les 7 op\u00e9rateurs suivants dans la console de Thonny: et donner un nom \u00e0 l&rsquo;op\u00e9ration effectu\u00e9e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">+ <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> \u2013 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> *<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">**<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> \/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\/\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">%<\/p>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-black-color has-text-color has-background has-link-color wp-elements-5787c54633b73e10d5e53dc34f8a1b30 wp-block-paragraph\" style=\"background:linear-gradient(135deg,rgb(216,244,179) 0%,rgb(17,184,81) 100%)\"><strong>2-) Fonctions math\u00e9matiques de base<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Un exemple : le logarithme d\u00e9cimal<\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-b6472432\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f code \u00e0 tester dans thonny<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import math\na=math.log10(100)\nprint(a)<\/pre>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">On peut modifier le programme en rempla\u00e7ant math par l&rsquo;alias m<\/p>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-5bfd3d37\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0f code \u00e0 tester dans thonny<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import math as m\na=m.log10(100)\nprint(a)<\/pre>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Vous trouverez ci dessous toutes les autres fonctions math\u00e9matiques usuelles.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.python.org\/fr\/3.5\/library\/math.html\">https:\/\/docs.python.org\/fr\/3.5\/library\/math.html<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Remarque : La librairie math est pr\u00e9install\u00e9e il suffit de l&rsquo;importer dans votre programme avec l&rsquo;instruction <code>import<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Lorsque la librairie n&rsquo;est pas pr\u00e9sente dans dans votre \u00e9diteur vous obtiendrez un message d&rsquo;erreur \u00e0 l&rsquo;ex\u00e9cution dans la console .<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Exemple :erreur dans le nom de la librairie maths au lieu de math<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/python\/wp-content\/uploads\/2023\/06\/image-5-1024x157.png\" alt=\"\" class=\"wp-image-243\" style=\"width:600px;height:92px\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Si la librairie existe et n&rsquo;a pas \u00e9t\u00e9 install\u00e9e , il suffit d&rsquo;aller dans le menu outils-&gt;g\u00e9rer les paquets pour la rechercher et l&rsquo;installer<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/python\/wp-content\/uploads\/2023\/06\/image-6.png\" alt=\"\" class=\"wp-image-246\" style=\"width:422px;height:172px\"\/><\/figure>\n\n\n\n<div class=\"wp-block-esab-accordion accordion-194443ad\" data-mode=\"global\"><div class=\"esab__container\">\n<div class=\"wp-block-esab-accordion-child\"><div class=\"esab__head\" role=\"button\" aria-expanded=\"false\"><div class=\"esab__heading_txt\"><p class=\"esab__heading_tag\">\ud83c\udfcb\ufe0ftester le code ci-dessous et installer les librairies manquantes si n\u00e9cessaire<\/p><\/div><div class=\"esab__icon\"><div class=\"esab__collapse\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m3.5 20.5c-4.7-4.7-4.7-12.3 0-17 4.7-4.7 12.3-4.7 17 0 4.6 4.7 4.6 12.3 0 17-4.7 4.6-12.3 4.6-17 0zm0.9-0.9c4.2 4.2 11 4.2 15.2 0 4.2-4.2 4.2-11 0-15.2-4.2-4.3-11-4.3-15.2 0-4.3 4.2-4.3 11 0 15.2z\"><\/path><path d=\"m11.4 15.9v-3.3h-3.3c-0.3 0-0.6-0.3-0.6-0.6 0-0.4 0.3-0.6 0.6-0.6h3.3v-3.3c0-0.3 0.3-0.6 0.6-0.6 0.3 0 0.6 0.3 0.6 0.6v3.3h3.3c0.3 0 0.6 0.2 0.6 0.6q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2h-3.3v3.3q0 0.2-0.2 0.4-0.2 0.2-0.4 0.2c-0.4 0-0.6-0.3-0.6-0.6z\"><\/path><\/svg> <\/div><div class=\"esab__expand\"> <svg version=\"1.2\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"m12 24c-6.6 0-12-5.4-12-12 0-6.6 5.4-12 12-12 6.6 0 12 5.4 12 12 0 6.6-5.4 12-12 12zm10.6-12c0-5.9-4.7-10.6-10.6-10.6-5.9 0-10.6 4.7-10.6 10.6 0 5.9 4.7 10.6 10.6 10.6 5.9 0 10.6-4.7 10.6-10.6z\"><\/path><path d=\"m5.6 11.3h12.8v1.4h-12.8z\"><\/path><\/svg> <\/div><\/div><\/div><div class=\"esab__body\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import matplotlib.pyplot as plt  # Module pour tracer les graphiques\nimport numpy as np\n\n# Tableau de 50 valeurs comprises entre 0 et 9\nvaleurs = np.random.randint(0, 10, 50)\n# Tableau de 50 valeurs comprises entre 0 et 9\nvaleurs2 = np.random.randint(0, 10, 50)\n# Cr\u00e9ation d'un tableau avec les intervalles centr\u00e9s sur la valeur enti\u00e8re\ninter = np.linspace(-0.5, 9.5, 11)\n\nplt.hist([valeurs, valeurs2], bins=inter, rwidth=0.8, stacked=True,\n         label=['Valeurs 1', 'Valeurs 2'])  # Cr\u00e9ation de l'histogramme\nplt.xlabel('Valeurs')\nplt.xticks(np.arange(0, 10))\nplt.ylabel('Nombres')\nplt.title(\"Histogramme\")\nplt.legend()\nplt.grid()\nplt.show()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Vous devez obtenir ce r\u00e9sultat<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2023\/nsi\/wp-content\/uploads\/2023\/09\/Figure_1.png\" alt=\"\" class=\"wp-image-151\" style=\"width:421px;height:316px\"\/><\/figure>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p class=\"has-black-color has-text-color has-background has-link-color wp-elements-5c9bc5ff719c19d1fe8d28756177ad58 wp-block-paragraph\" style=\"background:linear-gradient(135deg,rgb(216,244,179) 0%,rgb(17,184,81) 100%)\"><strong>3-) Exercices<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/capytale2.ac-paris.fr\/web\/c\/3cbe-3848576\">https:\/\/capytale2.ac-paris.fr\/web\/c\/3cbe-3848576<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/yb-isn.fr\/2024\/nsi\/wp-content\/uploads\/2024\/09\/image.png\" alt=\"\" class=\"wp-image-85\" style=\"width:156px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>corrig\u00e9s disponibles<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"_links":{"self":[{"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":6,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":46,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/posts\/31\/revisions\/46"}],"wp:attachment":[{"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yb-isn.fr\/2025\/nsi\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}