q:=quo(R,P,X)

P:=a+b*X+c*X^2+d*X^3+f*X^4: A:=subs(X=2*X,P)-2*P^2+1: re:=rem(A,X^6,X); co:=coeffs(re,X); so:=[solve({co})]; subs(so[1],P); subs(so[2],P); re := -4 c d - 4 b f.
77KB taille 4 téléchargements 614 vues
SESSION 04 > restart: P:=X^4+1: Q:=X+7: R:=X^7+8*X^4-X^3-8: S:=X^4 + 6*X^2 +4: T:= X^3 + 3*X^2- 9*X+5:

> l:=[seq(X-op(k,r),k=1..nops(r))]; l := [X + 1, X - 1, X + 2, X - I, X + I, X - 1 - I

q := X 3 + 8 (X 4 + 1) (X 3 + 8) - 16 - 2 X 3 X7 + 8 X4 - X3 - 8 > irreduc(P); irreduc(Q);

> L:=[P,R,S,T]: for p 1 1 ! $ X4 + 1 = " X 2 - I 2% 2 2 # &

true true > factor(P,real); factor(Q,real); (X 2 + 1.414213562 X + 1.000000000) (X 2 - 1.414213562 X + 1.000000000) X + 7.000000000 > factor(P,complex); factor(Q,complex); (X + (0.7071067812 + 0.7071067812 I)) (X + (0.7071067812 - 0.7071067812 I)) (X + (-0.7071067812 + 0.7071067812 I)) (X + (-0.7071067812 - 0.7071067812 I))

in L do decomp(p) od; 1 1 1 ! $ ! 2% " X + " X- I 2+ 2 2 2 # & #

2+

X 7 + 8 X 4 - X 3 - 8 = (X + 1) (X - 1) (X + 2) (X - I) (X + I) (X - 1 - I 1 ! X4 + 6 X2 + 4 = " X + I 2 # 1 $ - I 10% 2 &

1 10 - I 2

1 $ ! 2% " X - I 2 & #

1 10 + I 2

1 I 2

1 $ ! 2% " X + I 2 & #

3) (X - 1 + I

1 $ ! 2% " X + I 2 & #

2 + 1)

1 2

$ 2% &

3) 1 I 2

1 $ ! 10% " X - I 2 & #

2

re := (-4 c d - 4 b f) X 5 + (-4 b d - 2 c 2 - 4 a f + 16 f) X 4 + (-4 b c - 4 a d + 8 d) X 3 + (-4 a c - 2 b 2 + 4 c) X 2 + (2 b - 4 a b) X + a - 2 a 2 + 1

> gcd(P,Q); 1

co := a - 2 a 2 + 1, 2 b - 4 a b, -4 b d - 2 c 2 - 4 a f + 16 f, -4 b c - 4 a d + 8 d, -4 a c - 2 b 2 + 4 c, -4 c d - 4 b f

> gcdex(P,Q,X,'A','B'); A; B; expand(A*P+B*Q); 1 1 2402

* 0 -1* ' 1 2 - ' so := . ( b = 0, d = 0, c = 0, f = 0, a = + , ( a = 1, b = 0, d = 0, f = c , c = c+ 1 2, ) 6 , 2 / ) -1 2

343 1 7 49 X3 + X2 X 2402 2402 2402 2402

1 + c X2 +

1

1 2 4 c X 6

> f:=1/R: g:=R/T; factor(R); factor(T);

> factor(R); (X - 1) (X + 2) (X + 1) (X 2 + 1) (X 2 - 2 X + 4)

g :=

> factor(R,real); factor(R,complex); 2

> r:=[solve(R)]; 3, 1 - I

3]

X7 + 8 X4 - X3 - 8 X3 + 3 X2 - 9 X + 5

(X - 1) (X + 2) (X + 1) (X 2 + 1) (X 2 - 2 X + 4)

