Folks,
I want to numerically evaluate a InverseFunction
h[x]
close to the edges x5
and x2
of its domain, with no success up to now. As you can see below, h[x]
can only be evaluated sufficiently far from these points, which will not be suitable in my case.
I suspect I can use some hidden option of InverseFunction
like MaxIterations
. How can I properly perform this evaluation (in particular the NIntegrate
)?
The code is
Block[{f, if, g, ig, h, ih, x0, y0, x2, x3, y3, x4, x5, y5, ph2, ph3,
cont, norm}, With[{d = 10^-4, r = 10^-8, s = .005, L = 16, n = 10^6},
if[x_] := -((L s)/(d Log[s/(# r)]))
ProductLog[-((
d # Log[s/(# r)] n^(1/L) (s/(# r))^-((d #)/(L s)) )/(L s))] &[x];
f[x_] := InverseFunction[-((L s)/(d Log[s/(# r)]))
ProductLog[-((
d # Log[s/(# r)] n^(1/L) (s/(# r))^-((d #)/(L s)) )/(
L s))] &][x];
h[x_] := InverseFunction[-((L s)/(d Log[s/(# r)]))
ProductLog[-1, -((
d # Log[s/(# r)] n^(1/L) (s/(# r))^-((d #)/(L s)) )/(
L s))] &][x];
ih[x_] := -((L s)/(d Log[s/(# r)]))
ProductLog[-1, -((
d # Log[s/(# r)] n^(1/L) (s/(# r))^-((d #)/(L s)) )/(L s))] &[x];
ig[x_] := InverseFunction[(s Log[1/n] + d # Log[s/(# r)])/(
d Log[s/(# r)]) &][x];
g[x_] := (s Log[1/n] + d # Log[s/(# r)])/(d Log[s/(# r)]) &[x];
y3 = Re[y3] /. FindRoot[if[y3] == ih[y3], {y3, 25}];
x3 = if[y3];
x4 = ig[.001];
x2 = ih[.001];
y5 = Re[y5] /. FindRoot[ih[y5] == ig[y5], {y5, 10}, MaxIterations -> 1000];
x5 = ih[y5];
(* Here my problem is evident *)
Print[{y5, h[x5], h[1.02 x5], h[1.019 x5]}];
Print[{x2, h[x2], h[.94 x2], h[.98 x2]}]
(* Here is the operation I want to perform *)
NIntegrate[1, {a, .001, f[y5]}, {c, x5, ih[a]}, {b, Max[a, if[a]],
Min[c, h[c]]}]
]]
Thanks!
h[x]
does not evaluate for77~<x~<97
. Everything else is just distracting. $\endgroup$ – george2079 Nov 23 '15 at 20:11