0
$\begingroup$

I'm solving systems of equations with a few different functions of time, t, and so I'm getting output with lots of [t] running around. Is there a way to display these functions without the dependences, e.g., to display

a[t] b'[t]

as

a b'

? I can use a series of replacement rules to do this, e.g.,

/.{a[t]->a,b[t]->b}

but this is pretty cumbersome, and doesn't generalize well (e.g., when more functions are added in).

$\endgroup$
  • 1
    $\begingroup$ Something like a[t] b'[t] /. f_[t] :> f? Please note that this could fail, depending on your expression. $\endgroup$ – Yves Klett Jan 10 '14 at 12:22
  • $\begingroup$ Hi Yves, that works, thanks! Why do you use the delayed :> instead of ->? $\endgroup$ – Adam Jan 10 '14 at 12:30
  • $\begingroup$ Right, Rule (-> ) works just as well in your case :) $\endgroup$ – Yves Klett Jan 10 '14 at 12:44
  • 3
    $\begingroup$ @Yves With respect, no, it does not. You should use :> with named patterns on the right-hand-side. Otherwise if f has a global value the replacement will break. $\endgroup$ – Mr.Wizard Jan 10 '14 at 12:49
  • $\begingroup$ This rule does not work for all functions of the independent variable. For example a[t] Exp[t] gives a Exp[t]. But may be that is ok with the OP, just wanted to point it out just in case. $\endgroup$ – Nasser Jan 10 '14 at 12:51

Your Answer

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

Browse other questions tagged or ask your own question.