Up ! Mathematical - Complexe

Ce programme présente l'usage des nombres complexes.

Le fichier source est ${UPS_HOME}/upsvtm/demo/${UPS_LANGUAGE}/complexe.upl.

Mode compilé

Commande de compilation

upscmp Source=complexe.upl

Commande d'exécution

complexe

Mode interprété

upssng Source=complexe.upl

Fichier source

Source Composant "Exemple d'emploi du type Complexe" Version 4.0.0;

ImporterModule
/************/
Principal
/*******/
Variable
/******/
Debut
A=Complexe(1.0, 1.0);
Ecran.Ecrire(A.VersCaractere());
B=Complexe(1.0 ,1.0);
Ecran.Ecrire(B.VersCaractere());

A=A+1.0;
Ecran.Ecrire(A.VersCaractere());
B=B+1.0;
Ecran.Ecrire(B.VersCaractere());

A=A-10.0;
Ecran.Ecrire(A.VersCaractere());
B=B-10.0;
Ecran.Ecrire(B.VersCaractere());

A=A*10.0;
Ecran.Ecrire(A.VersCaractere());
B=B*10.0;
Ecran.Ecrire(B.VersCaractere());

A=A/5.0;
Ecran.Ecrire(A.VersCaractere());
B=B/5.0;
Ecran.Ecrire(B.VersCaractere());

A=A^3.0;
Ecran.Ecrire(A.VersCaractere());
B=B^3.0;
Ecran.Ecrire(B.VersCaractere());

A=Complexe(1.0, 1.0);
Ecran.Ecrire(A.VersCaractere());
B=Complexe(1.0, 1.0);
Ecran.Ecrire(B.VersCaractere());

A+=1.0;
Ecran.Ecrire(A.VersCaractere());
B+=1.0;
Ecran.Ecrire(B.VersCaractere());

A-=10.0;
Ecran.Ecrire(A.VersCaractere());
B-=10.0;
Ecran.Ecrire(B.VersCaractere());

A*=10.0;
Ecran.Ecrire(A.VersCaractere());
B*=10.0;
Ecran.Ecrire(B.VersCaractere());

A^=3.0;
Ecran.Ecrire(A.VersCaractere());
B^=3.0;
Ecran.Ecrire(B.VersCaractere());

A=Complexe(1, 1);
Ecran.Ecrire(A.VersCaractere());
B=Complexe(1, 1);
Ecran.Ecrire(B.VersCaractere());

A=A+1;
Ecran.Ecrire(A.VersCaractere());
B=B+1;
Ecran.Ecrire(B.VersCaractere());

A=A-10;
Ecran.Ecrire(A.VersCaractere());
B=B-10;
Ecran.Ecrire(B.VersCaractere());

A=A*10;
Ecran.Ecrire(A.VersCaractere());
B=B*10;
Ecran.Ecrire(B.VersCaractere());

A=A/5;
Ecran.Ecrire(A.VersCaractere());
B=B/5;
Ecran.Ecrire(B.VersCaractere());

A=A^3;
Ecran.Ecrire(A.VersCaractere());
B=B^3;
Ecran.Ecrire(B.VersCaractere());

A=Complexe(1, 1);
Ecran.Ecrire(A.VersCaractere());
B=Complexe(1, 1);
Ecran.Ecrire(B.VersCaractere());

A+=1;
Ecran.Ecrire(A.VersCaractere());
B+=1;
Ecran.Ecrire(B.VersCaractere());

A-=10;
Ecran.Ecrire(A.VersCaractere());
B-=10;
Ecran.Ecrire(B.VersCaractere());

A*=10;
Ecran.Ecrire(A.VersCaractere());
B*=10;
Ecran.Ecrire(B.VersCaractere());

A^=3;
Ecran.Ecrire(A.VersCaractere());
B^=3;
Ecran.Ecrire(B.VersCaractere());

