# Solve returns values which are not a solution

I'm solving the system of tree equations one of which is an integral equation. Solve returns solution for this system, but when I plug this solution into the last equation (eq3), it doesn't hold ($\Delta[\theta_2]\neq 0$). What could be a problem?

Plain text code is also provided.

P.S. eq3 is an integral equation but actually, the function under the integral sign is just a polynomial which is an easily integrable function. $H[\tau]$ is also just a polynomial. So I'm not sure what problems Mathematica is having.

Remove[Evaluate[\$Context <> "*"]];
(*Initial conditions*)
p = 0.5; n = 15; ρ = 0.1; r = 0.05; \
δ = 0.99; m = 4;
b[x_] := 1 - x;
K[x_] := -(x/2);
F[x_] := x;
(*Technical instruments*)
f[x_] := F'[x];
k[a_, b_] := \!$$\*SubsuperscriptBox[\(∫$$, $$a$$, $$b$$]$$K[ x]f[x] \[DifferentialD]x/\((F[b] - F[a])$$\)\);
h[τ_] := n!/(m! (n - m - 1)!) (F[τ] - F[Subscript[θ, D]])^m f[τ] (1 - (F[τ] - F[Subscript[θ, D]]))^(n - m - 1);
H[τ_] := \!$$\*SubsuperscriptBox["∫", SubscriptBox["θ", "D"], StyleBox["τ",FontWeight->"Plain"]]\(h[x] \[DifferentialD]x$$\);
Δ[x_] := (1 - δ) b[x] - (1 - H[x]) (ρ + p (Subscript[k, D] - Subscript[k, N])) + \!$$\*SubsuperscriptBox[\(∫$$, SubscriptBox[$$θ$$, $$2$$], SubscriptBox[$$θ$$, $$A$$]]$$δ\ b[τ] h[τ] \\[DifferentialD]τ$$\)
Subscript[k, D] = Simplify[k[0, Subscript[θ, 2]]];
Subscript[k, A] = Simplify[k[Subscript[θ, 2], Subscript[θ, A]]];
Subscript[k, N] = Simplify[k[Subscript[θ, A], 1]];

eq1 = δ b[Subscript[θ, A]] - p (Subscript[k, A] - Subscript[k, N]) == r;
eq2 = ρ + p (Subscript[k, D] - Subscript[k, N]) == δ b[Subscript[θ, 2]];
eq3 = Δ[Subscript[θ, D]] == 0;
solution = Solve[{eq1, eq2, eq3, 0 <= Subscript[θ, D] < Subscript[θ, 2] < Subscript[θ, A] <= 1}, {Subscript[θ, 2], Subscript[θ, D], Subscript[θ, A]}, Reals];
Subscript[θ, 2] = Subscript[θ, 2] /. solution[[1]];
Subscript[θ, A] = Subscript[θ, A] /. solution[[1]];
Subscript[θ, D] = Subscript[θ, D] /. solution[[1]];
Print["Subscript[θ, D]=", Subscript[θ, D], ", Subscript[θ, 2]=", Subscript[θ, 2], ", Subscript[θ, A]=",Subscript[θ, A]]
Δ[Subscript[θ, D]]
• Your code didn't work for me when I pasted it. Well, it could be the numerics of machine precision, such as here. Whether -0.2183 is close to zero depends on what you compare it. Consider this much simpler example than yours: 10^20 (x^3 - 4.) /. Solve[10^20 (x^3 - 4.) == 0, x, Reals]. There does not exist a floating point number that is exactly equal to the cube-root of 4. Another problem may or may not be your use of system symbols such as D, N and K. They're unsafe. – Michael E2 Apr 6 '18 at 1:02
• 1) Don't use subscripts. 2) Don't use capital letters to define variables (e.g., K). 3) Do you think you could reduce this to a MWE? – AccidentalFourierTransform Apr 6 '18 at 1:28