FeynCalc / feyncalc

Mathematica package for algebraic calculations in elementary particle physics.
https://feyncalc.github.io
GNU General Public License v3.0
316 stars 88 forks source link

Allow `Conjugate` option of ComplexConjugate to have rules #48

Closed JP-Ellis closed 5 years ago

JP-Ellis commented 5 years ago

Prior to this, Conjugate could only handle a list of elements which must match exactly for them to be complex conjugated. This now allows for custom rules to be allowed.

For example, the following is supported

Conjugate -> {
  Lambda,
  y[i_, j_] :> Conjugate[y[i, j]],
  h[i_, j_] :> h[j, i],
  z -> -z
}

which will leave the three rules unchanged, and implicitly understand that Lambda -> Conjugate[Lambda].

vsht commented 5 years ago

I like the idea, but the implementation with Switch is IMHO not optimal. I think that it is more efficient to extract the rules first and then combine them with the rules automatically created out of symbols. And of course one should always add a few unit tests when implementing new features. That has already saved me from introducing serious bugs multiple times.

JP-Ellis commented 5 years ago

All good. Switch I thought was an easy implementation but I don't really know how efficient it is (nor do I know just how important efficiency matters in this particular step). As for the unit tests, I completely agree and thanks for adding them (I didn't realize you had unit tests!).

vsht commented 5 years ago

Well, since there is no public CI service that offers continuous integration for Mathematica, I usually just run the unit tests on my own computer. But yes, in general I'm a huge proponent of test driven development. Apart from the unit tests

Tests/unittests.sh math

we also have integration tests

Tests/inttests.sh math

and a possibility to run all the included examples

Tests/examples.sh math

Anyway, I hope I didn't discourage you or so. If you have more ideas or suggestions, feel free to create issues, use the mailing list or well write new pull requests.