Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The problem is

Find two linearly independent solutions of $2x^2y'' -xy' + (-4 x + 1)y = 0, \, x>0$ of the form $y_1 = x^{r_1}(1 + a_1 x + a_2 x^2 + a_3 x^3 + \cdots)$ and $y_2 = x^{r_2}(1 + b_1 x + b_2 x^2 + b_3 x^3 + \cdots)$.

What I have done is below:

2 x^2*D[y, {x, 2}] - x D[y, x] + (-4 x + 1) y == 0 /. y -> x^r*(Sum[C[n]*x^n, {n, 0, 5}])

The result mathematica gave is

(1 - 4 x) x^r (C[0] + x C[1] + x^2 C[2] + x^3 C[3] + x^4 C[4] + x^5 C[5]) == 0

from which I conclude that D[y,x]is excuted before the replacement. How can I make D[y,x] excute after the replacement?

share|improve this question
    
With[{y=replacement},D[y,x]] –  Coolwater Apr 27 at 9:03

2 Answers 2

One method I like to use for this is the Hold/Release, like this (notice the use of D for derivative in the Hold stage.

  ClearAll[x, y, n];
  eq = 2 x^2  Hold[D[y[x], {x, 2}]] - x Hold[D[y[x], x]] + (-4 x + 1) y[x] == 0;
  Release[eq /. y[x] -> x^r*(Sum[C[n]*x^n, {n, 0, 5}])]

Mathematica graphics

share|improve this answer
  solns = y[x] /. First@DSolve[2 x^2*D[y[x], {x, 2}] - x D[y[x], x] + (-4 x + 1) y[x]== 0, y[x], x]
  y1[x_] = solns /. {C[1] -> 1, C[2] -> 0}
  y2[x_] = solns /. {C[1] -> 0, C[2] -> 1}
(*  E^(2 Sqrt[2] Sqrt[x]) Sqrt[x]  *)
(* -((E^(-2 Sqrt[2] Sqrt[x]) Sqrt[x])/(2 Sqrt[2]))  *)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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