1
$\begingroup$

I have this differential operator $$\frac{d^2}{d y^2}\qquad (1)$$ I want to make a change of variable $y=x^2$ in $(1)$ so that I get this differential operator $$ \frac{1}{4 x^2} \frac{d^2 }{d x^2}-\frac{1}{4 x^3}\frac{d}{d x} \qquad (2)$$

How can I ask Mathematica to do this?

$\endgroup$
5
  • 1
    $\begingroup$ Related: mathematica.stackexchange.com/questions/80241/… $\endgroup$
    – Michael E2
    May 20 at 18:33
  • 1
    $\begingroup$ Do you want the result to be a function you can apply to an expression? $\endgroup$
    – Michael E2
    May 20 at 18:34
  • 1
    $\begingroup$ @MichaelE2 No, I want to apply this operator to a function. $\endgroup$
    – Phys96
    May 20 at 20:20
  • 1
    $\begingroup$ From a programming point of view, doesn't "apply this operator" mean you want the operator to be function that takes a function as an argument and returns the desired derivative? By "function" do you mean $f$ or an expression like $f(y)$? These are different, both in mathematics and in coding. Please give paradigm of how you want the code to work, in terms of input and output code. TeX/math is confusing. (Btw, don't you mean $f(x^2)$ in (2)?) $\endgroup$
    – Michael E2
    May 20 at 21:05
  • $\begingroup$ @MichaelE2 I meant exactly what Alexi 's answer says. $\endgroup$
    – Phys96
    May 20 at 22:12
5
$\begingroup$

Try this:

Clear[f];
D[f[y], {y, 2}] /. f -> (f[#^(1/2)] &) /. y -> x^2 // 
  Simplify[#, x > 0] & // Expand

(*  -(Derivative[1][f][x]/(4 x^3)) + (f^\[Prime]\[Prime])[x]/(4 x^2)  *)

enter image description here

Have fun!

$\endgroup$
5
  • 1
    $\begingroup$ Shouldn't the correct answer have f'[x^2] etc.? $\endgroup$
    – Michael E2
    May 20 at 21:22
  • $\begingroup$ @MichaelE2 No, the result is correct. $\endgroup$
    – Phys96
    May 20 at 22:13
  • 1
    $\begingroup$ @Phys96 Why does $f(y)$ become $f(x)$, when $y$ is replaced by $x^2$? That seems quite wrong. $\endgroup$
    – Michael E2
    May 20 at 22:15
  • $\begingroup$ @MichaelE2 I will write in detail later, maybe it is my bad in writing the question, Indeed, here, we apply the change of variable $y=f(x)=x^2$ $\endgroup$
    – Phys96
    May 21 at 6:51
  • $\begingroup$ @MichaelE2 I think that formally you are right. Implicitly, f(x) is another function, not equal to f(y). This may later cause errors in calculations. Correctly would be to introduce a different function g(x)=f(x^2) and formulate everything for the latter: D[f[y], {y, 2}] /. f -> (g[#^(1/2)] &) /. y -> x^2. $\endgroup$ May 21 at 8:47
2
$\begingroup$

Here's a counterexample to show that (1) applied to f[y] is not equivalent to (2) applied to f[x] under the substitution y == x^2, as it was stated in the OP in a previous edit and claimed in a comment:

Block[{f = Cos},
 {D[f[y], {y, 2}] /. y -> x^2,
   1/(4 x^2) D[f[x], {x, 2}] - 1/(4 x^3) D[f[x], x] // Simplify,
   1/(4 x^2) D[f[x^2], {x, 2}] - 1/(4 x^3) D[f[x^2], x] // Simplify
   } // Simplify]
$\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.