7
$\begingroup$

In order to solve the following Euler Differential Equation I write in the notebook:

Assuming[{y∈\[DoubleStruckCapitalR], n>0,x>0},DSolve[x^2 y''[x]+x  y'[x]- n y[x]==0,y[x],x]]

And I get as an output:

{{y[x]->Subscript[[ConstantC], 1] Cosh[Sqrt[n] Log[x]]+I Subscript[[ConstantC], 2] Sinh[Sqrt[n] Log[x]]}}

On the other hand when Mathematica solves the above equation with a specific value for n, for example $n=4$ , it returns the desired solution...

How can I fix this problem, please?

$\endgroup$
3
  • 1
    $\begingroup$ First, you may see that \[DoubleStruckCapitalR] is colored with blue, which means that this has no built-in meaning and doesn't represent the set of real numbers. You should use Reals or type with Esc``reals``Esc. $\endgroup$ Commented Jul 2, 2020 at 7:21
  • $\begingroup$ @SneezeFor16Min,Thanks but if I write Reals, it does not work either.... $\endgroup$
    – dmtri
    Commented Jul 2, 2020 at 7:27
  • $\begingroup$ You could specify initial conditions y[1] == y1 and y'[1] == yP1. $\endgroup$
    – Natas
    Commented Jul 2, 2020 at 7:29

1 Answer 1

6
$\begingroup$

First of all, DSolve does not really take assumptions. (What I mean, DSolve seems to ignore assumptions)

Euler ODE can have 3 different solutions depending on roots $r_1,r_2$ of the characteristic equation. For one repeated root, solution is $y=c_1 x^r+ c_2 x^r \ln x$, and for 2 real and distinct roots, solution is $y=c_1 x^{r_1}+ c_2 x^{r_2}$ and for two complex conjugate roots, solution is $y=c_1 x^{\alpha+i\beta} + c_2 x^{\alpha-i\beta}$

For your case, the roots are $r_1 = -\sqrt{n},r_2 = \sqrt{n}$. Hence for $n>0$ then we are in the second case (2 real distinct roots).

The characteristic equation for Euler ode is found by substituting $y=A x^r$ into the ode and then solving for $r$

You can obtain, for n>0 the solution you want this way

Clear["Global`*"];
ode = x^2 y''[x] + x y'[x] - n y[x] == 0
sol = DSolve[ode, y[x], x]

enter image description here

sol = TrigToExp[sol]

enter image description here

sol = Collect[sol, { x^-Sqrt[n], x^Sqrt[n]}]

enter image description here

We are free to rename constants as we want. Hence

sol = sol /. {C[1]/2 - (I C[2])/2 -> C[3],    C[1]/2 + (I C[2])/2 -> C[4]}

enter image description here

Verify

 ode /. y -> Function[{x}, x^-Sqrt[n] C[3] + x^Sqrt[n] C[4]] // Simplify

 (* True *)

Update

what is the characteristic equation?

Clear["Global`*"];
ode = x^2 y''[x] + x y'[x] - n y[x] == 0;
charEquation = ode /. y -> Function[{x}, A*x^r]

enter image description here

Since $A$ and $x^r$ are non zero, we can divide by them and the above simplifies to

Solve[-  n  +  r + (-1 + r) r == 0, r] 

which gives the solutions

enter image description here

And since $n>0$ then we have two real distinct roots.

$\endgroup$
5
  • $\begingroup$ Could you clarify what you mean by saying that DSolve does not really takes assumptions? DSolve has an option Assumptions. $\endgroup$
    – Natas
    Commented Jul 2, 2020 at 7:30
  • 3
    $\begingroup$ @Natas I mean, from experience, I found that assumptions most of the time are ignored by DSolve. Just because you pass assumptions to it, does not mean it will use them. $\endgroup$
    – Nasser
    Commented Jul 2, 2020 at 7:33
  • $\begingroup$ OK, I agree. Assumptions cause many problems and are poorly implemented. $\endgroup$
    – Natas
    Commented Jul 2, 2020 at 7:38
  • 1
    $\begingroup$ Here we have no constant coefficients, so what is the characteristic equation? $\endgroup$
    – dmtri
    Commented Jul 2, 2020 at 10:14
  • $\begingroup$ @dmtri i've updated the answer with the char equation. $\endgroup$
    – Nasser
    Commented Jul 2, 2020 at 10:50

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.