0
$\begingroup$

I am a new user, and I am a bit puzzled while experimenting with Mathematica functions, their derivatives and derivatives of functions.

I have an expression such as:

x^(-4 - m[x])*(6*m[x] + x*(x^3*h1[x_]^4 + 6*x^3*h1[x_]^2*
      Derivative[1][h1][x_] + 3*x^3*Derivative[1][h1][x_]^2 - 
     8*Derivative[1][m][x] + 6*x*Derivative[2][m][x] - 
     4*h1[x_]*(2*m[x] + 3*x*(-Derivative[1][m][x] + 
         x*Derivative[2][m][x]))))

and I try to simplify using:

/.   -((2*m[x])/x^3) + (3*Derivative[1][m][x])/x^2 - 
    (3*Derivative[2][m][x])/x -> Derivative[2][h1][x]

But it seems impossible to replace the algebraic terms with the function h1''[x].

Any suggestions? Thank you very much.

$\endgroup$
7
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Commented Nov 18, 2015 at 11:23
  • $\begingroup$ You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful $\endgroup$
    – Michael E2
    Commented Nov 18, 2015 at 11:26
  • $\begingroup$ Try something like: Derivative[2][m][x] -> x * Derivative[2][h1][x] / 3 + ((2*m[x])/x^3) - (3*Derivative[1][m][x])/x^2. I think there's a duplicate somewhere on site about substituting algebraic expressions, if someone can find it. $\endgroup$
    – Michael E2
    Commented Nov 18, 2015 at 11:29
  • $\begingroup$ It is not quite clear, what do you want to achieve, but before all you should remove errors replacing numerous x_s in your expression by x s. Then a good idea might be to precisely explain, what term do you want to get rid off: there always exists a way for that. $\endgroup$ Commented Nov 18, 2015 at 13:52
  • $\begingroup$ Sorry I tried to make no mistakes using cut and paste and it seems it did not work completely... so, again, suppose an expression: $\endgroup$
    – user35679
    Commented Nov 18, 2015 at 14:17

1 Answer 1

1
$\begingroup$
expr = x^(-4 - m[x])*(6*m[x] + 
          x*(x^3*h1[x]^4 + 6*x^3*h1[x]^2*
                 Derivative[1][h1][x] + 
               3*x^3*Derivative[1][h1][x]^
                   2 - 8*Derivative[1][m][
                   x] + 6*x*Derivative[2][m][
                   x] - 4*h1[x_]*(2*m[x] + 
                    3*x*(-Derivative[1][m][
                            x] + x*Derivative[2][m][
                            x])))); 

Keeep the LHS of the replacement rule as simple as possible, e.g., m''[x] -> ...

expr2 = Simplify[expr /. 
       Solve[-((2*m[x])/x^3) + 
               (3*Derivative[1][m][x])/
                 x^2 - (3*Derivative[2][m][
                      x])/x == Derivative[2][
                 h1][x], Derivative[2][m][
             x]][[1]]]

(*  x^(-4 - m[x])*(x^4*h1[x]^4 + 
      2*m[x] + 6*x^4*h1[x]^2*
        Derivative[1][h1][x] + 
      3*x^4*Derivative[1][h1][x]^2 - 
      2*x*Derivative[1][m][x] - 
      2*x^3*Derivative[2][h1][x] + 
      4*x^4*h1[x_]*Derivative[2][h1][
          x])  *)
$\endgroup$
1
  • $\begingroup$ It Works!.. Thank you very much to solve this question that was posted so unclear... What I have read in books and manuals is that simplification is not easy (or straightforward...) so there are several approaches when the direct "Simplify" does not work (this include "Expand", "Factor", rules with -assumptions- etc..) however I am not sure I have read about this workaround....That is to say, to use the -function- you want to collect and solve it in terms of one of its members, I guess it should be possible to use other -unknow-such as -m'[x]- and it will also work. Very nice workaround!! $\endgroup$
    – user35679
    Commented Nov 19, 2015 at 9:07

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.