2
$\begingroup$

Let's say I have a function,

F[x_,d_] = Sqrt[(x^2 - 1)^2 + d^2], 

and I want to count how many roots (no root, or one root, or two roots etc.) it has in an interval, say, 0 < x < 5 for a given d. I am not interested in the exact value of the root.

For example, it has one root when d = 0, and no root if, say, d = 0.5.

If I use Reduce , and try to count the roots, Mathematica tries to find the exact roots and it is unnecessary slow. There should be an easier way (or maybe built-in function in Mathematica) for this.

This F function is toy model of my real problem, so I cannot play with the algebra of the function. And since function is always positive, I cannot check if the sign of the function changes. But, one thing for sure, function is not differentiable at the roots.

In other words, how can I calculate number of poles of 1/F[x,d] at 0 < x < 5?

$\endgroup$
4
  • $\begingroup$ If $d \neq 0$, $x$ can be only complex number. Do you want to count complex roots too? $\endgroup$
    – Mahdi
    Apr 23, 2015 at 19:23
  • $\begingroup$ @Mahdi no, only real roots. $\endgroup$
    – gurluk
    Apr 23, 2015 at 19:31
  • $\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) Read the faq! 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
    May 11, 2015 at 19:15
  • $\begingroup$ It seems you might not have received the traditional welcome, which I extended to you above. I noticed you haven't accept any answers to your questions. Please consider whether any of the attempts to help you deserve this token reward. $\endgroup$
    – Michael E2
    May 11, 2015 at 19:16

1 Answer 1

3
$\begingroup$

In the case of polynomials you can use CountRoots when you specify value of d:

CountRoots[Sqrt[(x^2 - 1)^2 + d^2] /. d -> 0, {x, 0, 5}]

1

CountRoots[Sqrt[(x^2 - 1)^2 + d^2] /. d -> 1/2, {x, 0, 5}]

0

It must be noted that CountRoots above counts roots on interval 0 <= x <= 5, not 0 < x < 5.

$\endgroup$
2
  • $\begingroup$ Thank you. It works for polynomials. Now I am trying to extend this to my real problem, which is not polynomial. Thank you again. $\endgroup$
    – gurluk
    Apr 23, 2015 at 20:20
  • $\begingroup$ @gurluk I fear that's another question altogether... $\endgroup$
    – kirma
    Apr 23, 2015 at 20:36

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.