# FunctionDomain and FindInstance problem

I have some functions including many real parameters as follows:

For example,

f[x_] := (2*I*Sqrt[2]*Sqrt[Subscript[a, 3]]*
Sqrt[-((y*z*(-1 + k*Subscript[β, 2])*(k*p + ϕ + k^2*Subscript[β, 1] - k*ϕ*Subscript[β, 2]))/
(Subscript[a, 3]*(Subscript[β, 1] + p*Subscript[β, 2] + k*Subscript[β, 1]*Subscript[β, 2] - ϕ*Subscript[β, 2]^2)))]*
Sqrt[Subscript[β, 1] + p*Subscript[β, 2] + k*Subscript[β, 1]*Subscript[β, 2] - ϕ*Subscript[β, 2]^2])/
(((-E^((-x)*Sqrt[-(((-1 + k*Subscript[β, 2])*(k*p + ϕ + k^2*Subscript[β, 1] - k*ϕ*Subscript[β, 2]))/
(Subscript[β, 1] + p*Subscript[β, 2] + k*Subscript[β, 1]*Subscript[β, 2] - ϕ*Subscript[β, 2]^2))]))*y +
E^(x*Sqrt[-(((-1 + k*Subscript[β, 2])*(k*p + ϕ + k^2*Subscript[β, 1] - k*ϕ*Subscript[β, 2]))/
(Subscript[β, 1] + p*Subscript[β, 2] + k*Subscript[β, 1]*Subscript[β, 2] - ϕ*Subscript[β, 2]^2))])*z)*
Sqrt[b + 2*k*q + 2*k*r - b*k*Subscript[β, 2] - 2*k^2*q*Subscript[β, 2] - 2*k^2*r*Subscript[β, 2]]);


I want to find appropriate parameters satisfying f(x):R->R. I think we can use FunctionDomain and then FindInstance.

The commands work for my other problems. But in here, FunctionDomain gives False.

dom = FunctionDomain[f[x], {x,b, k, p, q, r, y, z, ϕ, Subscript[a, 3], Subscript[β, 1], Subscript[β, 2]}, Reals]
FindInstance[dom, {x,b, k, p, q, r, y, z, ϕ, Subscript[a, 3], Subscript[β, 1], Subscript[β, 2]} ∈ Reals, 3]


But when I substitute the following parameters into the f[x], I get a real-valued function.

params = {b -> 7/8, k -> 7/8, p -> 7/8, q -> 7/8, r -> 7/8,
y -> -(7/8), z -> 7/8, ϕ -> 7/8, Subscript[a, 3] -> 1,
Subscript[β, 1] -> 7/8, Subscript[β, 2] -> 7/8};

Simplify[f[x] /. params]


If FunctionDomain doesn't work for this kind of problem, how to find the domain of the function given in the post and then how to find appropriate parameters satisfying f(x):R->R.

• Isn't this mentioned in the Possible Issues explicitly or am I misunderstanding something? "All subexpressions of f need to be real-valued for a point to belong to the real domain of f" reference.wolfram.com/language/ref/FunctionDomain.html
– user49048
Feb 28, 2022 at 2:41
• If FunctionDomain doesn't work for this kind of problem, how to find the domain of the function given in the post and then how to find appropriate parameters satisfying f(x):R->R. Feb 28, 2022 at 17:55

In fact, you consider a function of many variables

f[x_, Subscript[\[Beta], 1] _, Subscript[\[Beta], 2] _,  Subscript[a, 3] _, y_, z_, k_,
\[Phi]_, p_, r_, q_] := (2*I*Sqrt[2]*Sqrt[Subscript[a, 3]]*
Sqrt[-((y*
z*(-1 + k*Subscript[\[Beta], 2])*(k*p + \[Phi] +
k^2*Subscript[\[Beta], 1] -
k * Subscript[\[Beta], 2]))/(Subscript[a,
3]*(Subscript[\[Beta], 1] + p*Subscript[\[Beta], 2] +
k*Subscript[\[Beta], 1]*Subscript[\[Beta], 2] - \[Phi]*
Subscript[\[Beta], 2]^2)))]*
Sqrt[Subscript[\[Beta], 1] + p*Subscript[\[Beta], 2] +
k*Subscript[\[Beta], 1]*Subscript[\[Beta], 2] - \[Phi]*
Subscript[\[Beta],
2]^2])/(((-E^((-x)*
Sqrt[-(((-1 + k*Subscript[\[Beta], 2])*(k*p + \[Phi] +
k^2*Subscript[\[Beta], 1] -
k*\[Phi]*
Subscript[\[Beta], 2]))/(Subscript[\[Beta], 1] +
p*Subscript[\[Beta], 2] +
k*Subscript[\[Beta], 1]*
Subscript[\[Beta], 2] - \[Phi]*
Subscript[\[Beta], 2]^2))]))*y +
E^(x*Sqrt[-(((-1 + k*Subscript[\[Beta], 2])*(k*p + \[Phi] +
k^2*Subscript[\[Beta], 1] -
k*\[Phi]*
Subscript[\[Beta], 2]))/(Subscript[\[Beta], 1] +
p*Subscript[\[Beta], 2] +
k*Subscript[\[Beta], 1]*
Subscript[\[Beta], 2] - \[Phi]*
Subscript[\[Beta], 2]^2))])*z)*
Sqrt[b + 2*k*q + 2*k*r - b*k*Subscript[\[Beta], 2] -
2*k^2*q*Subscript[\[Beta], 2] -
2*k^2*r*Subscript[\[Beta], 2]]);


and ask when this function as a function of x is real-valued for every real value of x. The answer can be derived as follows.

Resolve[ForAll[x, x \[Element] Reals,  f[x, Subscript[\[Beta], 1],
Subscript[\[Beta], 2], Subscript[a, 3],
y, z, k, \[Phi], p, r, q] \[Element] Reals], Reals]


True

It means that for all real values of the parameters the answer is affirmative.

• A simpler example of such sort is Sqrt[-(I*a*x - 1)*(I*a*x + 1)] which defines a real-valued function for every real value of parameter a. Feb 28, 2022 at 15:48
• Please, explain the downvote. What is incorrect in my answer? In the other case such behavior does not make a good impression about this forum. Feb 28, 2022 at 18:05
• Thank you for your interest. You said that for all real values of the parameters the function is real-valued. What about params2 = {b -> 1, k -> 2, p -> 7/8, q -> 7/8, r -> 7/8, y -> -(7/8), z -> 7/8, \[Phi] -> 7/8, Subscript[a, 3] -> 1, Subscript[\[Beta], 1] -> 7/8, Subscript[\[Beta], 2] -> 7/8}; Simplify[f[x] /. params2] // Im Feb 28, 2022 at 18:11
• @Eric_Jansen: This results in (Sqrt[3/199] E^(2 I Sqrt[21/61] x) Sqrt[49 - 8 2*7/8])/(1 + E^( 4 I Sqrt[21/61] x))==(Sqrt[3/199] *Sqrt[49 - 8 2*7/8])/Cos[2 * Sqrt[21/61] x] which is real valued. See my simpler example in my comment. Don't hesitate to ask for further explanation in need and don't hurry to downvote. Feb 28, 2022 at 18:24
• For the user's convenience, here is the result in the standard math notation $$\frac{\sqrt{\frac{3}{199}} \sqrt{49-8 2\text{*}\frac{7}{8}} e^{2 i \sqrt{\frac{21}{61}} x}}{1+e^{4 i \sqrt{\frac{21}{61}} x}}.$$ Feb 28, 2022 at 18:35