1
$\begingroup$

I've got a problem solving an equation. I want to solve:

Solve[Arg[h]==0, r0, Reals]

with h being some imaginary number containing r0 which is a real number and can vary. I get an error stating:

The system contains a nonreal constant I. With the domain Reals specified, all constants should be real.

Maybe I've done something wrong but I'm sure that this is not true in general. E.g.: Solve[Arg[x * I]==0, x, Reals] gets the same error, but it is obvious that x=0 is a solution to this problem.

How can I solve the equation then? I am certain that it had a solution because I've seen dataplots where the curve goes through zero.

$\endgroup$
3
$\begingroup$

From the documentation:

If dom is Reals, or a subset such as Integers or Rationals, then all constants and function values are also restricted to be real.

So if a complex number is involved, specify the constraints as constraints rather than a domain. Since you did not specify the form of h, as an example let its form be h = (x - r0) + (y + r0)*I.

Solve[
  {Arg[(x - r0) + (y + r0)*I] == 0,
   Element[{r0, x, y}, Reals]},
  r0] // Simplify[#, Element[{r0, x, y}, Reals]] &

{{r0 -> ConditionalExpression[-y, x + y >= 0]}}

$\endgroup$
  • $\begingroup$ I'm sorry maybe I haven't specified it clearly in the question but r0 is not an imaginary number only h is. My real question is probably why Mathematica needs no imaginairy constants while it is obvious that it is solvable without imaginary constants since the argument is always real (look at my example). $\endgroup$ – user1792605 Jan 6 '15 at 15:07
  • $\begingroup$ I merely expanded the imaginary number h into its real and imaginary components. My answer then explicitly states that r0 is Real (as well as x and y). If the domain is Reals, as soon as Mma encounters the Head Complex, it stops and issues the error warning. $\endgroup$ – Bob Hanlon Jan 6 '15 at 15:22
  • $\begingroup$ Allright thanks. But I still don't see why Mathematica would do such a thing. If I'm not mistaken the only reason it stops is beacuase it thinks that there will probably be no real answers since you start computing with something that is imaginary in some cases? I mean it is still really obvious that in some cases there are non imaginary answers to equations that contain imaginary constants if e.g. in my case the argument is taken of this imaginary constant. $\endgroup$ – user1792605 Jan 6 '15 at 15:34

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.