IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Mathématiques Discussion :

résolution de polynôme du 3ème degrés , erreur ?


Sujet :

Mathématiques

  1. #1
    Inactif  

    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3 064
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3 064
    Points : 4 605
    Points
    4 605
    Par défaut résolution de polynôme du 3ème degrés , erreur ?
    Hello

    Je recherche les racines du polynôme suivant :

    (-x^3) + (22*x^2) - (136*x) - (2560/27)

    Problème je dois trouver des valeurs entières (c'est à dire si x était égal à 0,333 ... je doit mettre 1/3 etc ... )

    Merci de me tuyauter

  2. #2
    Membre expert
    Avatar de kwariz
    Homme Profil pro
    Chef de projet en SSII
    Inscrit en
    Octobre 2011
    Messages
    898
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Chef de projet en SSII
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2011
    Messages : 898
    Points : 3 352
    Points
    3 352
    Par défaut
    Bonjour,

    wolfram donne 1 solution réelle (non rationelle) et deux solutions imaginaires.

  3. #3
    Membre éclairé
    Inscrit en
    Juin 2005
    Messages
    644
    Détails du profil
    Informations professionnelles :
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2005
    Messages : 644
    Points : 754
    Points
    754
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
     
    unit Unit1;
     
    interface
     
    uses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, Buttons, ExtCtrls, OleCtrls, ToolWin, ComCtrls, TeEngine,
      Series, TeeProcs, Chart, BubbleCh;
     
    type
      TForm1 = class(TForm)
        BitBtn1: TBitBtn;
        BitBtn2: TBitBtn;
        dg: TRadioGroup;
        Panel1: TPanel;
        GroupBox1: TGroupBox;
        A0: TPanel;
        A1: TPanel;
        A2: TPanel;
        A3: TPanel;
        A4: TPanel;
        Timer1: TTimer;
        edit0: TEdit;
        Edit2: TEdit;
        Edit3: TEdit;
        Edit1: TEdit;
        Edit4: TEdit;
        Panel2: TPanel;
        GroupBox2: TGroupBox;
        Panel3: TPanel;
        S1: TPanel;
        S2: TPanel;
        S3: TPanel;
        S4: TPanel;
        Edit5: TEdit;
        Edit6: TEdit;
        Edit7: TEdit;
        Edit8: TEdit;
        Edit9: TEdit;
        Memo1: TMemo;
        Courbe: TGroupBox;
        Shape1: TShape;
        Chart1: TChart;
        Series1: TLineSeries;
        Series2: TLineSeries;
        Series3: TPointSeries;
        Panel4: TPanel;
        Panel5: TPanel;
        procedure BitBtn1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure dgClick(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
        procedure BitBtn2Click(Sender: TObject);
      private
        { Déclarations privées }
      public
        { Déclarations publiques }
      end;
     
    var
      Form1: TForm1;
     
    implementation
     
    {$R *.DFM}
     
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
    application.terminate
    end;
     
    procedure edtv( sender : Tobject);
    begin
    with Form1 do
    begin
    edit0.visible:=A0.visible;
    edit1.visible:=A1.visible;
    edit2.visible:=A2.visible;
    edit3.visible:=A3.visible;
    edit4.visible:=A4.visible;
    S1.visible:=A1.Visible;
    S2.visible:=A2.Visible;
    S3.visible:=A3.Visible;
    S4.visible:=A4.Visible;     
    edit6.visible:=A1.Visible;
    edit7.visible:=A2.Visible;
    edit8.visible:=A3.Visible;
    edit9.visible:=A4.Visible;
    end
    end;
    function strx( f : single; i,j : byte) : string;
    var t : string;
       begin
       str(f:i:j,t);
       strx:=t;
       end;
    function istx( b : byte) : string;
    var t : string;
       begin
       str(b,t);
       istx:=t;
       end;
     
    procedure no_ans( sender : Tobject);
    begin
    with Form1 do
    begin
     
    edit5.text:='----';
    edit6.text:='----';
    edit7.text:='----';
    edit8.text:='----';
    edit9.text:='----';
    end
    end;
    const epsilon = 1e-15;
    function ArcSin(x : extended): extended;
       begin
       if (x > 1-epsilon ) then
          arcsin :=pi/2
       else
       if (  x < -1+epsilon ) then
          arcsin:=-pi/2
       else
          arcsin:= ArcTan (x/sqrt (1-sqr (x)))
       end;
    function Arccos( x : extended) : extended;
       begin
       if   (        abs(x) < epsilon ) then
          arccos := pi/2
       else
       if ( x > 0 ) then
          ArcCos := ArcTan (sqrt (1-sqr (x)) /x)
       else
          ArcCos:=pi -  ArcTan (sqrt (1 + sqr (x)) /x)
       end;
    type s04 = array[0..4] of extended;
    type sl  = record
               def : boolean;
               val : extended;
               end;
    type       sl4 = array[1..4] of sl;
    var a                   : extended;
        _a                  :       s04;
        sol                 :       sl4;
        deg,
        status              : integer;
        str1                : string;
    procedure mst;
    var c : byte;
       begin
       form1.memo1.lines.clear;
       for c:=1 to 4 do sol[c].def:=false;
       end;
    procedure TForm1.FormCreate(Sender: TObject);
     
    begin
    caption:='              RACINES    D '' UNE       EQUATION     DE    DEGRÉ     1  A  4';
    align:=alclient;
    panel4.visible:=false;
     
    series1.clear;
    series2.clear;
    series3.Clear;
     
    mst;
    dg.itemindex:=0;
    A0.visible:=true;
    A1.visible:=true;
    A2.visible:=false;
    A3.visible:=false;
    A4.Visible:=false;
     
    edit0.text:='';
    edit1.text:='';
    edit2.text:='';
    edit3.text:='';
    edit4.text:='';
     
    no_ans(sender);
     
    edtv(sender);
    end;
     
    procedure TForm1.dgClick(Sender: TObject);
    begin
    timer1.enabled:=true;
    end;
     
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
    timer1.enabled:=false;
    case dg.itemindex of
         0   :    begin
                  A2.visible:=false;
                  A3.visible:=false;
                  A4.visible:=false;
                  end;
         1   :    begin
                  A2.visible:=true;
                  A3.visible:=false;
                  A4.visible:=false;
                  end;
         2   :    begin
                  A2.visible:=true;
                  A3.visible:=true;
                  A4.visible:=false;
                  end;
         3   :    begin
                  A2.visible:=true;
                  A3.visible:=true;
                  A4.visible:=true;
                  end;
                  end;
    edtv(sender);
    end;
    function poly ( _a : s04 ; deg : integer; f : extended) : extended;
    var r,y : extended; j : integer;
       begin
       r:=f;
       y:=_a[0];
       for j:=1 to deg do
          begin
          y:=y + _a[j]*r;
          r:=r*f;
          end;
       poly:=y;
       end;
    procedure poly_1 ( _a : s04);
       begin
       sol[1].def:=true;
       sol[1].val:=-_a[0]/_a[1];
       str(poly(_a,1,sol[1].val),str1);
       form1.memo1.lines.add(str1);
       end;
    procedure poly_2(_a : s04);
    var d : extended;
       begin
       d:=sqr(_a[1])-4*_a[0]*_a[2];
       if d < 0 then
          exit;
       if (d=0) then
          begin
           sol[1].def:=true;
           sol[1].val:=-_a[1]/(2*_a[2]);
           str(poly(_a,2,sol[1].val),str1);
           form1.memo1.lines.add(str1);
           exit;
          end;
       d:=sqrt(d);
       sol[1].def:=true;
       sol[1].val:=(-_a[1]+d)/(2*_a[2]);
       sol[2].def:=true;
       sol[2].val:=(-_a[1]-d)/(2*_a[2]);
       str(poly(_a,2,sol[1].val),str1);
       form1.memo1.lines.add(str1);
       str(poly(_a,2,sol[2].val),str1);
       form1.memo1.lines.add(str1);
       end;
    function sh(x : extended) : extended;
       begin
       sh := (exp(x)-exp(-x))/2;
       end;
    function ch(x : extended) : extended;
       begin
       ch := (exp(x)+exp(-x))/2;
       end;
    procedure poly_3(_a  : s04; m : boolean);
    var a,b,c,lambda3,p,q,alpha,v,xi : extended;
       begin
       {
       p = b - (1/3)*a^2 et
       q = (2/27)*a^3 - (1/3)*a*b + c
       }
       a:= _a[2]/_a[3];
       b:=_a[1]/_a[3];
       c:=_a[0]/_a[3];
       { x^3 + a x^2 + b x + c = 0 }
       lambda3:=-a/3;
       p:=b-sqr(a)/3;
       q:=2/27*a*sqr(a) - a*b/3 + c;
       if ( p = 0) then       { Z^3 = -q }
          begin
          sol[1].def:=true;
          if   (q=0) then
               sol[1].val:=0;
          if   (q < 0) then
             sol[1].val:=exp(ln(-q)/3)+lambda3;
          if (q > 0) then
             sol[1].val:=-exp(ln(q)/3)+lambda3;
          str(poly(_a,3,sol[1].val),str1);
          form1.memo1.lines.add(str1);
          end
       else   { p <> 0    Z^3 + pZ = -q }
          begin
          if   ( p > 0) then { sh(3t) = 4sh(t)^3 + 3 sh(t) }
             begin
             alpha:=sqrt(4*p/3);
             v:=-3*q/(p*alpha);     { 4Z^3 + 3Z = v }
             v:=ln(v+sqrt(1 + v*v))/3;  {recipoque sh }
             sol[1].def:=true;
             sol[1].val:=alpha*sh(v)+lambda3;
             str(poly(_a,3,sol[1].val),str1);
             form1.memo1.lines.add(str1);
             form1.panel4.caption:='P>0 SH';
             end
          else { p < 0 }
             begin
             alpha:=sqrt(-4*p/3);
             v:=3*q/p/alpha;      { 4Z^3 - 3Z = -V }
             if              (   abs(v) <=1 ) then
                begin            { cos(3t) = 4 cos(t)^3 - 3 cos(t) }
                str(v,str1);
                form1.panel4.caption:='P<0 COS   V = ' + str1;
                v:=arccos(v)/3;
                for status:=1 to 3 do
                   begin
                   sol[status].def:=true;
                   sol[status].val:=alpha*cos(v+2*pi*status/3)+lambda3;
                   str(poly(_a,3,sol[status].val),str1);
                   form1.memo1.lines.add(str1)
                   end
                end
             else
             if  (v > 1) then                 { Z=ch(3t) = 4ch(t)^3 - 3 ch(t)  }
                begin
                form1.panel4.caption:='P<0 CH';
                v:=ln(v+sqrt(v*v-1));         { reciproque ch }
                sol[1].def:=true;
                sol[1].val:=alpha*ch(v/3)+lambda3;
                if m then
                   begin
                   str(poly(_a,3,sol[1].val),str1);
                   form1.memo1.lines.add(str1)
                   end
                end
             else   { v < -1   Z=-ch(t)}
                begin
                form1.panel4.caption:='P<0 -CH';
                v:=ln(-v+sqrt(v*v-1)); { reciproque de -ch(t) }
                sol[1].def:=true;
                sol[1].val:=-alpha*ch(v/3)+lambda3;
                if m then
                   begin
                   str(poly(_a,3,sol[1].val),str1);
                   form1.memo1.lines.add(str1)
                   end
                end
             end
          end
       end;
    procedure More(var U2,lambda4 : extended; var ns : integer);
       begin
       if (U2 =0) then
          begin
          inc(ns);
          sol[ns].def:=true;
          sol[ns].val:=lambda4;
          str(poly(_a,4,sol[ns].val),str1);
          form1.memo1.lines.add(str1);
          end
       else
       if ( U2 > 0 ) then
          begin
          U2:=sqrt(U2);
          inc(ns);
          sol[ns].def:=true;
          sol[ns].val:=U2+lambda4;
          str(poly(_a,4,sol[ns].val),str1);
          form1.memo1.lines.add(str1);
          inc(ns);
          sol[ns].def:=true;
          sol[ns].val:=-U2+lambda4;
          str(poly(_a,4,sol[ns].val),str1);
          form1.memo1.lines.add(str1);
          end;
       end;
    procedure bi_carre_D_Pos(var p,det,U2,lambda4 : extended; var ns : integer);
       begin
       det:=sqrt(det);
       U2:=(-p+det)/2;
       ns:=0;
       mst;
       More( U2,lambda4,ns);
       U2:=(-p-det)/2;
       More( U2,lambda4,ns);
       end;
    procedure bi_carre_D0(var p,U2,lambda4 : extended; var ns : integer);
       begin
       U2 :=-p/2;  { solution en Z = Y^2 => y = +- sqrt(U2)}
       More(U2,lambda4,ns);
       end;
    procedure solu_bi_carre( var U2,p,r,lambda4 : extended; var ns : integer);
    var det       : extended;
        begin
        mst;
        ns:=0;
        str(lambda4,str1);
        det:=sqr(p) - 4*r;
        if ( det =0) then
           bi_carre_D0(p,U2,lambda4,ns)
        else
        if ( det > 0 ) then
           bi_carre_D_Pos(p,det,U2,lambda4,ns);
        end;
    procedure bi_carre( var U2,p,r,lambda4 : extended; var  ns : integer);
    var delta : extended;
       begin
       { U2 = Y^2,    U^2 + pU + r = 0 }
       delta := sqr(p) - 4*r;
       if (delta = 0 ) then
          begin
          U2:= -p/2;
          solu_bi_carre(U2,p,r,lambda4 ,ns)
          end
       else
       if ( delta > 0 ) then
          begin
          delta:=sqrt(delta);
          U2:=(-p+delta)/2;
          solu_bi_carre(U2,p,r,lambda4 ,ns);
          U2:=(-p-delta)/2;
          solu_bi_carre(U2,p,r,lambda4 ,ns);
          end;
       end;
    procedure General_deg4(var p,q,r,lambda4 : extended);
       var _x          : S04;
           P0,Q0,R0    : extended;
           n,
           status      : integer;
           sx          : sl4;
     
          begin
          { y^4 + pY^2 + qY + r = 0 , q <> 0
          essayons de trouver P0, Q0, R0 tels que
          (y^2 + P)^2 - (Q0 y +R0)^2 = 0.
          solutions de l'équation réduite revient à résoudre:
             y^2 + P0 + Q0 * y + R0 = 0
                  ou
             y^2 + P0 - Q0 * y - R0 = 0
     
          les coef doivent satistaire à :
     
              p    =       2*P0 - Q0^2
              q    =       -2*Q0*R0
              r    =       P0^2 - R0^2
     
          P0 est alors solution de
     
          P0^3 - (p/2)*P0^2 - r*P0 + p*r/2 - (1/8)*q^2 = 0
     
          }
          _x[3]:=1;
          _x[2]:=-p/2;
          _x[1]:=-r;
          _x[0]:=p*r/2-sqr(q)/8;
          poly_3(_x,false);
          n:=100;
          for status:=1 to 3 do if sol[status].def then
          if 2*sol[status].val > p then
             n:=status;
          if ( n <> 100 ) then
             begin
             P0:=sol[n].val;
             mst;
             Q0:=sqrt(2*P0-p);
             R0:=-q/2/Q0;
             { 1er equa Y^2 + Q0*Y +  P0 + R0 = 0 }
             _x[2]:=1;
             _x[1]:=Q0;
             _x[0]:=P0+R0;
             poly_2(_x);
             sx:=sol;
             { 2eme equa Y^2 - Q0*Y +  P0 - R0 = 0 }
             _x[2]:=1;
             _x[1]:=-Q0;
             _x[0]:=P0-R0;
             poly_2(_x);
             sx[3]:=sol[1];
             sx[4]:=sol[2];
             mst;
             sol:=sx;
             for n:=1 to 4  do if ( sol[n].def=true) then
                begin
                sol[n].val:=sol[n].val+lambda4;
                str(poly(_a,4,sol[n].val),str1);
                form1.memo1.lines.add(str1)
                end
             end
          end;
    procedure poly_4(_a  : s04);
    var
        a,b,c,d,
        U2,
        p,q,r,
        lambda4    : extended;
        ns         : integer;
     
     
       begin
       ns:=0;
       d:=1/_a[4];
       a:=_a[3]*d;
       b:=_a[2]*d;
       c:=_a[1]*d;
       d:=_a[0]*d;
       lambda4:=-a/4;
       {
       x^4  + a x^3  + b x^2  + c x  + d    =   0
     
        p = b - (3/8)*a^2 ;
         q =  c - a*b/2 + (1/8)*a^3 et
         r = d - a*c/4 + (1/16)*b*a^2 - (3/256)*a^4
       }
       p:=   b   - 3/8 *  sqr(a);
       q:=   c   - a*b/2 + 1/8 * a*sqr(a);
       r:=   d   - a*c/4 + b*sqr(a)/16  - 3/256 * sqr(sqr(a));
       { y^4 + pY^2 + qY + r = 0 }
       if ( q = 0) then
          bi_carre(U2,p,r,lambda4,ns)
       else
          General_deg4(p,q,r,lambda4)
       end;
    var f,g,xmin,xmax,ymin,ymax : extended;
    procedure TForm1.BitBtn2Click(Sender: TObject);
    var str1 : string; i : integer; ch : char;
    begin                            { degre = dg.itemindex+1 }
     
    for status:=1 to 4 do sol[status].def:=false;
    val(form1.edit0.text,_a[0],status);
    if (status <> 0) then
       begin
       edit0.text:='---';
       exit;
       end;
    val(form1.edit1.text,_a[1],status);
    if (status <> 0) then
       begin
       edit1.text:='---';
       exit;
       end;
    if (dg.itemindex>=1 ) then
       begin
       val(form1.edit2.text,_a[2],status);
       if (status <> 0) then
          begin
          edit2.text:='---';
          exit;
          end;
       end;
    if (dg.itemindex>=2 ) then
       begin
       val(form1.edit3.text,_a[3],status);
       if (status <> 0) then
          begin
          edit3.text:='---';
          exit;
          end;
       end;
    if (dg.itemindex>=3 ) then
       begin
       val(form1.edit4.text,_a[4],status);
       if (status <> 0) then
          begin
          edit4.text:='---';
          exit;
          end;
       end;
    deg:=dg.itemindex+1;
    case deg of
       1 : a:=_a[1];
       2 : a:=_a[2];
       3 : a:=_a[3];
       4 : a:=_a[4]
       end;
    if (abs(a) < 1e-10) then
       begin
       case deg of
          1 : edit1.text:='***';
          2 : edit2.text:='***';
          3 : edit3.text:='***';
          4 : edit4.text:='***';
          end;
          exit;
       end;
    mst;
    str1:='';
    for status:=deg downto 1 do
       begin
     
       case status of
          4 : str1:=str1 + edit4.text + ' X^' + istx(status) + '    ';
          3 : str1:=str1 + edit3.text + ' X^' + istx(status) + '    ';
          2 : str1:=str1 + edit2.text + ' X^' + istx(status) + '    ';
          1 : str1:=str1 + edit1.text + ' X'  +                '    ';
          end
       end;
    panel5.caption:=' Y   =   ' + str1 + edit0.text;
    case deg of
         1 : poly_1(_a);
         2 : poly_2(_a);
         3 : poly_3(_a,true);
         4 : poly_4(_a);
         end;
    i:=0;
    for status:=1 to 4 do if sol[status].def then
       begin
       str(sol[status].val,str1);
       inc(i);
       case status of
          1 : edit6.text:=str1;
          2 : edit7.text:=str1;
          3 : edit8.text:=str1;
          4 : edit9.text:=str1;
          end
       end
       else
          case status of
          1 : edit6.text:='%%%%%';
          2 : edit7.text:='%%%%%';
          3 : edit8.text:='%%%%%';
          4 : edit9.text:='%%%%%';
          end;
     
    str(i,str1);
    edit5.text:=str1;
     
    series1.clear;
    series2.clear;
    series3.clear;
     
    xmin:=1e35;
    xmax:=-1e35;
    for status:=1 to 4 do if sol[status].def then
       begin
       if   sol[status].val > xmax then
          xmax:=sol[status].val;  
       if   sol[status].val < xmin then
          xmin:=sol[status].val;
       end;
    if (xmin > xmax) then
       begin
       xmin:=-10;
       xmax:=10;
       end;
    if (xmax-xmin < 5) then
       begin
       f:=(xmin+xmax)/2;
       xmin:=f-2.5;
       xmax:=f+2.5;
       end;
     
       xmin:=xmin-0.5;
       xmax:=xmax+0.5;
       f:=(xmax-xmin)/500;
       for status:=0 to 500 do
          begin
          g:=xmin + f*status;
          series1.AddXY(g,poly(_a,deg,g),'',clred);
          series2.AddXY(g,0,'',clgreen);
          end;
       for status:=1 to 4 do if sol[status].def then
          begin
          series3.AddXY(sol[status].val,0,'',clblue);
          end;
     
    end;
     
    end.
    Ci-dessus un petit code en delphi pour résoudre analytiquement (c.a.d pas par approximation succécive) les équations de degré <=4

    Pour le degré 3 a3x^3 + a2x^2 + a1x + a0=0
    voici le principe
    1- normaliser pour que le coefficient de x^3 vaille 1 [* 1/Coeff(x^3) qui est <>0 si on a un polynôme de @ 3]
    L'équation devient
    x^3 + a x^2 + bx+c
    2- faire un changement de variable z=x+G en choisissant G pour que l'équation résultante n'ai plus de terme en x^2 ( G=-a/3)
    L'équation devient
    z^3 + pz+q=0
    si p=0 alors z^3=q. Une racine triple pour z=z0 => x
    *****

    si p <>0
    ******
    alors on calcul H = racine[ (4*|p|/3) ]
    et on fait le changement de variable Z= H*z
    l'équation s'écrit alors
    -si p>0
    ******
    4Z^3 + 3Z+Q=0
    si on pose Z=sh(u) alors 4sh(u)^3 + 3sh(u)+Q=0 ce qui s'écrit encore sh(3.u)=-Q d'où u => Z=Z0 => z=z0 => x=x0 [pour rappel la réciproque de sh = ln(v+sqrt(1 + v*v))/3]. Donc une racine réelle x0. La factorisation du polynôme d'origine donne (x-x0)(k2 x^2 + k1x+k0). les 2 racines complexes du polynême de @2 sont faciles
    -si p<0
    *****
    4Z^3 - 3Z+Q=0
    Là il faut encore séparer en 2 cas
    si |Q|<=1
    =======
    on pose Z= cos(t)
    d'où cos(3.t) = -Q d'où 3 racines réelles pour t => Z=Z0,1,2 => z=z0,1,2 => x=x0,1,2

    si |Q|>1
    =======
    on pose Z= ch(t) pour Q>0 et Z=-ch(t) pour Q<0
    d'où ch(3.t)=|Q| d'où t=t0 [ln(v+sqrt(v*v-1))= reciproque de ch ]. Une racine réelle et 2 complexes conjuguées (si les coefs d'origine sont réels)

  4. #4
    Membre expérimenté
    Homme Profil pro
    Chercheur
    Inscrit en
    Mars 2010
    Messages
    1 218
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Chercheur

    Informations forums :
    Inscription : Mars 2010
    Messages : 1 218
    Points : 1 685
    Points
    1 685
    Par défaut
    Bonjour,

    si tu veux résoudre ton problème à la main, tu peux utiliser la méthode de Cardan.

  5. #5
    Inactif  

    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3 064
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3 064
    Points : 4 605
    Points
    4 605
    Par défaut
    Hello

    Merci , j'ai pu trouvé effectivement une solution avec ce qui a été proposé (méthode de cardan + wolfram )

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Erreur boucle if polynôme du second degré
    Par PP_dev dans le forum C++
    Réponses: 3
    Dernier message: 07/03/2015, 20h32
  2. Réponses: 1
    Dernier message: 13/06/2010, 19h27
  3. Procédure de résolution de polynômes de degré 2 et 3
    Par kokosi dans le forum Mathématiques
    Réponses: 1
    Dernier message: 13/06/2010, 19h27
  4. Résolution de polynôme
    Par ninie37 dans le forum Pascal
    Réponses: 5
    Dernier message: 29/12/2006, 21h49
  5. Racines d'un polynôme du 5ème degré
    Par spithi dans le forum Pascal
    Réponses: 2
    Dernier message: 05/12/2006, 20h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo