Debian Codegraph @

reasoning/blogic/input/eulers-identity.n3

raw
1 # ----------------
2 # Euler's identity
3 # ----------------
4 #
5 # The most beautiful theorem in mathematics
6 #
7 # i*pi
8 # e + 1 = 0
9 #
10 # See https://en.wikipedia.org/wiki/Euler%27s_identity
11
12 @prefix math: <http://www.w3.org/2000/10/swap/math#>.
13 @prefix log: <http://www.w3.org/2000/10/swap/log#>.
14 @prefix complex: <http://eyereasoner.github.io/eye/complex#>.
15 @prefix : <urn:example:>.
16
17 # declare components
18 complex:sum a log:Component.
19 complex:exponentiation a log:Component.
20 complex:polar a log:Component.
21 complex:dial a log:Component.
22
23 # complex sum
24 (_:A _:B _:C _:D _:E _:F) log:onNegativeSurface {
25 () log:onNegativeSurface {
26 ((_:A _:B) (_:C _:D)) complex:sum (_:E _:F).
27 }.
28 (_:A _:C) math:sum _:E.
29 (_:B _:D) math:sum _:F.
30 }.
31
32 # complex exponentiation
33 (_:A _:B _:C _:D _:E _:F _:R _:T _:Z1 _:Z2 _:Z3 _:Z4 _:Z5 _:Z6 _:Z7 _:Z8 _:Z9 _:Z10) log:onNegativeSurface {
34 () log:onNegativeSurface {
35 ((_:A _:B) (_:C _:D)) complex:exponentiation (_:E _:F).
36 }.
37 (_:A _:B) complex:polar (_:R _:T).
38 (_:R _:C) math:exponentiation _:Z1.
39 _:D math:negation _:Z2.
40 (_:Z2 _:T) math:product _:Z3.
41 (2.718281828459045 _:Z3) math:exponentiation _:Z4.
42 (2.718281828459045 _:Z5) math:exponentiation _:R.
43 (_:D _:Z5) math:product _:Z6.
44 (_:C _:T) math:product _:Z7.
45 (_:Z6 _:Z7) math:sum _:Z8.
46 _:Z8 math:cos _:Z9.
47 (_:Z1 _:Z4 _:Z9) math:product _:E.
48 _:Z8 math:sin _:Z10.
49 (_:Z1 _:Z4 _:Z10) math:product _:F.
50 }.
51
52 # complex polar
53 (_:X _:Y _:R _:T _:Tp _:Z1 _:Z2 _:Z3 _:Z4 _:Z5) log:onNegativeSurface {
54 () log:onNegativeSurface {
55 (_:X _:Y) complex:polar (_:R _:Tp).
56 }.
57 (_:X 2) math:exponentiation _:Z1.
58 (_:Y 2) math:exponentiation _:Z2.
59 (_:Z1 _:Z2) math:sum _:Z3.
60 (_:Z3 0.5) math:exponentiation _:R.
61 _:X math:absoluteValue _:Z4.
62 (_:Z4 _:R) math:quotient _:Z5.
63 _:Z5 math:acos _:T.
64 (_:X _:Y _:T) complex:dial _:Tp.
65 }.
66
67 # complex dial
68 (_:X _:Y _:T _:Tp) log:onNegativeSurface {
69 () log:onNegativeSurface {
70 (_:X _:Y _:T) complex:dial _:Tp.
71 }.
72 _:X math:notLessThan 0.
73 _:Y math:notLessThan 0.
74 (0 _:T) math:sum _:Tp.
75 }.
76
77 (_:X _:Y _:T _:Tp) log:onNegativeSurface {
78 () log:onNegativeSurface {
79 (_:X _:Y _:T) complex:dial _:Tp.
80 }.
81 _:X math:lessThan 0.
82 _:Y math:notLessThan 0.
83 (3.141592653589793 _:T) math:difference _:Tp.
84 }.
85
86 (_:X _:Y _:T _:Tp) log:onNegativeSurface {
87 () log:onNegativeSurface {
88 (_:X _:Y _:T) complex:dial _:Tp.
89 }.
90 _:X math:lessThan 0.
91 _:Y math:lessThan 0.
92 (3.141592653589793 _:T) math:sum _:Tp.
93 }.
94
95 (_:X _:Y _:T _:Tp) log:onNegativeSurface {
96 () log:onNegativeSurface {
97 (_:X _:Y _:T) complex:dial _:Tp.
98 }.
99 _:X math:notLessThan 0.
100 _:Y math:lessThan 0.
101 (3.141592653589793 2) math:product _:Z1.
102 (_:Z1 _:T) math:difference _:Tp.
103 }.
104
105 # query
106 (_:A _:B _:C _:D) log:onNegativeSurface {
107 ((2.718281828459045 0) (0 3.141592653589793)) complex:exponentiation (_:A _:B).
108 ((_:A _:B) (1 0)) complex:sum (_:C _:D).
109 () log:onNegativeAnswerSurface {
110 ((2.718281828459045 0) (0 3.141592653589793)) complex:exponentiation (_:A _:B).
111 ((_:A _:B) (1 0)) complex:sum (_:C _:D).
112 }.
113 }.