with text_io; use text_io; with generic_complex_types; with generic_real_arrays; with generic_complex_arrays; with generic_complex_elementary_functions; with complex_io; with mathematical_constants; procedure test_gcef_plot_2 is type real is digits 9; package complex_types is new generic_complex_types(real); use complex_types; -- make operators visible for user -- make subprograms visible for instantiations package cx_io is new complex_io(real, complex); use cx_io; package complex_elementary_functions is new generic_complex_elementary_functions(real, complex, imaginary); use complex_elementary_functions; package real_arrays is new generic_real_arrays(real); use real_arrays; package complex_arrays is new generic_complex_arrays (real, real_vector, real_matrix, complex); use complex_arrays; argument_error : exception renames complex_types.argument_error; complex_one : complex := (1.0,0.0); complex_zero : complex := (0.0,0.0); complex_i : complex := (0.0,1.0); pi : real := mathematical_constants.pi+0.01; tpi : real := 2.0*pi; samples : constant := 44; K : array(integer(-samples)..samples) of real; P : COMPLEX_VECTOR ( 1..k'length*k'length); l1 : string(1..45) := "-2Pi -Pi -P/2 -1 0 +1 +P/2 +Pi +2Pi "; l2 : string(1..45) := " | | | | | | | | | "; l3 : string(1..45) := " | | | | | | | | | "; l4 : string(1..45) := "---+---+---+---+---+---+---+---+---+--- +i2Pi"; l5 : string(1..45) := " | | | | | | | | | "; l6 : string(1..45) := "---+---+---+---+---+---+---+---+---+--- +iPi "; l7 : string(1..45) := " | | | | | | | | | "; l8 : string(1..45) := "---+---+---+---+---+---+---+---+---+--- +iP/2"; l9 : string(1..45) := " | | | | | | | | | "; l10: string(1..45) := "---+---+---+---+---+---+---+---+---+--- +1 "; l11: string(1..45) := " | | | | | | | | | "; l12: string(1..45) := "---+---+---+---+---+---+---+---+---+--- 0 "; l13: string(1..45) := " | | | | | | | | | "; l14: string(1..45) := "---+---+---+---+---+---+---+---+---+--- -1 "; l15: string(1..45) := " | | | | | | | | | "; l16: string(1..45) := "---+---+---+---+---+---+---+---+---+--- -iP/2"; l17: string(1..45) := " | | | | | | | | | "; l18: string(1..45) := "---+---+---+---+---+---+---+---+---+--- -iPi "; l19: string(1..45) := " | | | | | | | | | "; l20: string(1..45) := "---+---+---+---+---+---+---+---+---+--- -i2Pi"; l21: string(1..45) := " | | | | | | | | | "; l22: string(1..45) := " | | | | | | | | | "; procedure plot(name:string) is begin new_line; put_line(name); new_line; put_line(L1); put_line(L2); put_line(L3); put_line(L4); put_line(L5); put_line(L6); put_line(L7); put_line(L8); put_line(L9); put_line(L10); put_line(L11); put_line(L12); put_line(L13); put_line(L14); put_line(L15); put_line(L16); put_line(L17); put_line(L18); put_line(L19); put_line(L20); put_line(L21); put_line(L22); new_line; L3 (2..38):=" | | | | | | | | | "; L5 (2..38):=" | | | | | | | | | "; L7 (2..38):=" | | | | | | | | | "; L9 (2..38):=" | | | | | | | | | "; L11(2..38):=" | | | | | | | | | "; L13(2..38):=" | | | | | | | | | "; L15(2..38):=" | | | | | | | | | "; L17(2..38):=" | | | | | | | | | "; L19(2..38):=" | | | | | | | | | "; L21(2..38):=" | | | | | | | | | "; end plot; procedure draw ( z: complex) is x : real := RE(z); y : real := IM(z); begin if x > TPi then if y > TPi then L3 (38):='X'; elsif y > Pi then L5 (38):='X'; elsif y > Pi/2.0 then L7 (38):='X'; elsif y > 1.01 then L9 (38):='X'; elsif y > 0.0 then L11(38):='X'; elsif y < -TPi then L21(38):='X'; elsif y < -Pi then L19(38):='X'; elsif y < -Pi/2.0 then L17(38):='X'; elsif y < -1.01 then L15(38):='X'; elsif y < 0.0 then L13(38):='X'; end if; elsif x > Pi then if y > TPi then L3 (34):='X'; elsif y > Pi then L5 (34):='X'; elsif y > Pi/2.0 then L7 (34):='X'; elsif y > 1.01 then L9 (34):='X'; elsif y > 0.0 then L11(34):='X'; elsif y < -TPi then L21(34):='X'; elsif y < -Pi then L19(34):='X'; elsif y < -Pi/2.0 then L17(34):='X'; elsif y < -1.01 then L15(34):='X'; elsif y < 0.0 then L13(34):='X'; end if; elsif x > Pi/2.0 then if y > TPi then L3 (30):='X'; elsif y > Pi then L5 (30):='X'; elsif y > Pi/2.0 then L7 (30):='X'; elsif y > 1.01 then L9 (30):='X'; elsif y > 0.0 then L11(30):='X'; elsif y < -TPi then L21(30):='X'; elsif y < -Pi then L19(30):='X'; elsif y < -Pi/2.0 then L17(30):='X'; elsif y < -1.01 then L15(30):='X'; elsif y < 0.0 then L13(30):='X'; end if; elsif x > 1.01 then if y > TPi then L3 (26):='X'; elsif y > Pi then L5 (26):='X'; elsif y > Pi/2.0 then L7 (26):='X'; elsif y > 1.01 then L9 (26):='X'; elsif y > 0.0 then L11(26):='X'; elsif y < -TPi then L21(26):='X'; elsif y < -Pi then L19(26):='X'; elsif y < -Pi/2.0 then L17(26):='X'; elsif y < -1.01 then L15(26):='X'; elsif y < 0.0 then L13(26):='X'; end if; elsif x > 0.0 then if y > TPi then L3 (22):='X'; elsif y > Pi then L5 (22):='X'; elsif y > Pi/2.0 then L7 (22):='X'; elsif y > 1.01 then L9 (22):='X'; elsif y > 0.0 then L11(22):='X'; elsif y < -TPi then L21(22):='X'; elsif y < -Pi then L19(22):='X'; elsif y < -Pi/2.0 then L17(22):='X'; elsif y < -1.01 then L15(22):='X'; elsif y < 0.0 then L13(22):='X'; end if; elsif x < -TPi then if y > TPi then L3 (02):='X'; elsif y > Pi then L5 (02):='X'; elsif y > Pi/2.0 then L7 (02):='X'; elsif y > 1.01 then L9 (02):='X'; elsif y > 0.0 then L11(02):='X'; elsif y < -TPi then L21(02):='X'; elsif y < -Pi then L19(02):='X'; elsif y < -Pi/2.0 then L17(02):='X'; elsif y < -1.01 then L15(02):='X'; elsif y < 0.0 then L13(02):='X'; end if; elsif x < -Pi then if y > TPi then L3 (06):='X'; elsif y > Pi then L5 (06):='X'; elsif y > Pi/2.0 then L7 (06):='X'; elsif y > 1.01 then L9 (06):='X'; elsif y > 0.0 then L11(06):='X'; elsif y < -TPi then L21(06):='X'; elsif y < -Pi then L19(06):='X'; elsif y < -Pi/2.0 then L17(06):='X'; elsif y < -1.01 then L15(06):='X'; elsif y < 0.0 then L13(06):='X'; end if; elsif x < -Pi/2.0 then if y > TPi then L3 (10):='X'; elsif y > Pi then L5 (10):='X'; elsif y > Pi/2.0 then L7 (10):='X'; elsif y > 1.01 then L9 (10):='X'; elsif y > 0.0 then L11(10):='X'; elsif y < -TPi then L21(10):='X'; elsif y < -Pi then L19(10):='X'; elsif y < -Pi/2.0 then L17(10):='X'; elsif y < -1.01 then L15(10):='X'; elsif y < 0.0 then L13(10):='X'; end if; elsif x < -1.01 then if y > TPi then L3 (14):='X'; elsif y > Pi then L5 (14):='X'; elsif y > Pi/2.0 then L7 (14):='X'; elsif y > 1.01 then L9 (14):='X'; elsif y > 0.0 then L11(14):='X'; elsif y < -TPi then L21(14):='X'; elsif y < -Pi then L19(14):='X'; elsif y < -Pi/2.0 then L17(14):='X'; elsif y < -1.01 then L15(14):='X'; elsif y < 0.0 then L13(14):='X'; end if; elsif x < 0.0 then if y > TPi then L3 (18):='X'; elsif y > Pi then L5 (18):='X'; elsif y > Pi/2.0 then L7 (18):='X'; elsif y > 1.01 then L9 (18):='X'; elsif y > 0.0 then L11(18):='X'; elsif y < -TPi then L21(18):='X'; elsif y < -Pi then L19(18):='X'; elsif y < -Pi/2.0 then L17(18):='X'; elsif y < -1.01 then L15(18):='X'; elsif y < 0.0 then L13(18):='X'; end if; end if; end draw; function "*"(z:complex;x:real) return complex is begin return compose_from_cartesian(RE(z)*x,IM(z)); end "*"; begin -- test at interesting points like (0,0) (1,0) (-1,0) (pi,0) (-pi,0) k(0) := 0.0; k(1) := 0.0000001; k(2) := 0.000001; k(3) := 0.00001; k(4) := 0.001; k(5) := 0.01; k(6) := 0.02; k(7) := 0.06; k(8) := 0.1; k(9) := 0.2; k(10) := 0.25; k(11) := 0.35; k(12) := 0.5; k(13) := 0.7071; k(14) := 0.785; k(15) := 0.786; k(16) := 0.97; k(17) := 0.999; k(18) := 1.0; k(19) := 1.001; k(20) := 1.1; k(21) := 1.01; k(22) := 1.25; k(23) := 1.35; k(24) := 1.41421; k(25) := 1.5; k(26) := 1.54; k(27) := 1.57079; k(28) := 1.63; k(29) := 2.0; k(30) := 2.2; k(31) := 2.4; k(32) := 2.71828; k(33) := 3.0; k(34) := 3.141; k(35) := 3.142; k(36) := 8.0; k(37) := 12.0; k(38) := 16.0; k(39) := 20.0; k(40) := 30.0; k(41) := 64.0; k(42) := 500.0; k(43) := 1000.0; k(44) := 2500.0; for i in 1..k'last loop k(-i) := -k(i); end loop; for i in k'range loop for j in k'range loop P((i-k'first)*k'length+(j-k'first)+1) := compose_from_cartesian(k(i),k(j)); end loop; end loop; for i in p'range loop begin draw(sqrt(p(i))); exception when others => null; end; end loop; plot("SQRT"); for i in p'range loop begin draw(log(p(i))); exception when others => null; end; end loop; plot("LOG"); for i in p'range loop begin draw(exp(p(i))); exception when others => null; end; end loop; plot("EXP"); for i in p'range loop begin draw(sin(p(i))); exception when others => null; end; end loop; plot("SIN"); for i in p'range loop begin draw(cos(p(i))); exception when others => null; end; end loop; plot("COS"); for i in p'range loop begin draw(tan(p(i))); exception when others => null; end; end loop; plot("TAN"); for i in p'range loop begin draw(cot(p(i))); exception when others => null; end; end loop; plot("COT"); for i in p'range loop begin draw(arcsin(p(i))); exception when others => null; end; end loop; plot("ARCSIN"); for i in p'range loop begin draw(arccos(p(i))); exception when others => null; end; end loop; plot("ARCCOS"); for i in p'range loop begin draw(arctan(p(i))); exception when others => null; end; end loop; plot("ARCTAN"); for i in p'range loop begin draw(arccot(p(i))); exception when others => null; end; end loop; plot("ARCCOT"); for i in p'range loop begin draw(sinh(p(i))); exception when others => null; end; end loop; plot("SINH"); for i in p'range loop begin draw(cosh(p(i))); exception when others => null; end; end loop; plot("COSH"); for i in p'range loop begin draw(tanh(p(i))); exception when others => null; end; end loop; plot("TANH"); for i in p'range loop begin draw(coth(p(i))); exception when others => null; end; end loop; plot("COTH"); for i in p'range loop begin draw(arcsinh(p(i))); exception when others => null; end; end loop; plot("ARCSINH"); for i in p'range loop begin draw(arccosh(p(i))); exception when others => null; end; end loop; plot("ARCCOSH"); for i in p'range loop begin draw(arctanh(p(i))); exception when others => null; end; end loop; plot("ARCTANH"); for i in p'range loop begin draw(arccoth(p(i))); exception when others => null; end; end loop; plot("ARCCOTH"); for i in p'range loop begin draw("**"(p(i),complex_one)); draw("**"(p(i),complex_i)); draw("**"(p(i),-complex_i)); draw("**"(p(i),-complex_one)); exception when others => null; end; end loop; plot("**"); end test_gcef_plot_2;