@@ -160,37 +160,14 @@ for f in [identity, one, zero, *, +, -]
160
160
end
161
161
162
162
promote_symtype (:: typeof (Base. real), T:: Type{<:Number} ) = Real
163
+ Base. real (s:: Symbolic{<:Number} ) = islike (s, Real) ? s : term (real, s)
163
164
promote_symtype (:: typeof (Base. conj), T:: Type{<:Number} ) = T
165
+ Base. conj (s:: Symbolic{<:Number} ) = islike (s, Real) ? s : term (conj, s)
164
166
promote_symtype (:: typeof (Base. imag), T:: Type{<:Number} ) = Real
165
- function Base. real (s:: Symbolic{<:Number} )
166
- if iscall (s)
167
- f = operation (s)
168
- args = map (real, arguments (s))
169
- return f (args... )
170
- else
171
- islike (s, Real) ? s : term (real, s)
172
- end
173
- end
174
- function Base. conj (s:: Symbolic{<:Number} )
175
- if iscall (s)
176
- f = operation (s)
177
- args = map (conj, arguments (s))
178
- return f (args... )
179
- else
180
- islike (s, Real) ? s : term (conj, s)
181
- end
182
- end
183
- function Base. imag (s:: Symbolic{<:Number} )
184
- if iscall (s)
185
- f = operation (s)
186
- args = map (imag, arguments (s))
187
- return f (args... )
188
- else
189
- islike (s, Real) ? zero (symtype (s)) : term (imag, s)
190
- end
191
- end
167
+ Base. imag (s:: Symbolic{<:Number} ) = islike (s, Real) ? zero (symtype (s)) : term (imag, s)
192
168
Base. adjoint (s:: Symbolic{<:Number} ) = conj (s)
193
169
170
+
194
171
# # Booleans
195
172
196
173
# binary ops that return Bool
0 commit comments