I’m trying to substitute some variables by some strings in a matrix using broadcasting. The aim is to make the visually simplify the expression such that stuff like eta(Exx,Eyy,Exy) simply reads as eta in the output. This works nice if one does one substitution at a time, e.g.:
However, if one tries to substitute several elements at the same time using a Dict, then it errors.
This can be seen by uncommenting the second substitution line in the above example.
I was wondering whether anyone had a simple solution?
You can’t broadcast over a Dict, but you can pass a Dict to substitute. You also can’t substitute strings for symbols. In this case, I think you’ll want to wrap the Dict in a Ref to prevent broadcasting:
which is already super nice. But would there be a way not to do what I’ve done on line 2 (@variables eta(ε[1], ε[2], ε[3])). I’ve tried @variables eta(ε) which would be very concise but does not yield the same results.
Also, I wondered whether there was a way to display a dot on top of the unicode character \varepsilon (LateX \dot\varepsilon), but I guess that’s yet another topic…