2
$\begingroup$

I have the following differential equation

$$\sqrt{f(x)}-a \frac{f'(x)}{f(x)}+b \frac{1}{x}=c $$

where $a,b,c>0$ and I am interested in the solutions for $x<0$. DSolve gives me an analytic result, but for generic values of the integration constant it is complex. I wonder how I can find out for which values the solutions are real?

assumptions = {a > 0, b > 0, c > 0, x < 0};
numbers = {a -> 1, b -> 3, c -> 2, C[1] -> -2};
f[x] /. DSolve[Sqrt[f[x]] - a f'[x]/f[x] + b/x == c, f[x], x, 
Assumptions -> assumptions] // First // FullSimplify
Plot[{Re[%], Im[%]} /. numbers // Evaluate, {x, -10, 0}]

The output is

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ $b=2ka, k\in\mathbb N$ $\endgroup$
    – Domen
    Jul 31, 2023 at 20:08

1 Answer 1

5
$\begingroup$
$Version

(* "13.3.0 for Mac OS X ARM (64-bit) (June 3, 2023)" *)

Clear["Global`*"]

assumptions = {a > 0, b > 0, c > 0, x < 0};
numbers = {a -> 1, b -> 3, c -> 2, C[1] -> -2};

expr1 = f[x] /. 
    DSolve[Sqrt[f[x]] - a f'[x]/f[x] + b/x == c, f[x], x, 
     Assumptions -> assumptions] // First // FullSimplify

enter image description here

The assumptions also can be used by FullSimplify. Use an Assuming construct to make the assumptions available to all enclosed functions.

expr2 = Assuming[assumptions, 
  f[x] /. DSolve[Sqrt[f[x]] - a f'[x]/f[x] + b/x == c, f[x], x] // First // 
   FullSimplify]

enter image description here

Use FunctionDomain to determine the conditions for the expression to be real.

Assuming[assumptions,
 FunctionDomain[expr2, x] // FullSimplify]

enter image description here

$\endgroup$

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.