Copie du wikimiroir

Ceci est un miroir du wiki de pascal.chat. La modification, l’historique et la connexion se trouvent là-bas.

complex number/fr

English · Français

Les nombres complexes sont un concept mathématique fournissant des solutions à des équations telles que $x^2 = -1$.

Dans la bibliothèque d'exécution par défaut de FPC, l'unité uComplex définit un type complex et beaucoup d'opérateurs et autres fonctions.

u dans uComplex signifie la lettre grecque µ signifiant “micro”, car l'implémentation est gardée aussi simple que possible.

Dans extended Pascal, qu'il est prévu d'implémenter dans FPC un jour, le type de données complex est défini comme une paretier du langage.

pascal
program complexDemo(input, output, stderr);
uses
    uComplex;
var
    x, y: complex;
begin
    // specifying real and imaginary part
    x := -5 + 2 * i;
    
    // specifying magnitude and phase angle
    // y := sqrt(2) * (cos(pi/4) + i * sin(pi/4))
    y.re :=  1;
    y.im :=  1;
    
    x := x + y;
    // there is no toString functionality:
    writeLn('x = ', x.re, ' + ', x.im, 'i');
end.

Voir aussi

Références externes


From the Free Pascal wiki, page "complex number/fr", as it stood on 2022-08-06 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Version 1, dernière modification par WikiArchive .