1
$\begingroup$

How could I replace for example:

Derivative[2][f][x]

by

Derivative[1][g][x]

where

g[x]=Derivative[1][f][x]

?

But doing this in a manner that work for all cases (all combinations of mixed derivates and multiple variables)?

$\endgroup$
2
$\begingroup$

This seems to be very simple:

With[{f = Derivative[-1][g]},
 Derivative[2][f][x]]

(* ==> Derivative[1][g][x] *)
$\endgroup$
1
$\begingroup$

The objective of this was to use replacement rules with lower derivatives results inside higher ones.

Transform[differentialEquationArg_]:=Module[{differentialEquation,previousDerivative},
    differentialEquation=differentialEquationArg//.Derivative[a__][b_][c__]/;(previousDerivative=GetPreviousDerivative[{a},Length[{a}]];Total[{a}]>1&&True):>Derivative[previousDerivative/.List->Sequence][Derivative[{a}-previousDerivative/.List->Sequence][b][c]][c];
    differentialEquation
]

GetPreviousDerivative[derivativeTupleArg_,workingPositionArg_]:=Module[{derivativeTuple,workingPosition},
    derivativeTuple=derivativeTupleArg;
    workingPosition=workingPositionArg;
    If[derivativeTuple[[workingPosition]]>0,derivativeTuple[[workingPosition]]-=1,workingPosition-=1;derivativeTuple=GetPreviousDerivative[derivativeTuple,workingPosition]];
    derivativeTuple
]

Example:

D[y[t],t,t]+y[t]+D[y[t],t]==0

Out: y''(t)+y'(t)+y(t)=0

Transform[%]

Out: y'(t)'(t)+y'(t)+y(t)=0

%//FullForm

Equal[Plus[y[t],Derivative[1][y][t],Derivative[1][Derivative[1][y][t]][t]],0]

Not completely tested, can have some bugs.

$\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.