20
$\begingroup$

I have a linear differential operator, for instance, $L\left (\partial _{t} \right )=\partial _{tt} - 3\partial _{t} + 2$. I use it in 2 different ways:

  • apply the operator to a function: $L\left (\partial _{t} \right )\sin(t)=-\sin(t)-3\cos(t)+2\sin(t)=\sin(t)-3\cos(t)$

  • find roots of the polynomial $L(p)=0$, in this case $p=1,p=2$

What is the best way to define such operator?

$\endgroup$
4
  • 2
    $\begingroup$ You should include in your question your attempts to define such an operator. What have you tried ? In any case take a look at this post where a dalambertian was defined : mathematica.stackexchange.com/questions/5434/…. Perhaps you know there are in Mathematica 9 new differential operators like Div, Curl, Laplacian etc. $\endgroup$
    – Artes
    Commented Dec 3, 2012 at 11:59
  • $\begingroup$ I am new to Mathematica, so my only guess was to create 2 distinct functions, one behaving like differential operator, other like a polynomial. I was wondering if there was a way to write it in 1 statement. $\endgroup$
    – prazuber
    Commented Dec 3, 2012 at 14:44
  • $\begingroup$ The section "Some noncommutative algebraic manipulation" in the notebook at this link might be useful for some of what you are trying to do. (probably not much help with factoring differential operators though). $\endgroup$ Commented Dec 3, 2012 at 16:05
  • $\begingroup$ A closely related question is Having the derivative be an operator $\endgroup$
    – Jens
    Commented Dec 3, 2012 at 18:17

2 Answers 2

27
$\begingroup$

Define the operator as

op[t_]=(D[#,{t,2}]-3D[#,t]+2#)&

Then you get

op[t][Sin[t]]

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

and also

op[t][Exp[p t]]/Exp[p t]//Factor

(* (-2+p) (-1+p) *)

where I have used that $\partial_t \exp(p t) = p\exp(p t)$ to "convert" the action of the operator $\partial_t$ into multiplication by $p$, and then I tidy up by dividing out the $\exp(p t)$ afterwards.

$\endgroup$
8
  • $\begingroup$ Thanks! Shame that it's a bit more complicated than I thought to get the roots of a polynomial, but that will work. $\endgroup$
    – prazuber
    Commented Dec 3, 2012 at 14:46
  • 1
    $\begingroup$ Try this: op[x, t][Exp[p t] Exp[q x]]/(Exp[p t] Exp[q x]) // Factor. The comment this addresses has disappeared. It was to do with how to handle the case where the operator depended on both t and x. $\endgroup$ Commented Dec 3, 2012 at 15:10
  • $\begingroup$ Oh, I deleted it because I came up with a solution op[x,t][Exp[x t]]/Exp[x t], where I've actually gotten my polynomial, though with the variables that switched places. But your solution is much more generic, thanks again! $\endgroup$
    – prazuber
    Commented Dec 3, 2012 at 15:17
  • $\begingroup$ Re: your previous comment on getting the roots of a polynomial, Factor alone does that for you. The Exp trick/hack was for converting your particular operator-valued problem into an algebraic one, which Factor could then get to work on. $\endgroup$ Commented Dec 3, 2012 at 15:25
  • $\begingroup$ What is the purpose of the ampersand at the end of your first line of code? $\endgroup$ Commented Nov 13, 2016 at 3:40
5
$\begingroup$

The following slides are from a I talk I gave on implementing polynomial differential operators and teaching with them: http://www.cs.hmc.edu/~is/talks/JMM2011.nb

$\endgroup$
1
  • 7
    $\begingroup$ Please consider adding some more information to your answer itself, should for example the .nb file become unavailable. Answers that are merely single links to an external resource are discouraged, no matter how good that resource may be. $\endgroup$
    – Mr.Wizard
    Commented Dec 4, 2012 at 13:38

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.