2
$\begingroup$

Can I do something like this:

$$\partial_t = D[f, t]$$

i.e. create a symbol instead of a function so that each time I call it, it executes the operation as defined?

$\endgroup$
1
  • 1
    $\begingroup$ Yes. Look up the Notations package in the docs. $\endgroup$ Feb 13, 2014 at 22:37

3 Answers 3

3
$\begingroup$

With the notation package something like this is easy. I would never use this by myself, because IMO such sugar can easily introduce bugs and undesired behavior if one is not cautious. I will paste a screenshot so that you see how I used the Notation` package, but first of all you have to load it:

<< Notation`

then you can use

Mathematica graphics

Testing it

Mathematica graphics

or

Mathematica graphics

$\endgroup$
0
$\begingroup$

When I read this question, it seems to be asking for set-delayed. For example, say we want to calculate D[f[t],t] over and over but want to give it a name like q. Then

q := D[f[t], t]

does this. If you don't have f defined then

q
Derivative[1][f][t]

If f is defined, say

f[t_] := t^2
q
2 t
$\endgroup$
0
$\begingroup$

Actually $\partial _t f[t]$ in Mathematica is interpreted as D[f[t],t] by default. You don't need to redefine it.

Considering $\partial _t = D[f,t]$ given by the OP is only an example of what the OP wants to do, I regard this question as a way to redefine the basic rules for the input of the expression. You can define the low-level input rules by using MakeExpression.

In this case, I try to define $\mathbb{D}_t f[t]$ as D[f[t],t] for better understanding.

MakeExpression[RowBox[{SubscriptBox["\[DoubleStruckCapitalD]", t_], f_}], StandardForm] :=
  MakeExpression[RowBox[{"D", "[", f, ",", t, "]"}], StandardForm]

$\mathbb{D}_t$f[t]

f'[t]

You can use FullForm to check it:

$\mathbb{D}_t$f[t]//FullForm

Derivative[1][f][t]

For more details about Low-Level Input and Output Rules, pls read here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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