(X + 2.) (X + 1.) (X - 1.) (X + 1.) (X - 2.0 X + 4.000000001) (X + 2.) (X + 1.) (X + 1. I) (X - 1. I) (X + (-1. + 1.732050808 I)) (X - 1.) (X + (-1. - 1.732050808 I)) r := [-1, 1, -2, I, -I, 1 + I

2+

2-

> P:=a+b*X+c*X^2+d*X^3+f*X^4: A:=subs(X=2*X,P)-2*P^2+1: re:=rem(A,X^6,X); co:=coeffs(re,X); so:=[solve({co})]; subs(so[1],P); subs(so[2],P);

> factor(P,sqrt(2));

2

3)

X 3 + 3 X 2 - 9 X + 5 = (X + 5) (X - 1)2

X + 7.000000000 2 + 1) (X 2 - X

3) (X - 1 + I

> decomp:=proc(P) local r,l,p: p:=P: r:=[solve(p)]: l:=[seq(X-op(k,r),k=1..nops(r))]: p=convert(l,`*`): end:

r := -16 - 2 X 3

(X 2 + X

3]

> R=convert(l,`*`); X 7 + 8 X 4 - X 3 - 8 = (X + 1) (X - 1) (X + 2) (X - I) (X + I) (X - 1 - I

> q:=quo(R,P,X); r:=rem(R,P,X); P*q+r; expand(%);

3, X - 1 + I

(X + 5) (X - 1)2 > factor(g);

(X + 2) (X + 1) (X 2 - 2 X + 4) (X 2 + 1) (X + 5) (X - 1) > normal(g); X6 + X5 + X4 + 9 X3 + 8 X2 + 8 X + 8 X2 + 4 X - 5 > convert(f,parfrac,X); convert(g,parfrac,X); 1 1 1 -12 + 11 X -8 - X + + + 36 (X - 1) 180 (X + 2) 28 (X + 1) 1092 (X 2 - 2 X + 4) 130 (X 2 + 1) X 4 - 3 X 3 + 18 X 2 - 78 X + 410 +

6 2028 X-1 X+5

> U:=R*T; 7

4

3

3

2

U := (X + 8 X - X - 8) (X + 3 X - 9 X + 5) > v:=subs(X=1,U): j:=1: while v=0 do v:=simplify(subs(X=1,diff(U,X$j))); j:=j+1; od: `j`:=j-1; j := 3 > with(numtheory): n:=2: c:=1: b:=true: while c listepre:=proc(n) local dn, dpn, i, s; dn:=[op(divisors(n))]: dpn:=[]: for i in dn do if isprime(i) then s:=1: while irem(n,i^s)=0 do s:=s+1: od: dpn:=[op(dpn),[i,s-1]]: fi: od: dpn; end: > dpa:=listepre(a); dpb:=listepre(b); dpg:=listepre(g); dpa := [[3, 2], [17, 1], [19, 3]] dpb := [[3, 1], [7, 3], [17, 1]] dpg := [[3, 1], [17, 1]] > un:=[op(dpa),op(dpb)]; for j from 1 to nops(dpg) do if member(dpg[j],un,'k') then un:=subsop(k=NULL,un); fi; od; un; un := [[3, 2], [17, 1], [19, 3], [3, 1], [7, 3], [17, 1]] [[3, 2], [19, 3], [7, 3], [17, 1]] > lcm(a,b)=(19^3)*(3^2)*(7^3)*17; 359953461 = 359953461

> n-1; 3571 > n:=40000: b:=false: while b=false do n:=n+1; b:=isprime(n): od: n; 40009 > a:=1049427: b:=17493: g:=gcd(a,b); isprime(g); divisors(g); g := 51 false {1, 3, 17, 51}

> n:=200!: i:=1: while irem(n,10^i)=0 do i:=i+1; od: i-1; 49 > perf:=proc(n) local d,s,i: d:=divisors(n) minus {n}; s:=0; for i in d do s:=s+i; od; is(s=n): end: > perf(6); true > L:=[]: n:=1: while n perf(28); [6, 28, 496] true > base2:=proc(n) local q,l,r: q:=iquo(n,2,'r'); l:=[r]; while q0 do q:=iquo(q,2,'r'); l:=[op(l),r]; od; l; end: > base2(12); [0, 0, 1, 1] >