PolyMathOrg / PolyMath

Scientific Computing with Pharo
MIT License
169 stars 41 forks source link

Rename ``PMComplex >> conjugated`` to ``complexConjugate`` #192

Open olekscode opened 3 years ago

olekscode commented 3 years ago

Because numbers can also be conjugate in a different sense: 5 + 5 sqrt is conjugate to 5 - 5 sqrt. https://math.stackexchange.com/questions/3397053/whats-the-correct-definition-of-conjugate-and-do-we-identify-them

Also, this message should be implemented by Number

5 complexConjugate.  "5"
(5 + 3i) complexConjugate. "5 - 3i"

And testing:

5 isComplexConjugateOf: 5. "true"
(5 + 3i) isComplexConjugateOf: (5 - 3i). "true"
hemalvarambhia commented 2 years ago
Screenshot 2022-04-10 at 21 50 50 Screenshot 2022-04-10 at 21 50 34
hemalvarambhia commented 2 years ago

I am noticing now that the Complex Number Test Class has a large number of methods. A refactor might split this up, and there are a number of ways to do that (I'll provide a list in a moment...).

nicolas-cellier-aka-nice commented 2 years ago

Because quaternions also have a conjugate operation, will you need yet another quaternionConjugate selector?

hemalvarambhia commented 2 years ago

I referred to Wikipedia, and the word used there is conjugation:

Conjugation of quaternions is analogous to conjugation of complex numbers and to transposition (also known as reversal) of elements of Clifford algebras. To define it, let {\displaystyle q=a+b\,\mathbf {i} +c\,\mathbf {j} +d\,\mathbf {k} } be a quaternion. The conjugate of q is the quaternion {\displaystyle q^{*}=a-b\,\mathbf {i} -c\,\mathbf {j} -d\,\mathbf {k} }. It is denoted by q∗, qt, {\displaystyle {\tilde {q}}}, or q.[7] Conjugation is an involution, meaning that it is its own inverse, so conjugating an element twice returns the original element. The conjugate of a product of two quaternions is the product of the conjugates in the reverse order. That is, if p and q are quaternions, then (pq)∗ = q∗p∗, not p∗q∗.

The conjugation of a quaternion, in stark contrast to the complex setting, can be expressed with multiplication and addition of quaternions:

{\displaystyle q^{*}=-{\frac {1}{2}}(q+\,\mathbf {i} \,q\,\mathbf {i} +\,\mathbf {j} \,q\,\mathbf {j} +\,\mathbf {k} \,q\,\mathbf {k} )~.}

hemalvarambhia commented 2 years ago

Are we discovering that conjugate may have meanings in different contexts? I.e. bounded contexts.