# Correctly accounting for Hadamard product

I have an equation of the following form:

$$\frac{\partial a}{\partial t} = Da + Fe^{i\mu \theta}$$

where $$a = a(\theta,t)$$ is a function and $$D$$ is a linear operator.

When discretized for solving such equations computationally, $$a$$ becomes a vector, $$e^{i \mu \theta}$$ becomes a vector (as $$\theta$$ is a vector) and $$D$$ becomes a matrix.

Multiplying through by $$e^{-i\mu \theta}$$, I get:

$$\frac{\partial b}{\partial t} = (Da)\circ e^{-i\mu \theta} + F$$

where $$b = ae^{-i\mu \theta}$$ and the symbol $$\circ$$ denotes an element-wise multiplication.

I would like to rewrite the expression $$(Da)\circ e^{-i\mu \theta}$$ as:

$$(Da)\circ e^{-i\mu \theta} = Gb$$

I am not sure how I can compute the matrix $$G$$ here. I looked into the properties of Hadamard products, but none of them seemed useful in this case.

$$\def\l{\mu} \def\x{\theta} \def\E{E^{-1}} \def\o{{\tt1}} \def\odiv{\oslash} \def\p{\partial} \def\LR#1{\left(#1\right)} \def\op#1{\operatorname{#1}} \def\diag#1{\op{diag}\LR{#1}} \def\Diag#1{\op{Diag}\LR{#1}} \def\trace#1{\op{Tr}\LR{#1}} \def\qiq{\quad\implies\quad} \def\grad#1#2{\frac{\p #1}{\p #2}} \def\c#1{\color{red}{#1}} \def\CLR#1{\c{\LR{#1}}} \def\gradLR#1#2{\LR{\grad{#1}{#2}}}$$Use $$d\x$$ as a shorthand for $$\gradLR{\x}{t}$$ and define the vector variables \eqalign{ e &= \exp(i\l\x) &\qiq de &= i\l e\odot d\x \\ v &= \o\odiv e &\qiq dv &= -de\odiv e\odiv e = -i\l v\odot d\x \\ b &= a\odot v &\qiq db &= v\odot da + a\odot dv \\ & & &= v\odot da - i\l a\odot v\odot d\x \\ } The Hadamard products (and quotients) can be replaced by diagonal matrices, i.e. \eqalign{ E &= \Diag{e} &\qiq de &= i\l E\,d\x \\ V &= \E &\qiq dv &= -i\l V\,d\x \\ A &= \Diag{a} &\qiq db &= V\,da - i\l AV\,d\x \\ } Substitute the $$\c{\rm original\;equation}$$ into the expression for $$db$$ \eqalign{ db &= V\,\c{da} - i\l AV\,d\x \\ &= V\CLR{Da+Fe} - i\l AV\,d\x \\ &= \E Da + \E Fe - i\l AV\,d\x \\ \\ } Note that $$\,F\ne\E Fe.\;$$ The most glaring issue is that the LHS is a matrix while the RHS is a vector. In the case that $$F$$ is diagonal, the expression can be reduced to \eqalign{ \E Fe \;=\; F\E e \;=\; F\o \;=\; \diag F } If $$D$$ is diagonal, then it commutes with $$E$$ and that term can be simplified to \eqalign{ \E Da \;=\; D\E a \;=\; Db }