
temp1=!randint 2,6
z1=$(niveaux[$temp1])

temp1=!randint 6,10
temp2=!randint 1,10
!if $temp2=$temp1
temp2=$[$temp2-2]
!endif
cont=!exec maxima 10*y+($temp1-$temp2)*x
mcont=$[10*$temp1]




temp3=!replace y by (($temp2-$temp1)*x*0.1+$temp1) in $fonc_m






# temp3=!exec maxima $temp3
temp4=!solve $temp3=$z1 for x=$xm to $xM

nsol=!itemcnt $temp4

!if $nsol>0

temp5=!exec maxima diff($temp3,x)
temp6=!replace x by ($(temp4[1])) in $temp5
temp6=$[$temp6]
temp6=$[abs($temp6-($temp2-$temp1)/10)]

!endif

!if $temp6<=40
z1=$[$z1-$dz]
temp4=!solve $temp3=$z1 for x=$xm to $xM

nsol=!itemcnt $temp4

!endif





