# Numerically Solving two dependent Transcendental Equations

I need to solve a system similar to the following (Except it is quite large. Solving this ought to do the job):

$$\tan[2f(t)] = 1+ t^2\$$

and

$f(t)$ is $k$, such that$$\tan[2kt]-(1+k^2) = 0\$$

I have used RootSearch for both equations as I also know the range in which $k$ and $T$ lie. The sample of my code is below.

f[T_] := k /. Extract[Flatten[Quiet[RootSearch[Tan[2*k*T] - (1 + k^2) == 0, {k, 0, 1}],
$MinPrecision::precset]], -1]; Extract[Flatten[Quiet[RootSearch[Tan[2*f[T]] - (1 + T^2) == 0, {T, 0, 1}],$MinPrecision::precset]], -1]


and I end up getting the following error

ReplaceAll::reps: {k,0,1} is neither a list of replacement rules nor a valid dispatch table,
and so cannot be used for replacing. >>


Please suggest a solution. It would be preferable to use something as powerful as RootSearch because my other equations seem to be unsolvable via FindRoot or NSolve.

-
 Using Mathemstica 8, I get ?RootSearch an error Information::notfound: "Symbol "RootSearch"not found." Please advice on this. – Nasser Aug 26 '12 at 11:27 @NasserM.Abbasi Please have a look at this – b.gatessucks Aug 26 '12 at 11:39 You could probably use FindAllCrossings2D[] on the system {Tan[2 y t] == 1 + y^2, Tan[2 y] == 1 + t^2}; you already know the ranges of y and t anyway, so... – J. M.♦ Aug 26 '12 at 11:41 There is no solution at T=0 for instance. – b.gatessucks Aug 26 '12 at 11:47

Define the equations:

eq1 = Tan[2 f[t]] == 1 + t^2;
eq2 = Tan[2 t f[t]] == 1 + f[t]^2;


Solve for f[t] - this is multivalued:

Reduce[eq1, f[t]]


Use this result to define a rule that implements the n-th solution for f:

solnf[n_Integer] := f[t] -> 1/2 (ArcTan[1 + t^2] + \[Pi] n);


Then define a rule that implements the n-th set of solutions for t in a predefined range of t:

solnt[n_Integer, {t1_, t2_}] :=
NSolve[((eq2 /. solnf[n]) && t1 <= t <= t2) // Evaluate, t, Reals];


Now you can generate sets of solutions using solnt[n,{t1,t2}].

-

FindRoot can be used.

exprs = {Tan[2 k] - 1 + t^2, Tan[2 t k] - 1 + k^2};
rt = FindRoot[exprs == 0, {t, 1}, {k, 2}]

(* Out[127]= {t -> 0.514542275159657, k -> 1.887792150510011} *)


Check result:

In[128]:= exprs /. rt

(* Out[128]= {2.220446049250313*10^-16, -8.881784197001252*10^-16} *)

-