;;; .EnTete "Le-Lisp (c) version 15.2" " " "Test des fonctions Complexes"
;;; .EnPied "testcomplex.ll "%" " "
;;;
;;; .SuperTitre "Test des fonctions Complexes"
;;;
;;;
;;; .Centre "*****************************************************************"
;;; .Centre " Ce fichier est en lecture seule hors du projet ALE de l'INRIA.  "
;;; .Centre " Il est maintenu par ILOG SA, 2 Avenue Gallie'ni, 94250 Gentilly "
;;; .Centre " (c) Le-Lisp est une marque de'pose'e de l'INRIA                 "
;;; .Centre "*****************************************************************"
;;;
;;; .Centre "$Header: testcomplex.ll,v 4.1 88/01/13 12:30:18 kuczynsk Rel213 $"

(unless (>= (version) 15.2)
        (syserror 'load 'erricf 'testcomplex))

(unless (featurep 'complex)
        (print "Je charge les complexes interpretes")
        (libload complex t))

(libload testgenr t)

; Appel de la fonction de test

(testfn ())

    (test-serie "Test de l'arithmetique complexe" ())

     (realp 2)                                 2
     (realp 2.3)                               2.3
     (realp [2/3])                             2/3
     (realp [i])                               ()
     (complexp [-12345])                       ()
     (complexp [-i])                           [-i]
     (+ (+ [1/3] [2/3]) (+ 1. 1.e-15) 1.)      3.

     (+ i 3)                                   [i+3]
     (* i i)                                   -1
     (* i (+ i i))                             -2
     (* (* [1/3] i) i)                         [-1/3]
     (+ i (/ i))                               0
     (/ [2i+3])                                [-2/13i+3/13]
     (<?> [i] 1)                               [i-1]
     (<?> [-2i+3] [i+1])                       [-i+1]
     (<?> [i] 1.2)                             [i-1]
     (<?> 1.2 [i])                             [-i+1]
     (float [2/3i+5])                          [.666666666666667i+5.]
     (* 22/7 i)                                [22/7i]

     (conjugate  [2/5i+3/5])                   [-2/5i+3/5]
     (conjugate [2/3])                         [2/3]
     (realpart [2i-3])                         -3
     (exp i)                                   [.841470984807896507i+.5403023058681397174]
     (log [1/3])                               -1.0986122886681096914
     (log [-1/3])                              [3.14159265358979323i-1.0986122886681096914]
     (exp (log [-1/3]))                        -.33333333333333
     (log (exp [-1/3]))                        -.33333333333333
     (log i)                                   [1.5707963267948966i]
     (exp (log i))                             [i]
     (log (exp i))                             [i]
     (exp (* i pi))                            -1.
     (abs (exp (* i pi))))                     1.
     (abs [-4i+3])                             5.

     (signum [10i+7.5])                        [.8i+.6]
     (signum [-14.7i])                         [-i]
     (signum [4/5])                            1
     (cis (/ pi 2))                            [i]
     (* (sqrt i) (sqrt i) (sqrt i) (sqrt i)))  -1.
     (* (sqrt (0- i)) (sqrt (0- i)))           [-i]
     (** (sqrt i) 2)                           [i]
     (sqrt (** i 2))                           [i]
     (sqrt -2/3)                               [.81649658092772603272i]
     (phase 3)                                 0
     (phase (exp (* i pi)))                    3.14159265358979323
     (phase i)                                 1.5707963267948966
     (phase [i+1])                             .785398163397448307
     (phase [-i+1])                            -.785398163397448307
     (phase [i-1])                             2.3561944901923449225
     (phase [-i-1])                            -2.3561944901923449225
     (abs [i+1])                               1.414213562373095049
     (signum (/ pi 2))                         1
     (log (exp [3i+2]))                        [3.i+2.]
     (log (exp [3i-2]))                        [3.i-2.]
     (log (exp [-3i+2]))                       [-3.i+2.]
     (log (exp [-3i-2]))                       [-3.i-2.]
     (exp (log [3i+2]))                        [3.i+2.]
     (exp (log [3i-2]))                        [3.i-2.]
     (exp (log [-3i+2]))                       [-3.i+2.]
     (exp (log [-3i-2]))                       [-3.i-2.]
     (sqrt [4i-1])                             [1.60048518044i+1.24962106769]
     (asin (sin i))                            [i]
     (sin (asin i)))                           [i]
     (cos (acos [i]))                          [i]
     (acos (cos [i]))                          [i]
     (atan (tan [i]))                          [i]
     (asinh (sinh i))                          [i]
     (sinh (asinh i)))                         [i]
     (cosh (acosh [i]))                        [i]
     (acosh (cosh [i]))                        [i]
     (atanh (tanh [i]))                        [i]

          (test-serie "Fin du test" ())

     ()                                        ()