
!set tmp0=!randitem 1,-1

!set tmp1=!randint 1, 5

!set m_a0=$[rint($(tmp0)*$(tmp1))]

 
!set tmp0=!randitem 1,-1

!set tmp1=!randint 1, 5

!set m_a1=$[rint($(tmp0)*$(tmp1))]


!set tmp0=!randitem 1,-1

!set tmp1=!randint 1, 5

!set m_a2=$[rint($(tmp0)*$(tmp1))]


!set tmp0=!randitem 1,-1

!set tmp1=!randint 1, 5

!set m_a3=$[rint($(tmp0)*$(tmp1))]


!set tmp0=!randint -5, 5

!set m_a4=$[rint($(tmp0))]


!set tmp0=!randint -5, 5

!set m_a5=$[rint($(tmp0))]

<p>

!set tmp0=!randint -5, 5

!set m_b1=$[rint($(tmp0))]


!set tmp0=!randitem 1,-1

!set tmp1=!randint 1, 5

!set m_b2=$[rint($(tmp0)*$(tmp1))]


!set tmp0=!randint -5, 5

!set m_b3=$[rint($(tmp0))]


!set tmp0=!randitem 1,-1

!set tmp1=!randint 1, 5

!set m_b0=$[rint($(tmp0)*$(tmp1))]

<p>

!set m_P=($m_a5)*x^5+ ($m_a4)*x^4+ ($m_a3)*x^3+($m_a2)*x^2+	 ($m_a1)*x+ ($m_a0)



!set m_Q=($m_b3)*x^3+ ($m_b2)*x^2+ ($m_b1)*x+ ($m_b0)


<p>

!set t_=!replace internal \( by ( in (g(P0,Q)=local(n,q,A,B,E,P,EP,LE);	n=poldegree(P0,x); q=poldegree(Q,x);	A=matrix(2*n+1,n+1);P=P0; EP=0;LE=[];	A[1,]=Vec(P); B=concat(vector(n-q),Vec(Q));p=n;	for(i=1, n,if(p>=q,	E=pollead(P,x)/pollead(Q,x); EP=E*x^(p-q)+EP;	LE=concat(LE,[E*x^(p-q)]);	A[2*i,]=-E*concat(vector(n-p),Vec(x^(p-q)*Q));	A[2*i+1,]= A[2*i-1,]+A[2*i,];	P=Pol(A[2*i+1,],x);	p=poldegree(P,x),s=i;break));	[matrix(2*s-1,n+1,i,j,A[i,j]*x^(n-j+1)),s,EP,LE,P]);	R=g($m_P,$m_Q);	 [poldegree($m_P,x),R[1],R[2],R[3],$m_Q,R[4] ,$m_P,divrem($m_P,$m_Q)[2]]
!set tmp0=!exec pari $t_

!set m_data=$(tmp0)


<p>

!set tmp0=!item 1 of $m_data

!set m_n=$(tmp0)



!set m_m=$[rint(2*$m_n)]


!set tmp0=!item 2 of $m_data

!set tmp1=!declosing $(tmp0)

!set m_A=$(tmp1)



!set tmp0=!item 3 of $m_data

!set m_s=$(tmp0)



!set tmp0=!item 4 of $m_data

!set tmp1=!htmlmath $(tmp0)

!set m_E=$(tmp1)



!set tmp0=!item 5 of $m_data

!set tmp1=!htmlmath $(tmp0)

!set m_Q=$(tmp1)



!set tmp0=!item 6 of $m_data

!set tmp1=!declosing $(tmp0)

!set m_Liste=$(tmp1)



!set tmp0=!item 7 of $m_data

!set tmp1=!htmlmath $(tmp0)

!set m_P0=$(tmp1)



!set tmp0=!item 8 of $m_data

!set tmp1=!htmlmath $(tmp0)

!set m_Rs=$(tmp1)



!read primitives.phtml 1, reload, <img src="gifs/doc/etoile.gif" alt="rechargez" width="20" height="20"> 

<table width="90%">
<tr align=center> 

!set tmp=!translate internal $	$ to ; in $m_A

!set tmp=!row 1 of $tmp
!set tmp0=!translate internal $\
$ to ; in $tmp
!set m_C=$(tmp0)


<td> P=</td>
 
!for m_j=1 to  $m_n+1 

<td><font color=black>

!set tmp0=!item $m_j of $m_C

!set tmp1=!htmlmath $(tmp0)

!set m_a=$(tmp1)

 
 !set tmp0=!item $m_j of $m_C

 
!if $(tmp0)=0 

!else
  
!if  - isin $m_a 
 $m_a
!else
 +$m_a
!endif

!endif

<p>
  </font></td>
!next

 <td colspan="10"> Q=$m_Q <hr></td>
 </tr>
 <tr align=center>
 
!for m_i =1 to $m_s-1 

!set m_iii=$[rint(2*$m_i+1)]


!set m_ii=$[rint(2*$m_i)]


!set tmp=!translate internal $	$ to ; in $m_A

!set tmp=!row $m_ii of $tmp
!set tmp0=!translate internal $\
$ to ; in $tmp
!set m_C=$(tmp0)



!set tmp0=!item $m_i of  $m_Liste

!set tmp1=!htmlmath -$(tmp0)

!set m_EE=$(tmp1)


<tr align=center ><td>  
!if  - isin $m_EE 
<font color=red><b>$m_EE</b> </font>Q
!else
 
<font color=red><b>$m_EE</b></font> Q
!endif
 </td>
 
!for m_j=1 to  $m_n+1 

<td ><font color=green>

!set tmp0=!item $m_j of $m_C

!set tmp1=!htmlmath $(tmp0)

!set m_a=$(tmp1)

 
!set tmp0=!item $m_j of $m_C

 
!if $(tmp0)=0 

!else
 
  
!if   - isin $m_a 
$m_a
!else
 +$m_a
!endif
 <hr>
!endif
</font></td>
!next
 
 <td colspan="10"> 
  
!if $m_i=1 
E=<font color= red><b>$m_E </b></font>
!else
 
!endif
 </td>
 </tr>
<tr align=center> 

!set tmp=!translate internal $	$ to ; in $m_A

!set tmp=!row $m_iii of $tmp
!set tmp0=!translate internal $\
$ to ; in $tmp
!set m_C=$(tmp0)


<td>  
!if $m_i<$m_s -1 
=
!else
 R=
!endif
</td>
 
!for m_j=1 to  $m_n+1 

<td > 
!if $m_i<$m_s -1 
<font color=blue>
!else
 <font color=magenta><b>
!endif
 
!set tmp0=!item $m_j of $m_C

 
!if $(tmp0)=0 

!else
 

!set tmp0=!item $m_j of $m_C

!set tmp1=!htmlmath $(tmp0)

!set m_a=$(tmp1)

 
  
!if  - isin $m_a 
$m_a 
!else
 +$m_a
!endif

!endif

  
!if $m_i=$m_s -1 
</b>
!endif
</font></td>
 
!next

 </tr>

!next
</table>
<center> 
$m_P0 = <font color=red><b>($m_E)</b></font>($m_Q) + <font color=magenta><b>
$m_Rs </b></font>

!read primitives.phtml 2, reload, <img src="gifs/doc/etoile.gif" alt="rechargez" width="20" height="20"> 


