@@ -4,12 +4,12 @@ import SpecialFunctions: gamma, loggamma, erf, erfc, erfcinv, erfi, erfcx,
44 besselj1, bessely0, bessely1, besselj, bessely, besseli,
55 besselk, hankelh1, hankelh2, polygamma, beta, logbeta
66
7- const monadic = [deg2rad, rad2deg, transpose, conj, asind, log1p, acsch,
7+ const monadic = [deg2rad, rad2deg, transpose, asind, log1p, acsch,
88 acos, asec, acosh, acsc, cscd, log, tand, log10, csch, asinh,
99 abs2, cosh, sin, cos, atan, cospi, cbrt, acosd, acoth, acotd,
1010 asecd, exp, acot, sqrt, sind, sinpi, asech, log2, tan, exp10,
1111 sech, coth, asin, cotd, cosd, sinh, abs, csc, tanh, secd,
12- atand, sec, acscd, cot, exp2, expm1, atanh, real, imag, gamma,
12+ atand, sec, acscd, cot, exp2, expm1, atanh, gamma,
1313 loggamma, erf, erfc, erfcinv, erfi, erfcx, dawson, digamma,
1414 trigamma, invdigamma, polygamma, airyai, airyaiprime, airybi,
1515 airybiprime, besselj0, besselj1, bessely0, bessely1]
@@ -97,9 +97,6 @@ promote_symtype(::typeof(rem2pi), T::Type{<:Number}, mode) = T
9797Base. rem2pi (x:: Symbolic{<:Number} , mode:: Base.RoundingMode ) = term (rem2pi, x, mode)
9898
9999for f in monadic
100- if f in [real, imag, conj]
101- continue
102- end
103100 @eval promote_symtype (:: $ (typeof (f)), T:: Type{<:Number} ) = promote_type (T, Real)
104101 @eval (:: $ (typeof (f)))(a:: Symbolic{<:Number} ) = term ($ f, a)
105102end
@@ -111,15 +108,12 @@ for f in [identity, one, zero, *, +, -]
111108 @eval promote_symtype (:: $ (typeof (f)), T:: Type{<:Number} ) = T
112109end
113110
114- # All of these need to be `Sym` to overwrite the function definitions of
115- # the L78, that are made with the type `Sym <: Symbolic`
116- # @number_methods(Sym, term(f, a), term(f, a, b), skipbasics)
117111promote_symtype (:: typeof (Base. real), T:: Type{<:Number} ) = Real
118- Base. real (s:: Sym {<:Real } ) = s
112+ Base. real (s:: Symbolic {<:Number } ) = islike (s, Real) ? s : term (real, s)
119113promote_symtype (:: typeof (Base. conj), T:: Type{<:Number} ) = T
120- Base. conj (s:: Sym {<:Real } ) = s
114+ Base. conj (s:: Symbolic {<:Number } ) = islike (s, Real) ? s : term (conj, s)
121115promote_symtype (:: typeof (Base. imag), T:: Type{<:Number} ) = Real
122- Base. imag (s:: Sym {<:Real } ) = zero (symtype (s))
116+ Base. imag (s:: Symbolic {<:Number } ) = islike (s, Real) ? zero (symtype (s)) : term (conj, s )
123117
124118# # Booleans
125119
0 commit comments