def c8_div_test(): # *****************************************************************************80 # ## C8_DIV_TEST tests C8_DIV. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 print "" print "C8_DIV_TEST" print " C8_DIV divides two C8s." print "" print " C1=C8_UNIFORM_01 C2=C8_UNIFORM_01 C3=C8_DIV(C1,C2) C4=C1/C2" print " --------------------- --------------------- --------------------- ---------------------" print "" seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) c2, seed = c8_uniform_01(seed) c3 = c8_div(c1, c2) c4 = c1 / c2 print " (%12f,%12f) (%12f,%12f) (%12f,%12f) (%12f,%12f)" % ( c1.real, c1.imag, c2.real, c2.imag, c3.real, c3.imag, c4.real, c4.imag, ) print "" print "C8_DIV_TEST:" print " Normal end of execution." return
def c8_mul_test(): #*****************************************************************************80 # ## C8_MUL_TEST tests C8_MUL. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 print '' print 'C8_MUL_TEST' print ' C8_MUL multiplies two C8s.' print '' print ' C1=C8_UNIFORM_01 C2=C8_UNIFORM_01 C3=C8_MUL(C1,C2) C4=C1*C2' print ' --------------------- --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) c2, seed = c8_uniform_01(seed) c3 = c8_mul(c1, c2) c4 = c1 * c2 print ' (%12f,%12f) (%12f,%12f) (%12f,%12f) (%12f,%12f)' \ % ( c1.real, c1.imag, c2.real, c2.imag, c3.real, c3.imag, c4.real, c4.imag ) print '' print 'C8_MUL_TEST:' print ' Normal end of execution.' return
def c8_mul_test ( ): #*****************************************************************************80 # ## C8_MUL_TEST tests C8_MUL. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 print '' print 'C8_MUL_TEST' print ' C8_MUL multiplies two C8s.' print '' print ' C1=C8_UNIFORM_01 C2=C8_UNIFORM_01 C3=C8_MUL(C1,C2) C4=C1*C2' print ' --------------------- --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) c2, seed = c8_uniform_01 ( seed ) c3 = c8_mul ( c1, c2 ) c4 = c1 * c2 print ' (%12f,%12f) (%12f,%12f) (%12f,%12f) (%12f,%12f)' \ % ( c1.real, c1.imag, c2.real, c2.imag, c3.real, c3.imag, c4.real, c4.imag ) print '' print 'C8_MUL_TEST:' print ' Normal end of execution.' return
def c8_le_l1_test(): #*****************************************************************************80 # ## C8_LE_L1_TEST tests C8_LE_L1. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 19 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print '' print 'C8_LE_L1_TEST' print ' C8_LE_L1 evalues (C1 <= C2) using the L1 norm.' print '' print ' C1=C8_UNIFORM_01 C2=C8_UNIFORM_01 L3=C8_LE_L1(C1,C2)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) c2, seed = c8_uniform_01(seed) l3 = c8_le_l1(c1, c2) print ' (%12f,%12f) (%12f,%12f) %s' \ % ( c1.real, c1.imag, c2.real, c2.imag, l3 ) print '' print 'C8_LE_L1_TEST:' print ' Normal end of execution.' return
def c8_le_li_test ( ): #*****************************************************************************80 # ## C8_LE_LI_TEST tests C8_LE_LI. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 19 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print '' print 'C8_LE_LI_TEST' print ' C8_LE_LI evalues (C1 <= C2) using the Loo norm.' print '' print ' C1=C8_UNIFORM_01 C2=C8_UNIFORM_01 L3=C8_LE_LI(C1,C2)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) c2, seed = c8_uniform_01 ( seed ) l3 = c8_le_li ( c1, c2 ) print ' (%12f,%12f) (%12f,%12f) %s' \ % ( c1.real, c1.imag, c2.real, c2.imag, l3 ) print '' print 'C8_LE_LI_TEST:' print ' Normal end of execution.' return
def c8_div_r8_test ( ): #*****************************************************************************80 # ## C8_DIV_R8_TEST tests C8_DIV_R8. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 from r8_uniform_01 import r8_uniform_01 print '' print 'C8_DIV_R8_TEST' print ' C8_DIV_R8 divides a C8 by an R8.' print '' print ' C1=C8_UNIFORM_01 R2=R8_UNIFORM_01 C3=C8_DIV_R8(C1,RC2) C4=C1/R2' print ' --------------------- --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) r2, seed = r8_uniform_01 ( seed ) c3 = c8_div_r8 ( c1, r2 ) c4 = c1 / r2 print ' (%12f,%12f) %12f (%12f,%12f) (%12f,%12f)' \ % ( c1.real, c1.imag, r2, c3.real, c3.imag, c4.real, c4.imag ) print '' print 'C8_DIV_R8_TEST:' print ' Normal end of execution.' return
def c8_div_r8_test(): #*****************************************************************************80 # ## C8_DIV_R8_TEST tests C8_DIV_R8. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 from r8_uniform_01 import r8_uniform_01 print '' print 'C8_DIV_R8_TEST' print ' C8_DIV_R8 divides a C8 by an R8.' print '' print ' C1=C8_UNIFORM_01 R2=R8_UNIFORM_01 C3=C8_DIV_R8(C1,RC2) C4=C1/R2' print ' --------------------- --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) r2, seed = r8_uniform_01(seed) c3 = c8_div_r8(c1, r2) c4 = c1 / r2 print ' (%12f,%12f) %12f (%12f,%12f) (%12f,%12f)' \ % ( c1.real, c1.imag, r2, c3.real, c3.imag, c4.real, c4.imag ) print '' print 'C8_DIV_R8_TEST:' print ' Normal end of execution.' return
def c8_cosh_test ( ): #*****************************************************************************80 # ## C8_COSH_TEST tests C8_COSH. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_acosh import c8_acosh from c8_uniform_01 import c8_uniform_01 print '' print 'C8_COSH_TEST' print ' C8_COSH computes the cosine of a C8.' print '' print ' C1=C8_UNIFORM_01 C2=C8_COSH(C1) C3=C8_ACOSH(C2)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) c2 = c8_cosh ( c1 ) c3 = c8_acosh ( c2 ); print ' (%12f,%12f) (%12f,%12f) (%12f,%12f)' \ % ( c1.real, c1.imag, c2.real, c2.imag, c3.real, c3.imag ) print '' print 'C8_COSH_TEST:' print ' Normal end of execution.' return
def c8_exp_test ( ): #*****************************************************************************80 # ## C8_EXP_TEST tests C8_EXP. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 11 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_log import c8_log from c8_uniform_01 import c8_uniform_01 print '' print 'C8_EXP_TEST' print ' C8_EXP computes the exponential of a C8.' print '' print ' C1=C8_UNIFORM_01 C2=C8_EXP(C1) C3=C8_LOG(C2)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) c2 = c8_exp ( c1 ) c3 = c8_log ( c2 ); print ' (%12f,%12f) (%12f,%12f) (%12f,%12f)' \ % ( c1.real, c1.imag, c2.real, c2.imag, c3.real, c3.imag ) print '' print 'C8_EXP_TEST:' print ' Normal end of execution.' return
def c8_acos_test ( ): #*****************************************************************************80 # ## C8_ACOS_TEST tests C8_ACOS. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_cos import c8_cos from c8_uniform_01 import c8_uniform_01 print '' print 'C8_ACOS_TEST' print ' C8_ACOS computes the inverse cosine of a C8.' print '' print ' C1=C8_UNIFORM_01 C2=C8_ACOS(C1) C3=C8_COS(C2)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) c2 = c8_acos ( c1 ) c3 = c8_cos ( c2 ); print ' (%12f,%12f) (%12f,%12f) (%12f,%12f)' \ % ( c1.real, c1.imag, c2.real, c2.imag, c3.real, c3.imag ) print '' print 'C8_ACOS_TEST:' print ' Normal end of execution.' return
def c8_to_polar_test(): #*****************************************************************************80 # ## C8_TO_POLAR_TEST tests C8_TO_POLAR. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 from polar_to_c8 import polar_to_c8 print '' print 'C8_TO_POLAR_TEST' print ' C8_TO_POLAR computes the polar form of a C8.' print '' print ' C1=C8_UNIFORM_01 (R2,T2)=C8_TO_POLAR(C1) C3=POLAR_TO_C8(R2,T2)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) r2, t2 = c8_to_polar(c1) c3 = polar_to_c8(r2, t2) print ' (%12f,%12f) (%12f,%12f) (%12f,%12f)' % ( c1.real, c1.imag, r2, t2, c3.real, c3.imag) print '' print 'C8_TO_POLAR_TEST:' print ' Normal end of execution.' return
def c8_to_cartesian_test(): #*****************************************************************************80 # ## C8_TO_CARTESIAN_TEST tests C8_TO_CARTESIAN. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 13 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 from cartesian_to_c8 import cartesian_to_c8 print '' print 'C8_TO_CARTESIAN_TEST' print ' C8_TO_CARTESIAN computes the cartesian form of a C8.' print '' print ' C1=C8_UNIFORM_01 (X2,Y2)=C8_TO_CARTESIAN(C1) C3=CARTESIAN_TO_C8(X2,Y2)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) x2, y2 = c8_to_cartesian(c1) c3 = cartesian_to_c8(x2, y2) print ' (%12f,%12f) (%12f,%12f) (%12f,%12f)' % ( c1.real, c1.imag, x2, y2, c3.real, c3.imag) print '' print 'C8_TO_CARTESIAN_TEST:' print ' Normal end of execution.' return
def c8_mag_test(): #*****************************************************************************80 # ## C8_MAG_TEST tests C8_MAG. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 09 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 print '' print 'C8_MAG_TEST' print ' C8_MAG computes the magnitude of a C8.' print '' print ' C1=C8_UNIFORM_01 R2=C8_MAG(C1) R3=NP.ABSOLUTE(C1)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) r2 = c8_mag(c1) r3 = np.absolute(c1) print ' (%12f,%12f) %12f %12f' % (c1.real, c1.imag, r2, r3) print '' print 'C8_MAG_TEST:' print ' Normal end of execution.' return
def c8_to_cartesian_test ( ): #*****************************************************************************80 # ## C8_TO_CARTESIAN_TEST tests C8_TO_CARTESIAN. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 13 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 from cartesian_to_c8 import cartesian_to_c8 print '' print 'C8_TO_CARTESIAN_TEST' print ' C8_TO_CARTESIAN computes the cartesian form of a C8.' print '' print ' C1=C8_UNIFORM_01 (X2,Y2)=C8_TO_CARTESIAN(C1) C3=CARTESIAN_TO_C8(X2,Y2)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) x2, y2 = c8_to_cartesian ( c1 ) c3 = cartesian_to_c8 ( x2, y2 ) print ' (%12f,%12f) (%12f,%12f) (%12f,%12f)' % ( c1.real, c1.imag, x2, y2, c3.real, c3.imag ) print '' print 'C8_TO_CARTESIAN_TEST:' print ' Normal end of execution.' return
def c8_to_polar_test ( ): #*****************************************************************************80 # ## C8_TO_POLAR_TEST tests C8_TO_POLAR. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 12 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 from polar_to_c8 import polar_to_c8 print '' print 'C8_TO_POLAR_TEST' print ' C8_TO_POLAR computes the polar form of a C8.' print '' print ' C1=C8_UNIFORM_01 (R2,T2)=C8_TO_POLAR(C1) C3=POLAR_TO_C8(R2,T2)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) r2, t2 = c8_to_polar ( c1 ) c3 = polar_to_c8 ( r2, t2 ) print ' (%12f,%12f) (%12f,%12f) (%12f,%12f)' % ( c1.real, c1.imag, r2, t2, c3.real, c3.imag ) print '' print 'C8_TO_POLAR_TEST:' print ' Normal end of execution.' return
def c8_abs_test(): #*****************************************************************************80 # ## C8_ABS_TEST tests C8_ABS. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 08 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print '' print 'C8_ABS_TEST' print ' C8_ABS computes the absolute value of a C8.' print '' print ' C1=C8_UNIFORM_01 R2=C8_ABS(C1) R3=ABS(C1)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) r2 = c8_abs(c1) r3 = abs(c1) print ' (%12f,%12f) %12f %12f' % (c1.real, c1.imag, r2, r3) print '' print 'C8_ABS_TEST:' print ' Normal end of execution.' return
def c8_sqrt_test ( ): #*****************************************************************************80 # ## C8_SQRT_TEST tests C8_SQRT. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 10 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print '' print 'C8_SQRT_TEST' print ' C8_SQRT computes the square root of a C8.' print '' print ' C1=C8_UNIFORM_01 C2=C8_SQRT(C1) C3=C2*C2' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) c2 = c8_sqrt ( c1 ) c3 = c2 * c2; print ' (%12f,%12f) (%12f,%12f) (%12f,%12f)' \ % ( c1.real, c1.imag, c2.real, c2.imag, c3.real, c3.imag ) print '' print 'C8_SQRT_TEST:' print ' Normal end of execution.' return
def c8_sqrt_test(): #*****************************************************************************80 # ## C8_SQRT_TEST tests C8_SQRT. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 10 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print '' print 'C8_SQRT_TEST' print ' C8_SQRT computes the square root of a C8.' print '' print ' C1=C8_UNIFORM_01 C2=C8_SQRT(C1) C3=C2*C2' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) c2 = c8_sqrt(c1) c3 = c2 * c2 print ' (%12f,%12f) (%12f,%12f) (%12f,%12f)' \ % ( c1.real, c1.imag, c2.real, c2.imag, c3.real, c3.imag ) print '' print 'C8_SQRT_TEST:' print ' Normal end of execution.' return
def c8_mag_test ( ): #*****************************************************************************80 # ## C8_MAG_TEST tests C8_MAG. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 09 February 2015 # # Author: # # John Burkardt # import numpy as np from c8_uniform_01 import c8_uniform_01 print '' print 'C8_MAG_TEST' print ' C8_MAG computes the magnitude of a C8.' print '' print ' C1=C8_UNIFORM_01 R2=C8_MAG(C1) R3=NP.ABSOLUTE(C1)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) r2 = c8_mag ( c1 ) r3 = np.absolute ( c1 ) print ' (%12f,%12f) %12f %12f' % ( c1.real, c1.imag, r2, r3 ) print '' print 'C8_MAG_TEST:' print ' Normal end of execution.' return
def c8_nint_test(): # *****************************************************************************80 # ## C8_NINT_TEST tests C8_NINT. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 15 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print "" print "C8_NINT_TEST" print " C8_NINT computes the nearest integer to a C8." print "" print " C1=10*C8_UNIFORM_01 C2=C8_NINT(C1)" print " --------------------- ---------------------" print "" seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) c1 = 10.0 * c1 c2 = c8_nint(c1) print " (%12f,%12f) (%12f,%12f)" % (c1.real, c1.imag, c2.real, c2.imag) print "" print "C8_NINT_TEST:" print " Normal end of execution." return
def c8_imag_test ( ): #*****************************************************************************80 # ## C8_IMAG_TEST tests C8_IMAG. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 10 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print '' print 'C8_IMAG_TEST' print ' C8_IMAG computes the imaginary part of a C8.' print '' print ' C1=C8_UNIFORM_01 R2=C8_IMAG(C1) R3=C1.IMAG' print ' --------------------- --------------------- ------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) r2 = c8_imag ( c1 ) r3 = c1.imag print ' (%12f,%12f) %12f %12f' % ( c1.real, c1.imag, r2, r3 ) print '' print 'C8_IMAG_TEST:' print ' Normal end of execution.' return
def c8_abs_test ( ): #*****************************************************************************80 # ## C8_ABS_TEST tests C8_ABS. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 08 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print '' print 'C8_ABS_TEST' print ' C8_ABS computes the absolute value of a C8.' print '' print ' C1=C8_UNIFORM_01 R2=C8_ABS(C1) R3=ABS(C1)' print ' --------------------- --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) r2 = c8_abs ( c1 ) r3 = abs ( c1 ) print ' (%12f,%12f) %12f %12f' % ( c1.real, c1.imag, r2, r3 ) print '' print 'C8_ABS_TEST:' print ' Normal end of execution.' return
def c8_norm_l2_test(): #*****************************************************************************80 # ## C8_NORM_L2_TEST tests C8_NORM_L2. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 23 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print '' print 'C8_NORM_L2_TEST' print ' C8_NORM_L2 computes the L2 norm of a C8.' print '' print ' C1=C8_UNIFORM_01 R2=C8_NORM_L21(C1)' print ' --------------------- ---------------------' print '' seed = 123456789 for i in range(0, 10): c1, seed = c8_uniform_01(seed) r2 = c8_norm_l2(c1) print ' (%12f,%12f) %12f' % (c1.real, c1.imag, r2) print '' print 'C8_NORM_L2_TEST:' print ' Normal end of execution.' return
def c8_norm_l2_test ( ): #*****************************************************************************80 # ## C8_NORM_L2_TEST tests C8_NORM_L2. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 23 February 2015 # # Author: # # John Burkardt # from c8_uniform_01 import c8_uniform_01 print '' print 'C8_NORM_L2_TEST' print ' C8_NORM_L2 computes the L2 norm of a C8.' print '' print ' C1=C8_UNIFORM_01 R2=C8_NORM_L21(C1)' print ' --------------------- ---------------------' print '' seed = 123456789 for i in range ( 0, 10 ): c1, seed = c8_uniform_01 ( seed ) r2 = c8_norm_l2 ( c1 ) print ' (%12f,%12f) %12f' % ( c1.real, c1.imag, r2 ) print '' print 'C8_NORM_L2_TEST:' print ' Normal end of execution.' return