Application Center - Maplesoft

App Preview:

Decomposition into irreducible factors in the Gauss integers annulus

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

Entiers de Gauss 

Entiers de Gauss 

On propose de programmer la d?composition en produit de facteurs  

irreductibles dans l'anneau des entiers de Gauss. 

Decomposition en somme de deux carr?s 

On commence par ecrire la procedure renvoyant la decomposition en somme de  

deux carr?s pour un entier p premier de la forme 1+4*k 

> restart:
decomp_carre:=proc(p)
local x,y;
if p mod 4<>1 then return(`P doit etre un nombre premier congrue ? 1 modulo 4`)
else
x:=1;
y:=0;
while x^2+y^2<>p do
x:=x+1;
y:=0;
   while y<x and (x^2+y^2<>p) do
   y:=y+1;
   od;
od;
fi;
[x,y];
end;
 

>
 

decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
decomp_carre := proc (p) local x, y; if `mod`(p, 4) <> 1 then return `P doit etre un nombre premier congrue ? 1 modulo 4` else x := 1; y := 0; while x^2+y^2 <> p do x := x+1; y := 0; while y < x and x...
(2.1)
 

> decomp_carre(6);
 

>
 

`P doit etre un nombre premier congrue ? 1 modulo 4` (2.2)
 

Plus petit diviseur d'un entier 

On ecrit une procedure sommaire qui renvoie le plus petit diviseur  

d'un entier n  

> plus_petit_diviseur:=proc(n)
local d;
if n mod 2 =0 then d:=2;
else
    d:=3;
    while n mod d>0 do d:=d+2;
    od;
fi;
d;
end;
 

plus_petit_diviseur := proc (n) local d; if `mod`(n, 2) = 0 then d := 2 else d := 3; while 0 < `mod`(n, d) do d := d+2 end do end if; d end proc (3.1)
 

> plus_petit_diviseur(291);
 

3 (3.2)
 

Norme d'un entier de Gauss 

Norme d'un entier de Gauss : N(x+I*y)=x^2+y^2 

> Norme:=proc(z)
local x,y;
x:=Re(z);
y:=Im(z);
x^2+y^2;
end;
 

Norme := proc (z) local x, y; x := Re(z); y := Im(z); x^2+y^2 end proc (4.1)
 

Diviseur irreductible d'un entier de Gauss a partir de sa norme 

Etant un nombre premier p divisant la norme d'un entier de Gauss 

on construit l'entier de Gauss irreductible associ?. 

> m:=a+I*b;c:=x+I*y;
evalc(m*conjugate(c)/(r^2+s^2));
 

m := a+I*b (5.1)
 

c := x+I*y (5.1)
 

(a*x+b*y)/(r^2+s^2)+I*(b*x-a*y)/(r^2+s^2) (5.1)
 

>
 

> diviseur_irreduct:=proc(z,p)
local w,w1,a,b,s,x,y;
a:=Re(z);b:=Im(z);
if     p mod 4 = 2 then w:=1+I;
elif   p mod 4 = 3 then w:=p ;
elif   p mod 4 = 1 then
s:=decomp_carre(p);
x:=s[1];y:=s[2];
w1:=x+I*y;
     if a*x+b*y mod p =0 then w:=w1;
     else w:=x-I*y;
     fi;
fi;
w;
end;
 

diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
diviseur_irreduct := proc (z, p) local w, w1, a, b, s, x, y; a := Re(z); b := Im(z); if `mod`(p, 4) = 2 then w := 1+I elif `mod`(p, 4) = 3 then w := p elif `mod`(p, 4) = 1 then s := decomp_carre(p); x...
(5.2)
 

> Norme(22-3*I);ifactor(%);
 

493 (5.3)
 

``(17)*``(29) (5.3)
 

> diviseur_irreduct(22-3*I,17);
 

4+I (5.4)
 

Factorisation d'un entier de Gauss 

On code l'algorithme de decomposition en facteurs irreductibles. 

> factor_gauss:=proc(z)
local w,p,dec,z0,i0;
z0:=z;
dec:=NULL;
while Norme(z0)>1 do
     p:=plus_petit_diviseur(Norme(z0));
     w:=evalc(diviseur_irreduct(z0,p));
     dec:=dec,w;
     z0:=evalc(z0/w);      
od;
i0:=evalc(z/product(dec[k],k=1..nops([dec])));
dec:=i0,dec;
end;
 

factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
factor_gauss := proc (z) local w, p, dec, z0, i0; z0 := z; dec := NULL; while 1 < Norme(z0) do p := plus_petit_diviseur(Norme(z0)); w := evalc(diviseur_irreduct(z0, p)); dec := dec, w; z0 := evalc(z0/...
(6.1)
 

> comp:=evalc((1-5*I)*(2-I)*(3-I)*(2+3*I));
dec:=factor_gauss(50-120*I);
 

comp := 50-120*I (6.2)
 

dec := -I, 1+I, 1+I, 2+I, 2-I, 3-2*I, 3-2*I (6.2)
 

> product(dec[k],k=1..nops([dec]));
 

50-120*I (6.3)
 


Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.
 

Image