From ac75f99d261ecebe9a6bef9b13216685410baa91 Mon Sep 17 00:00:00 2001 From: Lafrite Date: Thu, 23 Apr 2015 15:31:09 +0200 Subject: [PATCH] start creating macros --- macros/poly2Deg.tex | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 macros/poly2Deg.tex diff --git a/macros/poly2Deg.tex b/macros/poly2Deg.tex new file mode 100644 index 0000000..5c667e6 --- /dev/null +++ b/macros/poly2Deg.tex @@ -0,0 +1,33 @@ +\Block{macro solveEquation(P)} + + On commence par calculer le discriminant de $P(x) = \Var{P}$. + \begin{eqnarray*} + \Delta & = & b^2-4ac \\ + \Var{P.delta.explain()|calculus(name="\\Delta")} + \end{eqnarray*} + + \Block{if P.delta > 0} + comme $\Delta = \Var{P.delta} > 0$ donc $P$ a deux racines + + \begin{eqnarray*} + x_1 & = & \frac{-b - \sqrt{\Delta}}{2a} = \frac{\Var{-P.b} - \sqrt{\Var{P.delta}}}{2 \times \Var{P.a}} = \Var{P.roots()[0] } \\ + x_2 & = & \frac{-b + \sqrt{\Delta}}{2a} = \frac{\Var{-P.b} + \sqrt{\Var{P.delta}}}{2 \times \Var{P.a}} = \Var{P.roots()[1] } + \end{eqnarray*} + + Les solutions de l'équation $\Var{P} = 0$ sont donc $\mathcal{S} = \left\{ \Var{P.roots()[0]}; \Var{P.roots()[1]} \right\}$ + + \Block{elif P.delta == 0} + Comme $\Delta = 0$ donc $P$ a une racine + + \begin{eqnarray*} + x_1 = \frac{-b}{2a} = \frac{-\Var{P.b}}{2\times \Var{P.a}} = \Var{P.roots()[0]} \\ + \end{eqnarray*} + + La solution de $\Var{P} = 0$ est donc $\mathcal{S} = \left\{ \Var{P.roots()[0]}\right\}$ + + \Block{else} + Alors $\Delta = \Var{P.delta} < 0$ donc $P$ n'a pas de racine donc l'équation $\Var{P} = 0$ n'a pas de solution. + + \Block{endif} + +\Block{endmacro}