\(TableaudeSignes[f_] := 
      Block[{i = 0}, 

 (*\ 
          recherche\ des\ racines\ du\ numérateur\ et\ élimination\ des\ racines\ complexes\ *) 
racnum\  = x /. {ToRules[Roots[Numerator[f[x]] == 0, x]]}; 
If[
          racnum == x, racnum = {}]; 
If[
          Length[racnum] ≠ 0, 
          racnum = 
            Select[racnum, Element[#, Reals] &]]; 
 (*\ 
          racnum\ est\ une\ liste\ *) 


 (*\ 
          recherche\ des\ racines\ du\ dénominateur\ et\ élimination\ des\ racines\ complexes\ *) 
racden\  = x /. {ToRules[Roots[Denominator[f[x]] == 0, x]]}; 
If[
          racden == x, racden = {}]; 
If[
          Length[racden] ≠ 0, 
          racden = 
            Select[racden, Element[#, Reals] &]]; 
 (*\ 
          racden\ est\ une\ liste\ *) 

 (*\ union\ des\ racines\ \ donne\ la\ liste\ des\ valeurs, \ 
          triées, \ à\ mettre\ dans\ le\ tableau\ *) 
valeurs = 
          Sort[Union[racnum, racden], 
            Less]; 


 (*\ crée\ la\ liste\ des\ signes\ *) 
listesignes = 
          Table[If[i == 1, 
              If[Length[valeurs] == 0, 
                If[Sign[f[0]] == 1, "+", "-"], 
                If[Sign[f[valeurs[\([i]\)] - 1]] == 
                    1, "+", "-"]], 


If[EvenQ[i], 
                lim = Limit[f[x], x -> valeurs[\([i/2]\)]]\ ; 
                If[MemberQ[racden, valeurs[\([i/2]\)]], "|", 
                  lim], 


If[
                  OddQ[i] ∧ i ≠ 1 ∧ 
                    i ≠ 
                      2*Length[valeurs] + 
                        1, 

If[
                    Sign[f[\((valeurs[\([\((i - 1)\)/2]\)] + 
                                valeurs[\([\((i + 1)\)/2]\)])\)/2]] == 
                      
                      1, "+", "-"], 

If[i == 2*Length[valeurs] + 1, 
                    If[Sign[f[valeurs[\([Length[valeurs]]\)] + 1]] == 
                        1, "+", "-"]
]
]
]
], {i, 
              2*Length[valeurs] + 
                1}]; 


 (*\ crée\ la\ liste\ des\ valeurs\ *) 

listevaleurs = 
          Table[
If[
              i == 1, "    ", 
If[EvenQ[i], 
                valeurs[\([i/2]\)], 
If[
                  OddQ[i] ∧ i ≠ 1 ∧ 
                    i ≠ 
                      2*Length[valeurs] + 
                        1, "    ", 
If[
                    i == 
                      2*Length[valeurs] + 
                        1, "    "]
]
]
], 
{i, 
              2*Length[valeurs] + 
                1}]; 


 (*\ rajoute\ x\ et\ f \((x)\)\ et\ affiche\ sous\ forme\ de\ tableau\ *) 
TableForm[{Join[{"x", "|"}, listevaleurs], 
            Join[{f[x], "|"}, listesignes]}, 
          TableAlignments -> Center]
]\)

Etude complète d'une fonction

a = 0; 
    While[a == 0, 
      a = Random[Integer, {-3, 3}]];
b = 0; 
    While[b == 0, 
      b = Random[Integer, {-5, 5}]];
c = 0; 
    While[c == 0, 
      c = Random[Integer, {-5, 5}]];
d = 0; 
    While[d == 
          0  ∨ (c < 0 ∧ 
            d < 0) ∨ (-d/c == -b/a), 
      d = Random[Integer, {-5, 5}]];
Clear[
        f];
f[
          x_] := (a*x + b)/(c*x + 
              d);
Print["f(x) = ", 
        f[x]];
av = -d/
          c;
Print["a) Dom f = \
ℝ \\ ", {av}];
Print["b) Limites et asymptotes"];
limd = Limit[f[x], x->av, Direction -> -1];
limg=Limit[f[x], x->av, Direction -> 1];
\(Print[
        StringForm[\*""\!\(lim\+\(x\( -> \+ > \)``\)\) f(x) = "", 
          av], limd];\)
\(Print[
        StringForm[\*""\!\(lim\+\(x\( -> \+ < \)``\)\) f(x) = "", 
          av], limg];\)
Print["AV ≡ x \
= ", av];
limplus = Limit[f[x], x->Infinity];
limmoins=Limit[f[x], x->-Infinity];
ah = 
        limplus;
\(Print[\*""(lim_(x -> +∞)) f(x) = "", \*""(lim_(x -> -∞)) f(x) = "", ah];\)

Print["AH ≡ y = ", ah];


Print["c) Etude de \
f"];
Print[TableaudeSignes[f]];




Print["d) \
Dérivée"];
df[x_] = 
      Simplify[D[f[x], x]]; 
    Print["f'(x) = ", df[x]];
Print[TableaudeSignes[df]];




Print["e) \
Dérivée seconde"];
ddf[x_] = Simplify[D[df[x], x]]; 
      Print["f\"(x) = ", ddf[x]];

Print[TableaudeSignes[ddf]];

Print["f) Graphe de \
f"];
Plot[{f[x], limplus}, {x,av - 3,av + 3},PlotRange -> {ah - 3, ah + 3},AspectRatio -> Automatic];