# Solve[] isn't producing a correct result

I want to find the exact algebraic roots of the following function in terms of Z, P, Q, F, and A:

f(x) = (-2*F*x*Z^2*(P^2 + P*Z + (x*Z)^2)/(P^2 + (x*Z)^2)^(3/2) + 2*x*Z^2*(2*F/Sqrt[P^2 + (x*Z)^2] + 1))*Cos[A + Sqrt[(F^2 + P*Z + Z^2 + (P^2 + P*Z + (x*Z)^2)*(2*F/Sqrt[P^2 + (x*Z)^2] + 1))/(Z*Cos[A])^2 - 1] - Tan[A]]/(2*Z*Cos[A])
- (1 + F/Sqrt[P^2 + (x*Z)^2])*(x*Z*Cos[Q - x] + P*Sin[Q - x] - Z*Sin[Q - x])
+ (F*x*Z^2*(P*Cos[Q - x] - x*Z*Sin[Q - x]))/(P^2 + (x*Z)^2)^(3/2)
- Z*Sin[Q - x]


I tried inputting Solve[<THAT EXPRESSION> == 0, x] in WolframScript, but the expressions it outputs do not line up with the zeroes I can visually see (or numerically calculate) when plotting the function and WolframScript's solutions in GeoGebra. I also tried Reduce[<THAT EXPRESSION> == 0, x], but it ran for an hour without outputting any response.

What is going wrong here? Am I making a mistake somewhere, or am I running into a limitation of the software?

The variables in the function have the following definitions:

• Q = (F*Sec[A] - P*Tan[A])/Z
• P = S - C + F, and the function in my question is only valid when P is negative
• Z can be any positive number
• S is in the interval [-1, 1]
• C is in the interval [1, 1.25]
• A is in the interval [0, Arccos[4*C/Sqrt[(4*C)^2 + π^2]]]
• F is in both the intervals [0, (Tan[A] + Sec[A])*(π/4 - C*Tan[A])] and [0, (Tan[A] + Sec[A])*Sec[A]*(C - 1)]

As an example, here is a picture of the function plotted in GeoGebra as a brown curve and the six solutions produced by WolframScript Solve[] plotted as complex points. Note that none of the Wolfram points line up with any of the actual x-intercepts of the function:

• Mathematica v12.2 gives 6 solutions, some are complex. Nov 1, 2023 at 15:11
• If you are plotting then you must be using specific values for all of the parameters. What are these values? Nov 1, 2023 at 15:23
• @UlrichNeumann That's what I'm getting. None of the real or imaginary parts of any of the six solutions line up with the actual zeroes of the function as plotted in GeoGebra. Nov 1, 2023 at 16:04
• @BobHanlon I tried a range of values for each parameter. I've added the relevant information to my question. Nov 1, 2023 at 16:18
• @Lawton Please provide the parameter set which you took in your GeoGebra solution! Nov 1, 2023 at 20:19

To long for a comment

NSolve evaluates all zeros for given parameter

parameters (from @Larson's GeoGebra picture )

subst = {z -> 20, A -> 22.5 \[Degree], S -> -0.15, C -> 1.25, F -> 0.4,
Q -> (F*Sec[A] - P*Tan[A])/z, P -> S - C + F};

f[x_] := ((-2*F*x*z^2*(P^2 + P*z + (x*z)^2)/(P^2 + (x*z)^2)^(3/2) +
2*x*z^2*(2*F/Sqrt[P^2 + (x*z)^2] + 1))*Cos[A + Sqrt[(F^2 + P*z +
z^2 + (P^2 + P*z + (x*z)^2)*(2*F/Sqrt[P^2 + (x*z)^2] + 1))/(z*Cos[A])^2 - 1]
- Tan[A]]/(2*z*Cos[A])- (1 + F/Sqrt[P^2 + (x*z)^2])*(x*z*Cos[Q - x] +
P*Sin[Q - x] -z*Sin[Q - x])
+ (F*x*z^2*(P*Cos[Q - x] - x*z*Sin[Q - x]))/(P^2 + (x*z)^2)^(3/2)
- z*Sin[Q - x]) //.subst;

sol = NSolve[{(f[x] //. subst) == 0, -1 < x < 1}, x ,Reals]
(*{{x -> -0.387626}, {x -> -0.120711}, {x -> 0.244516}} *)

Plot[ f[x] , {x, -1, 1} , GridLines -> {x /. sol , None},PlotRange->{-1,1}]


• I added a picture of my GeoGebra file to my question. Nov 2, 2023 at 14:14
• This does suggest that NSolve[] finds the correct solutions; however, I want algebraic solutions, not numeric solutions, and Solve[] is still not providing accurate solutions. Nov 2, 2023 at 14:54
• @Lawton Solve[...]gives the message "Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information." Nov 2, 2023 at 15:12
• As I said in my question, Reduce[] didn't produce an answer even after running for an hour. Nov 2, 2023 at 15:19