!!! fichier d'initialisation de l'exo 2 !!!

## lecture du fichier commun
!read commonDir/common1

chp=!randitem 1,2

## fabrication d'un polynome de la variable t
k1=!randint -7,7
k2=!randint 1,9
polyp=expand((t-($k1))^2-($k2))
t1=($k1)-(sqrt($k2))
t2=($k1)+(sqrt($k2))

## fabrication de formes linaires et de ut (ne dpend pas de t)
q=!randint 1,3
c2=!randint 1,5
!if $chp=1
  bornd=$[floor(-$c2*$k2/$q)-1]
  borng=$[$bornd-3]
  c1=!randint $borng,$bornd
  polyq=$polyp
 !else
  borng=$[floor($c2*$k2/$q)+1]
  bornd=$[$borng+3]
  c1=!randint $borng,$bornd
  k3=!exec maxima (($c1)*$q-($c2)*($k2))/($c2);
  polyp=expand((t-($k1))^2-($k3))
  polyq=expand((t-($k1))^2+($k2))
  t1=($k1)-(sqrt($k3))
  t2=($k1)+(sqrt($k3))
!endif

vech=expand(($polyq)*[$vecw]+($q)*[$vecv])
eqH=($vech) . transpose([$vecx])
vecL=($c1)*[$vecw]+($c2)*[$vecv]
vecw=($vecw)

k=!randint -7,7
!if $k=0
  k=!randitem -3,3
!endif
!if $k>0
  ut=!texmath f(x)=L(x)\cdot w + $k x
 !else
  ut=!texmath f(x)=L(x)\cdot w $k x
!endif

## appel  maxima
tmpexec=!exec maxima $eqH;\
($vecL) . transpose([$vecx]);\
$polyp;\
($t1);\
($t2);

!distribute lines $tmpexec into eqH,formL,polyp,t1,t2

## pour affichage
eqH=!texmath $eqH=0
eqH=\($eqH)
formL=!texmath $formL
formL=\(L(x)= $formL)
vecx=!texmath ($vecx)
vecx=\($vecx)
ut=\($ut)

goodrep=$t1,  $t2



