0
$\begingroup$

I created a scalar product of a vector $\in \mathbb{R}^2$ and of a vector consisting of a differential operators

op[t_] = (D[#, {t, 2}] - 3 D[#, t] + 2 #) &;   (1)
delop = {op[t], op[z]}; X = {1, -2};

I would like to apply this scalar product to a function and tried the following (not working solutions)

(X.delop)@Sin[t+z]    (2)
(X.delop) Sin[t+z]

leading to

((D[#1, {t, 2}] - 3 D[#1, t] + 2 #1 & ) - 2 (D[#1, {z, 2}] - 3 D[#1, z] + 2 #1 & ))[Sin[t + z]]
((D[#1, {t, 2}] - 3 D[#1, t] + 2 #1 & ) - 2 (D[#1, {z, 2}] - 3 D[#1, z] + 2 #1 & )) Sin[t + z]

How can I evaluate those expressions or directly obtain an evaluated expression in formula (2)?

$\endgroup$
0

1 Answer 1

1
$\begingroup$

I would define "delop" as a function and do the scalar product after applying the function:

Clear["Globals`*"]
op[t_] = (D[#, {t, 2}] - 3 D[#, t] + 2 #) &;
delop[t_, z_] = {op[t][#], op[z][#]} &;
X = {1, -2};
X.(delop[t, z]@Sin[t + z])

(* -3 Cos[t + z] + Sin[t + z] - 2 (-3 Cos[t + z] + Sin[t + z]) *)

Note, the brackets are not necessary, due to preferences. I put them in to make the preference clear.

$\endgroup$
4
  • $\begingroup$ I get the error Set::write: Tag List in delop[t_, z_].... is Protected.. $\endgroup$ May 14, 2021 at 8:32
  • $\begingroup$ I think you already have somehow defined "delop" . I added "Clear["Globals`*"]" to prevent this. Or try a new kernel. $\endgroup$ May 14, 2021 at 8:38
  • $\begingroup$ Ok, that seems to be a great solution as long as I have X.(delop[t, z]@Sin[t + z])and not delop[t, z].X@Sin[t + z]. Do you have a solution for the second scalar product as well to allow full flexibility in coding? $\endgroup$ May 14, 2021 at 8:51
  • $\begingroup$ @Uwe.Schneider what you attempt in the second case is not proper syntax, which is why it does not work. It isn’t clear why you want to do that, or what you want to get. I suggest editing your question with such an alternative request, what the ideal outcome or intended goal is, and not what occurs when you try that syntax. $\endgroup$ May 15, 2021 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.