0
$\begingroup$

This may be a very simple question: how can I substitute out a term involving a derivative in Mathematica?

I have the following derivative:

D[Wf, X] /. {z -> zbar, B[h] -> Bbar, x -> xbar, y -> ybar, X -> xbar,Y -> ybar}

...and it's solution in Mathematica:

enter image description here

Now whenever the following term appears anywhere in my Mathematica code, I would like to substitute in the variable 'bf':

enter image description here

i.e.:

bf = ef*(Derivative[1][B][ef xbar (1 - zbar) + em ybar zbar])/Bbar

In other words, the result of my derivative should be:

(1-zbar)bf

The 'Simplify' function should do this, I think, but the following doesn't seem to work:

enter image description here

Is this a simple mistake in syntax for 'Simplify'? Or perhaps I have misunderstood the scope of 'Simplify'?

$\endgroup$
0
$\begingroup$

I've realised how to do it:

  1. Set up a substitution rule:

    mySubstitution = ef*(Derivative[1][B][ef xbar (1 - zbar) + em ybar zbar])/Bbar -> Bf

  2. Find the derivative:

    D[Wf, X] /. {z -> zbar, B[h] -> Bbar, x -> xbar, y -> ybar, X -> xbar,Y -> ybar}

  3. Apply the substitution rule:

    % /. MySubstitution

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