!!!!!!!!!!!!-------- fichier de traitement de l'exo 2 --------!!!!!!!!!!!!

## on vide les alertes ##
1alertrecip1=
2alertrecip1=

## on regarde si le champ est rempli ##
!if $rderrecipfy=$empty
  1alertrecip1=$alert2
  !exit
!endif

## on regarde la validite de la reponse ##
  !!!!!!!!!---- elimination des signes bizarres ----!!!!!!!!!
  rderrecipfy=!nospace $rderrecipfy
  repsnb=1
  reps1=$rderrecipfy
  NonValide=alert3
  
  !read comsDir/repclean
  
  !if $alertreps1!=$empty
    2alertrecip1=$alert3
    rderrecipfy=!replace internal " by ?? in $rderrecipfy
    !exit
  !endif
  
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

rderrecipfy=!rawmath $rderrecipfy
rderrecipfyTF=!exec maxima constantp($rderrecipfy);
!if $rderrecipfyTF!=true
  2alertrecip1=$alert3
  !exit
!endif

recipVarList=e,pi,PI,pI,Pi
fyVars=!varlist nofn $rderrecipfy
fyVars=!listcomplement $recipVarList in $fyVars


!if $fyVars!=$empty
  2alertrecip1=$alert3
  !exit
!endif

## analyse de la reponse ##

rderrecipfyTF=!exec maxima ($rderrecipfy);

!if $rderrecipfyTF=$empty 
  2alertrecip1=$alert3
  !exit
!endif

rderrecipfyTF=!exec maxima ratsimp($derrecipfy-($rderrecipfy));

!if $rderrecipfyTF=$empty 
  2alertrecip1=$alert3
  !exit
!endif

rderrecipfyTF=!exec maxima abs($rderrecipfyTF);
!if $rderrecipfyTF<$epsi 
  rderrecipfyTF=0
!endif

!if $rderrecipfyTF=0
  VFderrecipfy=$Vrcom
  note=10
 !else 
  VFderrecipfy=$Fxcom
!endif

rderrecipfy=!texmath $rderrecipfy
derrecipfy=!texmath $derrecipfy

rep=1

module_score=$note
!read answer.phtml
status=done
