1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | Eval_circexp = ->
|
20 | push(cadr(p1))
|
21 | Eval()
|
22 |
|
23 | circexp()
|
24 |
|
25 |
|
26 |
|
27 | Eval()
|
28 |
|
29 | circexp = ->
|
30 | i = 0
|
31 | h = 0
|
32 | save()
|
33 | p1 = pop()
|
34 |
|
35 | if (car(p1) == symbol(COS))
|
36 | push(cadr(p1))
|
37 | expcos()
|
38 | restore()
|
39 | return
|
40 |
|
41 | if (car(p1) == symbol(SIN))
|
42 | push(cadr(p1))
|
43 | expsin()
|
44 | restore()
|
45 | return
|
46 |
|
47 | if (car(p1) == symbol(TAN))
|
48 | p1 = cadr(p1)
|
49 | push(imaginaryunit)
|
50 | push(p1)
|
51 | multiply()
|
52 | exponential()
|
53 | p2 = pop()
|
54 | push(imaginaryunit)
|
55 | push(p1)
|
56 | multiply()
|
57 | negate()
|
58 | exponential()
|
59 | p3 = pop()
|
60 | push(p3)
|
61 | push(p2)
|
62 | subtract()
|
63 | push(imaginaryunit)
|
64 | multiply()
|
65 | push(p2)
|
66 | push(p3)
|
67 | add()
|
68 | divide()
|
69 | restore()
|
70 | return
|
71 |
|
72 | if (car(p1) == symbol(COSH))
|
73 | p1 = cadr(p1)
|
74 | push(p1)
|
75 | exponential()
|
76 | push(p1)
|
77 | negate()
|
78 | exponential()
|
79 | add()
|
80 | push_rational(1, 2)
|
81 | multiply()
|
82 | restore()
|
83 | return
|
84 |
|
85 | if (car(p1) == symbol(SINH))
|
86 | p1 = cadr(p1)
|
87 | push(p1)
|
88 | exponential()
|
89 | push(p1)
|
90 | negate()
|
91 | exponential()
|
92 | subtract()
|
93 | push_rational(1, 2)
|
94 | multiply()
|
95 | restore()
|
96 | return
|
97 |
|
98 | if (car(p1) == symbol(TANH))
|
99 | p1 = cadr(p1)
|
100 | push(p1)
|
101 | push_integer(2)
|
102 | multiply()
|
103 | exponential()
|
104 | p1 = pop()
|
105 | push(p1)
|
106 | push_integer(1)
|
107 | subtract()
|
108 | push(p1)
|
109 | push_integer(1)
|
110 | add()
|
111 | divide()
|
112 | restore()
|
113 | return
|
114 |
|
115 | if (iscons(p1))
|
116 | h = tos
|
117 | while (iscons(p1))
|
118 | push(car(p1))
|
119 | circexp()
|
120 | p1 = cdr(p1)
|
121 | list(tos - h)
|
122 | restore()
|
123 | return
|
124 |
|
125 | if (p1.k == TENSOR)
|
126 | push(p1)
|
127 | copy_tensor()
|
128 | p1 = pop()
|
129 | for i in [0...p1.tensor.nelem]
|
130 | push(p1.tensor.elem[i])
|
131 | circexp()
|
132 | p1.tensor.elem[i] = pop()
|
133 | push(p1)
|
134 | restore()
|
135 | return
|
136 |
|
137 | push(p1)
|
138 | restore()
|
139 |
|
140 |
|