Closed aytekinar closed 7 years ago
A few quick comments, not touching on all you have here.
The definition of conj(p) follows from the definition conj(p)(z) = conj(p(conj(z))). This implies that for polynomials that conj(p) = sum conj(a_i) x^i. It seems that you are looking for a different property, which may be more useful.
As for the use of ctranspose for differentiation. I would be sad to see that go, but it is a pun and it seems to not play nicely with matrices of polynomials. Maybe it should be deprecated. It would be nice if there were a postfix operator in unicode that could be used.
Well, that would be cool. For now, we can define \delta<tab> = polyder(p, 1)
, or? (then, exporting this symbol might clash with another one coming from another package, of course).
as for the conj
, I guess I am applying the correct thing, right?
\operatorname{conj}(p(x)) & = \operatorname{conj}(\sum_{n = 0}^{N} a_{n} x^{n}) \\
& = \sum_{n = 0}^{N} \operatorname{conj}(a_{n}) \operatorname{conj}(x)^{n}
(apologies for the inconvenient LaTeX up there). At least, when I thought of conj
of a polynomial p
, I assumed the operation was exactly as above. However, right now, Polynomials
spit out the conjugated coefficients to the user and depend on the user to remember the conjugated x
. It also allows for conj(p) + p
operation for a polynomial p
, which is again a different thing from what we would obtain from pen and pencil. Of course, the current practice is valid for all T<:Real
inputs of x::T
.
Maybe I have the very extreme(?) case when x
is allowed to vary in the complex domain, but I just wanted to pose this question anyways.
Sorry for the confusion or wasting the time :)
I'm no expert here, but the defn I've seen is γ ∘ p ∘ γ where γ is the conjugation operator. Yours is just γ ∘ p. The defn means that conj(p)(z) = conj(p(conj(z)))
in Julia
, which I think the current definition satisfies.
Exactly! I was thinking of p
as a mapping on the form I mentioned above, and its conjugate implies that the input (x
in this case) needs to be conjugated, too. This is also obvious in the definition you have written: conj(p)(z) = conj(p(conj(z)))
. This means, the user is responsible for keeping track of conj(z)
, and this brings a bit more complications when we mix the polynomials of the form conj(p)(z) + p(z) = conj(p(conj(z))) + p(z)
. Here, in the resulting polynomial, we have lost z
(the coefficients of p
and their conjugates are added together, and we do not know which input to use).
Again, sorry for raising this issue --- apparently this is only affecting me in my special case.
I think the confusion is what exactly we are thinking p
is. I'm thinking
it as the function x -> p(x), not the expression p(x). The expression would
have conj(p(x)) = conj(p)(conj(x)) using the current defn. of conj(p),
which is what you are expecting. What is the correct interpretation for p
in this package I'm not sure.
On Tue, Dec 6, 2016 at 12:13 PM, Arda Aytekin notifications@github.com wrote:
Exactly! I was thinking of p as a mapping on the form I mentioned above, and its conjugate implies that the input (x in this case) needs to be conjugated, too. This is also obvious in the definition you have written: conj(p)(z) = conj(p(conj(z))). This means, the user is responsible for keeping track of conj(z), and this brings a bit more complications when we mix the polynomials of the form conj(p)(z) + p(z) = conj(p(conj(z))) + p(z). Here, in the resulting polynomial, we have lost z (the coefficients of p and their conjugates are added together, and we do not know which input to use).
Again, sorry for raising this issue --- apparently this is only affecting me in my special case.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Keno/Polynomials.jl/issues/85#issuecomment-265210366, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZvTCEuxYMKktVzUaw0cVuFZuHFBvgbks5rFZevgaJpZM4LDwDJ .
-- John Verzani Chair, Department of Mathematics College of Staten Island, CUNY verzani@math.csi.cuny.edu
TL;DR
The package has some problems related to the conjugation of
Poly
objects. In my opinion,conj
should not only return a newPoly
with conjugated coefficients but also keep track of its input data. The solution proposal in #59 seems to be true only for real inputs.What I would expect from
conj
is thatconj(a*x) = conj(a)*conj(x)
. In fact, after obtainingconj
of aPoly
, the variablex
has been also changed toy = conj(x)
. What I mean by that isconj(p(x)) + p(x)
should not be allowed for aPoly
objectp(x)
with the current implementation.Read below for more...
Example
To me, the variable name together with its conjugation property should fix the
variable
information of aPoly
object. Actually, I have implementedRationalFunctions.jl
in this way, and that seems to be working.The way I implemented
RationalFunction
objects was to encode both the variable name (in this case,p.var
) and its conjugation property (for example, a value type such asConj{true}
) into the type itself. Then, I could rely on the dispatching mechanism of Julia for all mathematical operations without even caring about anyif
checks to guarantee same-variable-polynomial operations. I am not sure if this is the best practice, but it seems to be working.I believe,
(r::RationalFunction{T,Conj{true}}){T}(x::Real) = _funceval(r, x)
) via the dispatching mechanism,:x
,:t
,:s
,:q
, etc.).Anyways, in the current implementation of
Polynomials
,p.var
is hardly ever used except for checking for consistent operations, and displaying purposes. If above functionality (i.e., tracking of conjugated variables) is to be implemented without breaking the coefficients' structure (in this case,Vector
orT<:AbstractVector
if sparse coefficients are going to be supported), the other viable option is to have aBool
in the type structure. Then, this will bring anotherif
switch into the picture.I just wanted to share my opinions about the issue, as I am interested in having
RationalFunction
s with real coefficients and complex inputs in my applications. Right now I seem to have solved it properly in the above-mentioned package. However, if anyone is interested in some brainstorming and/or unifying these representations so that both the packages could play well with each other, I am open to discussions.Apart from this, I have also a couple of concerns regarding the convenient
ctranspose
forpolyder
, and the no-optranspose
deprecation warning in Julia 0.5.Example
Some things worth noting/discussing from the above excerpt:
ctranspose
propogates to matrix operations aspolyder
,transpose(p) = copy(p)
would be needed to suppress the no-optranspose
warning,transpose(p) = p
is a faster (more efficient) solution, I know. However, to me, one should always return temporaries from mathematical operations as the result would be changed easily (and unintentionally) in cases such asp = Poly([1,1]); q = p.'; p[2] = 5 # q is unintentionally changed
,Polynomials
has this problem when taking the derivative (of zeroth order), too. Yet, this is another discussion and maybe a taste of the library writer.dot
betweenPoly
objects needs to be defined,b'*A*b
above should be re-considered (b'
will have conjugated variables, whereasA*b
is unconjugated).I hope what I have listed above would make sense for you, and I hope I had not consumed a lot of your time.
Looking forward to your opinions.