Maple - Substitute into an expression involving derivative

865 Views Asked by At

I'm working with some matrices including derivatives like d/dt(x(t)). I need to replace this whole expression {d/dt(x(t))} with something like xdot. I have tried to use "subs", but it seems to refuse to do the substitution.

Do you have any idea how to do this?

1

There are 1 best solutions below

1
On BEST ANSWER

It's important to realize that d/dt(x(t) as text input means nothing special in Maple. The output from issuing diff(x(t),t) as a command (or from inserting it as marked up 2D Math input from the palette) does get typeset to look like what you've written. But simply typing d/dt(x(t)) won't produce a derivative expression and so won't match.

Using an explicit command, we can get the substitution.

M := Matrix( [ [ diff(x(t),t) ] ] );

                                 [d      ]
                            M := [-- x(t)]
                                 [dt     ]

subs( diff(x(t),t) = xdot, M );     

                                [xdot]

Note that you can also get diff(x(t),t) from the Expression palette, both when you create the Matrix as well as when you form that call to subs.

I should probably also ask whether you are really trying to substitute the name xdot into your Matrix (to allow some other symbolic manipulation?) or whether you are trying to get a typesetting with x and . over head. If you are actually trying to get it just to appear as $\dot x$ then that can be enabled via by changing the typesetting level,

interface(typesetting=extended);

After that command (which can also be set via via Tools->Options in the menubar) then by default differentiation with respect to t is display as an overhead dot. The Typesetting:-Settings command will even allow you to change that behaviour, disabling it, or enabling it for some name other than t.

This is a Maple programming question, and not really about mathematics. As such it would be more appropriately asked on stackexchange or mapleprimes. If none of the above works for your example then I suggest asking on mapleprimes and uploading your worksheet there.