0
$\begingroup$

I've a complicated expression which depends on several variables. I want to find some values for those variables such that the complicated expression is real. How can I do that?

The obvious command to use is FindInstance but for some reason this command (used with a simplified but still illustrative function below) does not work:

FindInstance[x + y - Log[z + a](b + c) ∈ Reals, {x,y,z,a,b,c}]

The error returned is "FindInstance::nsmet: The methods available to FindInstance are insufficient to find the requested instances or prove they do not exist." However it's fairly obvious what a possible instance is: $x=y=0, z=a=b=c=1$; in fact as long as $z+a > 0$ the condition is met.

$\endgroup$

2 Answers 2

1
$\begingroup$

If you are willing to assume that the parameters are real valued:

FindInstance[x + y - Log[z + a] (b + c) \[Element] Reals, {x, y, z, a, b, c} \[Element] Reals]

Or you can get a fuller account:

Reduce[x + y - Log[z + a] (b + c) \[Element] Reals, {x, y, z, a, b, c} \[Element] Reals]
$\endgroup$
1
$\begingroup$

Look at FunctionDomain

FunctionDomain[x + y - Log[z + a] (b + c), {x, y, z, a, b, c}, Reals]

(* a + z > 0 *)

Consequently, given that all variables are real the expression is real provided that a + z > 0. Then

solns = FindInstance[a + z > 0, {x, y, z, a, b, c}, Reals, 5]

(* {{x -> -(14/5), y -> -(31/10), z -> -(117/5), a -> 73, b -> -(21/5), 
  c -> -3}, {x -> -(1/5), y -> 12/5, z -> 99/5, a -> 49, b -> -(1/5), 
  c -> 47/10}, {x -> 5/2, y -> -(23/10), z -> 43/5, a -> 39, b -> 7/10, 
  c -> 1/2}, {x -> 39/10, y -> -(18/5), z -> -(69/5), a -> 80, b -> 23/5, 
  c -> -(3/10)}, {x -> 23/5, y -> 9/2, z -> 171/10, a -> 49, b -> -(18/5), 
  c -> -(1/5)}} *)

Verifying,

And @@ (x + y - Log[z + a] (b + c) ∈ Reals /. solns)

(* True *)
$\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.