UNPKG

1.5 kBtext/coffeescriptView Raw
1test_arg = ->
2 run_test [
3
4 # wrong
5 #"arg(-1)",
6 #"-pi",
7
8 "arg(pi)",
9 "0",
10
11 "arg(1+i)",
12 "1/4*pi",
13
14 "arg(1-i)",
15 "-1/4*pi",
16
17 "arg(-1+i)",
18 "3/4*pi",
19
20 "arg(-1-i)",
21 "-3/4*pi",
22
23 "arg((-1)^(1/3))",
24 "1/3*pi",
25
26 "arg(1+exp(i*pi/3))",
27 "1/6*pi",
28
29 "arg((-1)^(1/6)*exp(i*pi/6))",
30 "1/3*pi",
31
32 # check when not assuming real variables ----------
33 "assumeRealVariables = 0",
34 "",
35
36 "arg(a)",
37 "arg(a)",
38
39 # TODO this is wrong
40 #"arg(a*exp(b+i*pi/5))",
41 #"1/5*pi",
42
43 # this is wrong
44 #"arg(-1)",
45 #"-pi",
46
47 # this is also highly debatable
48 # take the example
49 # a = -1-i
50 # then arg(a) - arg(-a) should give pi
51 # but arg(1+i) - arg(-1-i) gives -pi instead
52 # "arg(-a)",
53 # "-pi+arg(a)",
54
55 "assumeRealVariables = 1",
56 "",
57 # --------------------------------------------------
58
59 # TODO this is wrong.
60 #"arg(a*exp(b+i*pi/5))",
61 #"1/5*pi",
62
63 # referencing the test above, if
64 # a is positive:
65 "arg(abs(a)*exp(b+i*pi/5))",
66 "1/5*pi",
67
68 # otherwise, if negative, we get:
69 "arg((-8)*exp(b+i*pi/5))",
70 "-4/5*pi",
71
72 # if a is positive, zero
73 # if a is negative, -pi, so
74 # we can't say much
75 "arg(a)",
76 "arg(a)",
77
78 # this is also wrong, this should
79 # be either zero or pi
80 #"arg(-a)",
81 #"-pi+arg(a)",
82
83 "arg(-(-1)^(1/3))",
84 "-2/3*pi",
85
86 "arg(-exp(i*pi/3))",
87 "-2/3*pi",
88
89 "arg(-i)",
90 "-1/2*pi",
91
92 "arg((a+b*i)/(c+d*i))",
93 "arctan(b/a)-arctan(d/c)",
94
95 "arg(((-1)^(1/2) / (3^(1/2)))^(1/2))",
96 "1/4*pi",
97
98 "arg((-1)^(1/6))",
99 "1/6*pi",
100
101
102 ]