A=Complexe(Decimal(1), Decimal(1));
Ecran.Ecrire(A.VersCaractere());
B=Complexe(Decimal(1), Decimal(1));
Ecran.Ecrire(B.VersCaractere());

A=A+Decimal(1);
Ecran.Ecrire(A.VersCaractere());
B=B+Decimal(1);
Ecran.Ecrire(B.VersCaractere());

A=A-Decimal(10);
Ecran.Ecrire(A.VersCaractere());
B=B-Decimal(10);
Ecran.Ecrire(B.VersCaractere());

A=A*Decimal(10);
Ecran.Ecrire(A.VersCaractere());
B=B*Decimal(10);
Ecran.Ecrire(B.VersCaractere());

A=A/Decimal(5);
Ecran.Ecrire(A.VersCaractere());
B=B/Decimal(5);
Ecran.Ecrire(B.VersCaractere());

A=A^Decimal(3);
Ecran.Ecrire(A.VersCaractere());
B=B^Decimal(3);
Ecran.Ecrire(B.VersCaractere());

A=Complexe(Decimal(1), Decimal(1));
Ecran.Ecrire(A.VersCaractere());
B=Complexe(Decimal(1), Decimal(1));
Ecran.Ecrire(B.VersCaractere());

A+=Decimal(1);
Ecran.Ecrire(A.VersCaractere());
B+=Decimal(1);
Ecran.Ecrire(B.VersCaractere());

A-=Decimal(10);
Ecran.Ecrire(A.VersCaractere());
B-=Decimal(10);
Ecran.Ecrire(B.VersCaractere());

A*=Decimal(10);
Ecran.Ecrire(A.VersCaractere());
B*=Decimal(10);
Ecran.Ecrire(B.VersCaractere());

A^=Decimal(3);
Ecran.Ecrire(A.VersCaractere());
B^=Decimal(3);
Ecran.Ecrire(B.VersCaractere());

A++;
Ecran.Ecrire(A.VersCaractere());
B++;
Ecran.Ecrire(B.VersCaractere());

A--;
Ecran.Ecrire(A.VersCaractere());
B--;
Ecran.Ecrire(B.VersCaractere());

++A;
Ecran.Ecrire(A.VersCaractere());
++B;
Ecran.Ecrire(B.VersCaractere());

--A;
Ecran.Ecrire(A.VersCaractere());
--B;
Ecran.Ecrire(B.VersCaractere());

Si A==1.0 Alors Fin Si
Si A!=1.0 Alors Fin Si

Si B==1.0 Alors Fin Si
Si B!=1.0 Alors Fin Si

Si A==1 Alors Fin Si
Si A!=1 Alors Fin Si

Si B==1 Alors Fin Si
Si B!=1 Alors Fin Si

Si A==Decimal(1) Alors Fin Si
Si A!=Decimal(1) Alors Fin Si

Si B==Decimal(1) Alors Fin Si
Si B!=Decimal(1) Alors Fin Si

Fin Principal

Résultat de l'exécution

1,0000 1,0000 2,0000 2,0000 -8,0000 -8,0000 -80,0000 -80,0000 -16,0000 -16,0000 -4.096,0000 -4.096,0000 1,0000 1,0000 2,0000 2,0000 -8,0000 -8,0000 -80,0000 -80,0000 -512.000,0000 -512.000,0000 1,0000 1,0000 2,0000 2,0000 -8,0000 -8,0000 -80,0000 -80,0000 -16,0000 -16,0000 -4.096,0000 -4.096,0000 1,0000 1,0000 2,0000 2,0000 -8,0000 -8,0000 -80,0000 -80,0000 -512.000,0000 -512.000,0000 -511.999,0000 -511.999,0000 -512.000,0000 -512.000,0000 -511.999,0000 -511.999,0000 -512.000,0000 -512.000,0000 A!=1.0 A<=1.0 A<1.0 B!=1.0 B<=1.0 B<1.0 A!=1 A<=1 A<1 B!=1 B<=1 B<1