@@ -160,37 +160,14 @@ for f in [identity, one, zero, *, +, -]
160160end
161161
162162promote_symtype (:: typeof (Base. real), T:: Type{<:Number} ) = Real
163+ Base. real (s:: Symbolic{<:Number} ) = islike (s, Real) ? s : term (real, s)
163164promote_symtype (:: typeof (Base. conj), T:: Type{<:Number} ) = T
165+ Base. conj (s:: Symbolic{<:Number} ) = islike (s, Real) ? s : term (conj, s)
164166promote_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)
192168Base. adjoint (s:: Symbolic{<:Number} ) = conj (s)
193169
170+
194171# # Booleans
195172
196173# binary ops that return Bool
0 commit comments