{"id":10282,"date":"2025-09-22T08:31:38","date_gmt":"2025-09-22T06:31:38","guid":{"rendered":"https:\/\/spgoo.org\/?page_id=10282"},"modified":"2025-09-22T08:31:39","modified_gmt":"2025-09-22T06:31:39","slug":"function-cout","status":"publish","type":"page","link":"https:\/\/spgoo.org\/?page_id=10282","title":{"rendered":"Function Cout"},"content":{"rendered":"<link rel=\"stylesheet\" href=\"https:\/\/cdn.jsdelivr.net\/npm\/jsxgraph\/distrib\/jsxgraph.css\">\r\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/jsxgraph@1.11.1\/distrib\/jsxgraphcore.js\"><\/script>\r\n<!-- MathJax -->\r\n<script>\r\nwindow.MathJax = {\r\n  tex: {\r\n    inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\r\n    displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ],\r\n    packages: ['base', 'ams']\r\n  },\r\n  options: {\r\n    ignoreHtmlClass: 'tex2jax_ignore',\r\n    processHtmlClass: 'tex2jax_process'\r\n  }\r\n};\r\n<\/script>  \r\n\r\n<script type=\"text\/javascript\" id=\"MathJax-script\"   src=\"https:\/\/cdn.jsdelivr.net\/npm\/mathjax@3\/es5\/tex-mml-chtml.js\"><\/script>\r\n<div style=\"margin:0px 0px 0px 100px;\">\r\n <div id=\"box1\" class=\"jxgbox\" style=\"width:800px; height:600px;\"><\/div>\r\n <div id=\"box2\" class=\"jxgbox\" style=\"width:800px; height:200px;\"><\/div>\r\n<\/div>\r\n<script type=\"text\/javascript\">\r\nJXG.Options.text.useMathJax = true;\t\r\n\r\nvar board = JXG.JSXGraph.initBoard(\"box1\", {pan: {enabled:false},boundingbox: [-1,240, 7,-60], axis:true,\r\nwithLines:false,\r\ndefaultAxes: {\r\n    x: { ticks: {visible: false} },\r\n    y: { ticks: {visible: false} }\r\n  },\r\nshowNavigation:false,showCopyright:false});\r\nvar board2 = JXG.JSXGraph.initBoard(\"box2\", {boundingbox: [-1, 1.33, 2, -2],visible:false, showNavigation:false,showCopyright:false});\r\n\r\nvar label_q = board.create('text',[6.9,-8,'$q$'], {fontSize: 10,strokeColor:'black',visible:true})\r\nvar label_C = board.create('text',[-.75,235,'$CT,cm,CM$'], {fontSize: 10,strokeColor:'black',visible:true})\r\n\r\n\/\/var btn=board.create(\"button\",[0.5,0.5],{id:\"btn1\"});\r\nboard.jc = new JXG.JessieCode();\r\nboard.jc.use(board);\r\nboard.renderer.container.style.backgroundColor='#E5E4E2';\r\nboard.dehighlightAll();\r\nboard.renderer.container.style.backgroundColor = '#E5E4E2';\r\nboard2.renderer.container.style.backgroundColor='#E5E4E2';\r\nboard2.dehighlightAll();\r\nboard2.renderer.container.style.backgroundColor = '#E5E4E2';\r\n\r\nvar checkbox0 = board.create('checkbox', [-0.5, -10, '']);\r\n\r\nJXG.addEvent(checkbox0.rendNodeCheckbox, 'change', function() {\r\n    if (this.Value()) {\r\n      document.getElementById(\"box2\").style.display=\"block\";\r\n    } else {\r\n      document.getElementById(\"box2\").style.display=\"none\"; \r\n    }\r\n}, checkbox0);\r\n\r\nboard.addChild(board2);\r\n\/\/ Board\r\n\r\n\tvar sl0 = board2.create('slider', [[-0.9, 1], [0.1, 1], [0, 0, 3]],{\r\n\t\tbaseline: { strokeColor: 'cadetblue'},\r\n\t\thighline: { strokeColor: '#AE181E'},\r\n\t\tfillColor: '#0061a8',\r\n\t\tstrokeColor: '#0061a8',\r\n\t\tlabel: {fontSize: 14, strokeColor: 'Black'},\r\n\t\tname: '$a$', \/\/ Not shown, if suffixLabel is set\r\n\t\tsuffixLabel: '$\\\\,\\\\,\\\\,a = \\\\, $',\r\n\t\t\/\/postLabel: ' u'\r\n\t});\r\n\tsl0.on('drag', updateVisibility);\r\n\r\n\r\nvar sl1 = board2.create('slider', [[-0.9, 0.5], [0.1, 0.5], [0, 0, 22]],{\r\nbaseline: { strokeColor: 'blue'},\r\nhighline: { strokeColor: '#AE181E'},\r\nfillColor: '#0061a8',\r\nstrokeColor: '#0061a8',\r\nlabel: {fontSize: 14, strokeColor: 'Black'},\r\nname: '$b$', \/\/ Not shown, if suffixLabel is set\r\nsuffixLabel: '$\\\\,\\\\,\\\\,b =  \\\\,$',\r\n\/\/postLabel: ' u'\r\n});\r\nsl1.on('drag', updateVisibility);\r\n\r\nvar sl2 = board2.create('slider', [[-0.9, 0], [0.1, 0.0], [0, 0, 70]],{\r\nbaseline: { strokeColor: 'blue'},\r\nhighline: { strokeColor: '#AE181E'},\r\nfillColor: '#0061a8',\r\nstrokeColor: '#0061a8',\r\nlabel: {fontSize: 14, strokeColor: 'Black'},\r\nname: '$c$', \/\/ Not shown, if suffixLabel is set\r\nsuffixLabel: '$\\\\,\\\\,\\\\,c = \\\\, $',\r\n\/\/postLabel: ' u'\r\n});\r\nsl2.on('drag', updateVisibility);\r\n\r\n\r\nvar sl3 = board2.create('slider', [[-0.9, -0.5], [0.1, -0.5], [0, 50, 100]],{\r\nbaseline: { strokeColor: 'cadetblue'},\r\nhighline: { strokeColor: '#AE181E'},\r\nfillColor: '#0061a8',\r\nstrokeColor: '#0061a8',\r\nlabel: {fontSize: 14, strokeColor: 'Black'},\r\nname: '$d$', \/\/ Not shown, if suffixLabel is set\r\nsuffixLabel: '$\\\\,\\\\,\\\\,d =  \\\\,$',\r\n\/\/postLabel: ' u'\r\n});\r\nsl3.on('drag', updateVisibility);\r\n\r\nvar f = (x) => sl0.Value()*x*x*x - sl1.Value()*x*x + sl2.Value()*x + sl3.Value();\r\nvar fp = (x) => 3*sl0.Value()*x*x - 2*sl1.Value()*x + sl2.Value();\r\nvar fpp = (x) => 6*sl0.Value()*x - 2*sl1.Value();\r\nvar fM = (x) => sl0.Value()*x*x - sl1.Value()*x + sl2.Value() + sl3.Value()\/x;\r\nvar graph1 = board.create('functiongraph',\r\n          [f, 0, 10],{setLabelText:\"$$C(q))$$\",strokeWidth:3,strokeColor:\"#34558b\",highlight:false,visible:false});\r\n\r\nvar graph2 = board.create('functiongraph',\r\n                       [fp, 0, 10],{name:\"$$C^{\\\\prime}(q))$$\",strokeWidth:3,strokeColor:\"#AE181E\",highlight:false,visible:false}\r\n                    );\r\n\r\nvar graph3 = board.create('functiongraph',\r\n                       [fM, 0, 10],{name:\"$$\\\\frac{C(q))}{q}$$\",strokeWidth:3,strokeColor:\"#019875\",highlight:false,visible:false}\r\n                    );    \r\n                    \r\nvar t0 = board.create('text', [0.5, 230, function(){\r\n            return '$$\\\\text{D\u00e9termination de la fonction d}^{\\\\tiny{\\\\prime}}\\\\text{offre du producteur en CPP}$$';}],\r\n            {fontSize: 20,strokeColor:'#AE181E',visible:true,highlight:false,fixed:true})\r\n\r\n\r\n\r\nvar t0s = board.create('text', [4.3, -15, function(){\r\n            return '$$CT=C(q)='+sl0.Value().toFixed(2)+ 'q^3 -'+sl1.Value().toFixed(2)+' q^2-'+sl2.Value().toFixed(2)+' q+'+sl3.Value().toFixed(2)+'$$';}],\r\n             {fontSize: 10,strokeColor:'#34558b',visible:true,highlight:false,fixed:true,visible:false})\r\n\r\n             \r\nvar t1s = board.create('text', [4.3, -30, function(){\r\n            return '$$cm=C^{\\\\prime}(q)= '+3*sl0.Value().toFixed(2)+' q^2 -'+2*sl1.Value().toFixed(2)+' q+'+sl2.Value().toFixed(2)+'$$';}],\r\n             {fontSize: 10,strokeColor:'#AE181E',visible:true,highlight:false,fixed:true,visible:false})             \r\nvar t2s = board.create('text', [4.3, -45, function(){\r\n            return '$$CM= \\\\frac{C(q)}{q}= '+sl0.Value().toFixed(2)+'q^2 +'+sl1.Value().toFixed(2)+' q -\\\\frac{'+sl2.Value().toFixed(2)+'}{q}$$';}],\r\n             {fontSize: 10,strokeColor:'#019875',visible:true,highlight:false,fixed:true,visible:false})                          \r\n\r\nvar tcb0 =board.create('text',[3.25, -15, '$$\\\\text{Co\u00fbt Total}$$'],{fontsize: 10,fixed:true})\r\nvar checkbox1 = board.create('checkbox', [4, -15, '']);\r\nvar inter = JXG.Math.Numerics.generalizedNewton(graph2,graph3,0,2)\r\nvar ct0 = board2.create('text',[-0.66, -1, '$$C(q) = a q^3 -b q^2 + c q + d$$'],{fontsize: 10,fixed:true})\r\n\r\nh=a => {\r\n\tfd= x => fp(x) - fM(x);\r\n\tvar x_fd = JXG.Math.Numerics.root(fd, a); \r\n\treturn x_fd;\r\n}\r\n\r\nvar mcM = board.create('point',[function() {return h(2.5);},function() {return fp(h(2.5));}],{name:\"\",strokeColor:\"#FDDA0D\",fillColor:\"#FDDA0D\",showInfobox: false});\r\nvar mcMx0 = board.create('point',[0,function() {return fp(h(2.5))}],{name:\"\",visible:false});\r\nvar mcMy0 = board.create('point',[function() {return h(2.5)},0],{name:\"\",visible:false});\r\nvar mcMs0 = board.create('segment',[mcMy0,mcM],{name:\"\",dash:2, highlight:false});\r\nvar mcMs1 = board.create('segment',[mcM,mcMx0],{name:\"\",dash:2, highlight:false});\r\nvar tm0 = board.create('text',[function(){return mcM.X();},-5,\"$$q^o_{min}$$\"],{name:\"\",dash:2,fontsize: 8,fixed:true,highlight:false});\r\nvar tm1 = board.create('text',[-.75,function(){return mcM.Y();},\"$$C^{\\\\prime}(q)=\\\\frac{C(q)}{q}$$\"],{name:\"\",dash:2,fontsize: 8,fixed:true,highlight:false});\r\n\r\nfunction updateVisibility() {\r\n  const a = sl0.Value();\r\n  const b = sl1.Value();\r\n  const c = sl2.Value();\r\n  const d = sl3.Value();\r\n\r\n  const allZero = (a === 0 && b === 0 && c === 0 && d === 0);\r\n\r\n  graph1.setAttribute({visible: !allZero});\r\n  graph2.setAttribute({visible: !allZero});\r\n  graph3.setAttribute({visible: !allZero});\r\n  t0s.setAttribute({visible: !allZero});\r\n  t1s.setAttribute({visible: !allZero});\r\n  t2s.setAttribute({visible: !allZero});\r\n  mcM.setAttribute({visible: !allZero});\r\n  mcMs0.setAttribute({visible: !allZero});\r\n  mcMs1.setAttribute({visible: !allZero});\r\n  mcMl0.setAttribute({visible: !allZero});\r\n  mcMl1.setAttribute({visible: !allZero});\r\n  tm0.setAttribute({visible: !allZero});\r\n  tm1.setAttribute({visible: !allZero});\r\n}\r\n\r\n\r\nJXG.addEvent(checkbox1.rendNodeCheckbox, 'change', function() {\r\n    if (this.Value()) {\r\n     graph1.setAttribute({visible:true}) ;\r\n     t0s.setAttribute({visible:true}) ;\r\n    } else {\r\n     graph1.setAttribute({visible:false});\r\n     t0s.setAttribute({visible:false})\r\n    }\r\n}, checkbox1);\r\n\r\nvar tcb1 =board.create('text',[3.25, -30, '$$\\\\text{Co\u00fbt Marginal}$$'],{fontsize: 10,fixed:true})\r\nvar checkbox2 = board.create('checkbox', [4, -30, '']);\r\n\r\nJXG.addEvent(checkbox2.rendNodeCheckbox, 'change', function() {\r\n    graph2.setAttribute({visible: this.Value()});\r\n    t1s.setAttribute({visible: this.Value()});\r\n    updateGraphDetailsVisibility();\r\n}, checkbox2);\r\n\r\nvar tcb1 =board.create('text',[3.25, -45, '$$\\\\text{Co\u00fbt Moyen}$$'],{fontsize: 10,fixed:true})\r\nvar checkbox3 = board.create('checkbox', [4, -45, '']);\r\n\r\nJXG.addEvent(checkbox3.rendNodeCheckbox, 'change', function() {\r\n    graph3.setAttribute({visible: this.Value()});\r\n    t2s.setAttribute({visible: this.Value()});\r\n    updateGraphDetailsVisibility();\r\n}, checkbox3);\r\n\r\n\r\nvar inter = JXG.Math.Numerics.generalizedNewton(graph2,graph3,0,2)\r\nvar ct0 = board2.create('text',[-0.66, -1, '$$C(q) = a q^3 -b q^2 + c q + d$$'],{fontsize: 10,fixed:true})\r\n\r\nh=a => {fd= x => fp(x) - fM(x)\r\n\tvar x_fd = JXG.Math.Numerics.root(fd, a); \r\n\treturn x_fd;\r\n}\r\n\r\n\/\/var mcM = board.create('point',[function() {return h(2.5);},function() {return fp(h(2.5));}],{name:\"\",fillColor:\"yellow\",strokeColor:\"yellow\"});\r\n\/\/var mcMx0 = board.create('point',[0,function() {return fp(h(2.5))}],{name:\"\",visible:false});\r\n\/\/var mcMy0 = board.create('point',[function() {return h(2.5);},0],{name:\"\",visible:false});\r\nvar mcMl0 = board.create('segment',[mcMy0,mcM],{name:\"\",dash:2,highlight:false});\r\nvar mcMl1 = board.create('segment',[mcM,mcMx0],{name:\"\",dash:2,highlight:false});\r\nvar graph5 = board.create('functiongraph',\r\n             [f, 0, 10],{strokeWidth:10,strokeColor:\"#34558b\",highlight:false,visible:false});\r\n\r\nfunction updateGraphDetailsVisibility() {\r\n  const showCM = checkbox2.Value(); \/\/ Co\u00fbt marginal\r\n  const showCMoyen = checkbox3.Value(); \/\/ Co\u00fbt moyen\r\n\r\n  \/\/ Lignes et labels li\u00e9s au co\u00fbt marginal\r\n  mcMs0.setAttribute({visible: showCM});\r\n  mcMs1.setAttribute({visible: showCM});\r\n  tm0.setAttribute({visible: showCM});\r\n\r\n  \/\/ Lignes et labels li\u00e9s au co\u00fbt moyen\r\n  mcMl0.setAttribute({visible: showCMoyen});\r\n  mcMl1.setAttribute({visible: showCMoyen});\r\n  tm1.setAttribute({visible: showCMoyen});\r\n\r\n  \/\/ Le point d'intersection n'appara\u00eet que si au moins une des deux courbes est visible\r\n  mcM.setAttribute({visible: showCM || showCMoyen});\r\n}\r\n\r\ngraph1.createLabel(\"$$C(q)$$\")\r\ndocument.getElementById(\"box2\").style.display=\"none\" ;\r\n\r\nboard2.addChild(board);\r\n\/\/updateVisibility();\r\nupdateGraphDetailsVisibility();\r\n\r\n<\/script>\r\n\r\n\r\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-10282","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages\/10282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spgoo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10282"}],"version-history":[{"count":1,"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages\/10282\/revisions"}],"predecessor-version":[{"id":10283,"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages\/10282\/revisions\/10283"}],"wp:attachment":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}