2015-02-08 16:04:05 +00:00
|
|
|
\documentclass[a4paper,10pt]{article}
|
|
|
|
\RequirePackage[utf8x]{inputenc}
|
|
|
|
\RequirePackage[francais]{babel}
|
|
|
|
\RequirePackage{amssymb}
|
|
|
|
\RequirePackage{amsmath}
|
|
|
|
\RequirePackage{amsfonts}
|
|
|
|
\RequirePackage{subfig}
|
|
|
|
\RequirePackage{graphicx}
|
|
|
|
\RequirePackage{color}
|
2014-08-29 12:33:04 +00:00
|
|
|
|
|
|
|
% Title Page
|
2015-02-08 16:04:05 +00:00
|
|
|
\title{Calcul littéral et statistiques}
|
|
|
|
\date{\today}
|
2014-08-29 12:33:04 +00:00
|
|
|
|
|
|
|
\begin{document}
|
|
|
|
\maketitle
|
|
|
|
|
2015-02-08 16:04:05 +00:00
|
|
|
|
|
|
|
\section{Polynômes}
|
|
|
|
|
|
|
|
|
|
|
|
\Block{set P = Polynom.random(["{a}", "{b}", "{c}"], ["{b}**2 - 4*{a}*{c} == 0"])}
|
2015-01-06 08:22:52 +00:00
|
|
|
Résoudre l'équation suivante
|
|
|
|
\begin{eqnarray*}
|
|
|
|
\Var{P} & = & 0
|
|
|
|
\end{eqnarray*}
|
|
|
|
|
|
|
|
Solution:
|
|
|
|
|
|
|
|
On commence par calculer le discriminant
|
2015-02-08 16:04:05 +00:00
|
|
|
\Block{set Delta = Expression("{b}^2 - 4*{a}*{c}".format(a = P._coef[2], b = P._coef[1], c = P._coef[0]))}
|
2015-01-06 08:22:52 +00:00
|
|
|
\begin{eqnarray*}
|
2015-02-08 16:04:05 +00:00
|
|
|
\Delta & = & b^2-4ac \\
|
|
|
|
\Var{Delta.simplify()|calculus(name="\\Delta")}
|
2015-01-06 08:22:52 +00:00
|
|
|
\end{eqnarray*}
|
|
|
|
\Block{set Delta = Delta.simplified()}
|
2015-02-08 16:04:05 +00:00
|
|
|
|
|
|
|
\Block{if Delta > 0}
|
|
|
|
Alors $\Delta = \Var{Delta} > 0$ donc il y a deux solutions
|
|
|
|
|
|
|
|
\Block{set x1 = (-P._coef[1] - sqrt(Delta))/(2*P._coef[2])}
|
|
|
|
\Block{set x2 = (-P._coef[1] + sqrt(Delta))/(2*P._coef[2])}
|
|
|
|
|
|
|
|
\begin{eqnarray*}
|
|
|
|
x_1 & = & \frac{-b - \sqrt{\Delta}}{2a} = \frac{\Var{-P._coef[1]} - \sqrt{\Var{Delta}}}{2 \times \Var{P._coef[2]}} = \Var{x1 | round(2)} \\
|
|
|
|
x_2 & = & \frac{-b + \sqrt{\Delta}}{2a} = \frac{\Var{-P._coef[1]} + \sqrt{\Var{Delta}}}{2 \times \Var{P._coef[2]}} = \Var{x2 | round(2)}
|
|
|
|
\end{eqnarray*}
|
|
|
|
|
|
|
|
Les solutions sont donc $\mathcal{S} = \left\{ \Var{x1|round(2)}; \Var{x2|round(2)} \right\}$
|
|
|
|
|
|
|
|
\Block{elif Delta == 0}
|
|
|
|
Alors $\Delta = \Var{Delta} = 0$ donc il y a une solution
|
|
|
|
|
|
|
|
\Block{set x1 = Expression("-{b}/(2*{a})".format(b = P._coef[1], a = P._coef[2]))}
|
|
|
|
|
|
|
|
\begin{eqnarray*}
|
|
|
|
x_1 = \frac{-b}{2a} = \Var{" = ".join(x1.simplify())}
|
|
|
|
\end{eqnarray*}
|
|
|
|
|
|
|
|
Les solutions sont donc $\mathcal{S} = \left\{ \Var{x1.simplified()}\right\}$
|
|
|
|
|
|
|
|
\Block{else}
|
|
|
|
Alors $\Delta = \Var{Delta} < 0$ donc il n'y a pas de solution.
|
|
|
|
|
|
|
|
\Block{endif}
|
|
|
|
|
|
|
|
\bigskip
|
|
|
|
~\dotfill
|
|
|
|
\bigskip
|
|
|
|
|
2015-01-06 08:22:52 +00:00
|
|
|
|
2015-02-08 16:04:05 +00:00
|
|
|
\Block{set P = Polynom.random(["{a}", "{b}", "{c}"])}
|
|
|
|
\Block{set Q = Polynom.random(["{a}", "{b}", "{c}"])}
|
|
|
|
Résoudre l'équation suivante
|
|
|
|
\begin{eqnarray*}
|
|
|
|
\Var{P} & = & \Var{Q}
|
|
|
|
\end{eqnarray*}
|
|
|
|
|
|
|
|
Solution:
|
|
|
|
|
|
|
|
On commence par se ramener à une équation de la forme $ax^2+bx+c = 0$.
|
|
|
|
|
|
|
|
\begin{eqnarray*}
|
|
|
|
\Var{P} = \Var{Q} & \Leftrightarrow & \Var{P} - (\Var{Q}) = 0 \\
|
|
|
|
\Var{(P - Q)|calculus(name = "", sep = "\\Leftrightarrow", end = "= 0")}
|
|
|
|
\end{eqnarray*}
|
|
|
|
|
|
|
|
\Block{set R = (P-Q)[-1]}
|
|
|
|
On cherche maintenant à résoudre l'équation $\Var{R} = 0$.
|
2015-01-06 08:22:52 +00:00
|
|
|
|
2015-02-08 16:04:05 +00:00
|
|
|
On commence par calculer le discriminant
|
|
|
|
\Block{set Delta = Expression("{b}^2 - 4*{a}*{c}".format(a = R._coef[2], b = R._coef[1], c = R._coef[0]))}
|
|
|
|
\begin{eqnarray*}
|
|
|
|
\Delta & = & b^2-4ac \\
|
|
|
|
\Var{Delta.simplify()|calculus(name="\\Delta")}
|
|
|
|
\end{eqnarray*}
|
|
|
|
\Block{set Delta = Delta.simplified()}
|
|
|
|
|
|
|
|
\Block{if Delta > 0}
|
|
|
|
Alors $\Delta = \Var{Delta} > 0$ donc il y a deux solutions
|
|
|
|
|
|
|
|
\Block{set x1 = (-R._coef[1] - sqrt(Delta))/(2*R._coef[2])}
|
|
|
|
\Block{set x2 = (-R._coef[1] + sqrt(Delta))/(2*R._coef[2])}
|
|
|
|
|
|
|
|
\begin{eqnarray*}
|
|
|
|
x_1 & = & \frac{-b - \sqrt{\Delta}}{2a} = \frac{\Var{-R._coef[1]} - \sqrt{\Var{Delta}}}{2 \times \Var{R._coef[2]}} = \Var{x1 | round(2)} \\
|
|
|
|
x_2 & = & \frac{-b + \sqrt{\Delta}}{2a} = \frac{\Var{-R._coef[1]} + \sqrt{\Var{Delta}}}{2 \times \Var{R._coef[2]}} = \Var{x2 | round(2)}
|
|
|
|
\end{eqnarray*}
|
|
|
|
|
|
|
|
Les solutions sont donc $\mathcal{S} = \left\{ \Var{x1|round(2)}; \Var{x2|round(2)} \right\}$
|
|
|
|
|
|
|
|
\Block{elif Delta == 0}
|
|
|
|
Alors $\Delta = \Var{Delta} = 0$ donc il y a une solution
|
|
|
|
|
|
|
|
\Block{set x1 = Expression("-{b}/(2*{a})".format(b = R._coef[1], a = R._coef[2]))}
|
|
|
|
|
|
|
|
\begin{eqnarray*}
|
|
|
|
x_1 = \frac{-b}{2a} = \Var{" = ".join(x1.simplify())}
|
|
|
|
\end{eqnarray*}
|
|
|
|
|
|
|
|
Les solutions sont donc $\mathcal{S} = \left\{ \Var{x1.simplified()}\right\}$
|
|
|
|
|
|
|
|
\Block{else}
|
|
|
|
Alors $\Delta = \Var{Delta} < 0$ donc il n'y a pas de solution.
|
|
|
|
|
|
|
|
\Block{endif}
|
2015-01-06 08:22:52 +00:00
|
|
|
|
2014-08-29 12:33:04 +00:00
|
|
|
|
|
|
|
\end{document}
|
|
|
|
|
|
|
|
%%% Local Variables:
|
|
|
|
%%% mode: latex
|
|
|
|
%%% TeX-master: "master"
|
|
|
|
%%% End:
|
|
|
|
|
2014-11-21 16:20:04 +00:00
|
|
|
|