1

For example, if I input something like

b'[t_] = a[t];
a'[t_] = -Sin[b[t]];

a''[t]

it outputs just a''[t].

Is there a way to get Mathematica to always simplify any derivatives of a and b to expressions only involving a and b (with no derivatives), so that whenever I type in something like a''[t] it outputs -Cos[b[t]]a[t]?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

1 Answers1

2

You could try the following:

b' = a;
Derivative[n_?Positive][a] := Derivative[n-1][Function[-Sin[b[#]]]]

Then:

a''[t]

-a[t] Cos[b[t]]

Carl Woll
  • 130,679
  • 6
  • 243
  • 355
  • Yes thank you this does work if I do Derivative[n_?Positive][b] := Derivative[n - 1][Function[a[#]]]; Derivative[n_?Positive][a] := Derivative[n - 1][Function[-Sin[b[#]]]]; – keagan_callis Feb 08 '21 at 14:57
  • Would you mind explaining what the ?Positive part and the # is for? I don't know much about mathematica. – keagan_callis Feb 08 '21 at 15:04
  • @keagan_callis [`#](https://mathematica.stackexchange.com/a/25616/4999) is short forSlot[1], which represents the first argument toFunction.Derivativeoperates only on functions, not expressions (one usually usesD, as inD[expr, t]`, to operate on expressions). – Michael E2 Feb 09 '21 at 16:08