0
$\begingroup$

I have the following function:

Q[r_, f_, s0_] := Q[r, f, s0] = F[r, s0] D[f[s0], s0]

By calling

Q[r, Q[r, f, s0], s0]

I obtain the following result:

F[r,s0] ((F[r,s0] f'[s0])'[s0]+(F[r,s0] f''[s0]+f'[s0] F^(0,1)[r,s0])[s0])

when the desired answer is

F[r,s0](F[r,s0] f''[s0]+f'[s0] F^(0,1)[r,s0])

Could you please help me to obtain the correct answer?

Thank you in advance for all your help!

$\endgroup$

1 Answer 1

2
$\begingroup$

The issue and solution are similar to the one in your previous post. In addition, we need to give Q the attribute HoldAll:

ClearAll[Q, f, F]
SetAttributes[Q, HoldAll]
Q[r_, f_, s0_] :=  Q[r, f, s0] = F[r, s0]  D[f[s0], s0]
Q[r_, f_[r_, g_, s0_], s0_] := F[r, s0] D[f[r, g, s0], s0]

Q[r, f, s0]
 F[r,s0] (f^′)[s0]
Q[r, Q[r, f, s0], s0]
F[r,s0] (F[r,s0] (f^′′)[s0]+(f^′)[s0] (F^(0,1))[r,s0])
$\endgroup$
2
  • $\begingroup$ Thank you very much! $\endgroup$
    – Svetlana
    Commented May 29, 2020 at 19:38
  • 1
    $\begingroup$ @Svetlana, you are welcome. And welcome to mma.se. $\endgroup$
    – kglr
    Commented May 29, 2020 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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