# Getting error 'InterpolatingFunction::dmval' while trying to find the maximum of an interpolated function

The code I used is

ans1 = ParallelTable[{T, phiphibsol[T, 0.1]}, {T, 0.00001, 0.5, 0.001}];

ans2 = Interpolation[ans1];

ans3[x_] = D[ans2[xd], xd] /. xd -> x;

ans = x /. FindMaximum[ans3[x], {x, 0.1}][[2]]

I get the following warnings:

InterpolatingFunction::dmval: Input value {0.6} lies outside the range of data in the interpolating function. Extrapolation will be used.

InterpolatingFunction::dmval: Input value {0.6} lies outside the range of data in the interpolating function. Extrapolation will be used.

InterpolatingFunction::dmval: Input value {0.6} lies outside the range of data in the interpolating function. Extrapolation will be used.

General::stop: Further output of InterpolatingFunction::dmval will be suppressed during this calculation.

FindMaximum::sdprec: Line search unable to find a sufficient increase in the function value with MachinePrecision digit precision.

The data I work with is

ans1={{0.00001, 0.}, {0.00101, -1.04405*10^-53}, {0.00201, -2.9935*10^-49},{0.00301, -1.1495*10^-46}, {0.00401, -8.8457*10^-45}, {0.00501,8.92487*10^-41}, {0.00601, 1.55833*10^-34}, {0.00701,4.80314*10^-30}, {0.00801, 1.17817*10^-26}, {0.00901,  5.29047*10^-24}, {0.01001, 7.17851*10^-22}, {0.01101,   4.05714*10^-20}, {0.01201, 1.18497*10^-18}, {0.01301,   2.07894*10^-17}, {0.01401, 2.44123*10^-16}, {0.01501,   2.07807*10^-15}, {0.01601, 1.36174*10^-14}, {0.01701,  7.19326*10^-14}, {0.01801, 3.175*10^-13}, {0.01901,  1.20466*10^-12}, {0.02001, 4.01918*10^-12}, {0.02101,  1.20094*10^-11}, {0.02201, 3.26226*10^-11}, {0.02301,  8.15634*10^-11}, {0.02401, 1.89631*10^-10}, {0.02501,  4.13525*10^-10}, {0.02601, 8.51987*10^-10}, {0.02701,  1.66876*10^-9}, {0.02801, 3.12382*10^-9}, {0.02901,5.61435*10^-9}, {0.03001, 9.72652*10^-9}, {0.03101, 1.62991*10^-8}, {0.03201, 2.64993*10^-8}, {0.03301,  4.19114*10^-8}, {0.03401,6.46373*10^-8}, {0.03501,  9.74089*10^-8}, {0.03601, 1.43712*10^-7}, {0.03701,  2.07917*10^-7}, {0.03801, 2.95425*10^-7}, {0.03901, 4.12808*10^-7}, {0.04001, 5.67972*10^-7}, {0.04101,7.70302*10^-7}, {0.04201, 1.03083*10^-6}, {0.04301, 1.36239*10^-6}, {0.04401,1.77977*10^-6}, {0.04501,  2.29988*10^-6}, {0.04601, 2.94188*10^-6}, {0.04701,3.72737*10^-6}, {0.04801, 4.68046*10^-6}, {0.04901, 5.82799*10^-6}, {0.05001, 7.19957*10^-6}, {0.05101,  8.82775*10^-6}, {0.05201,0.0000107481}, {0.05301,  0.0000129994}, {0.05401, 0.0000156236}, {0.05501,  0.000018666}, {0.05601, 0.0000221751}, {0.05701, 0.0000262031}, {0.05801, 0.0000308055}, {0.05901,0.0000360416}, {0.06001, 0.000041974}, {0.06101, 0.000048669}, {0.06201, 0.0000561966}, {0.06301, 0.0000646304}, {0.06401, 0.0000740477}, {0.06501, 0.0000845293}, {0.06601, 0.0000961599}, {0.06701, 0.000109028}, {0.06801, 0.000123224}, {0.06901, 0.000138845}, {0.07001, 0.00015599}, {0.07101, 0.00017476}, {0.07201, 0.000195263}, {0.07301,0.000217607}, {0.07401, 0.000241906}, {0.07501,0.000268277}, {0.07601, 0.000296844}, {0.07701, 0.000327721}, {0.07801, 0.000361039}, {0.07901, 0.000396928}, {0.08001, 0.000435523}, {0.08101, 0.000476959}, {0.08201, 0.000521377}, {0.08301, 0.00056892}, {0.08401, 0.000619734}, {0.08501, 0.000673971}, {0.08601, 0.000731782}, {0.08701, 0.000793325}, {0.08801, 0.000858759}, {0.08901, 0.000928247}, {0.09001, 0.00100196}, {0.09101, 0.00108005}, {0.09201, 0.00116271}, {0.09301, 0.00125012}, {0.09401, 0.00134243}, {0.09501, 0.00143986}, {0.09601, 0.00154256}, {0.09701, 0.00165075}, {0.09801, 0.00176438}, {0.09901,0.00188409}, {0.10001, 0.00200987}, {0.10101, 0.00214194}, {0.10201, 0.00228047}, {0.10301, 0.00242569}, {0.10401, 0.00257783}, {0.10501, 0.0027371}, {0.10601, 0.00290373}, {0.10701, 0.00307794}, {0.10801, 0.00325997}, {0.10901, 0.00345006}, {0.11001, 0.00364852}, {0.11101, 0.00385547}, {0.11201, 0.00407122}, {0.11301, 0.00429603}, {0.11401, 0.00453017}, {0.11501, 0.0047739}, {0.11601, 0.00502749}, {0.11701, 0.00529123}, {0.11801, 0.00556541}, {0.11901, 0.00585032}, {0.12001, 0.00614626}, {0.12101, 0.00645354}, {0.12201, 0.00677247}, {0.12301, 0.00710338}, {0.12401, 0.00744659}, {0.12501, 0.00780245}, {0.12601, 0.00817131}, {0.12701, 0.00855352}, {0.12801, 0.00894944}, {0.12901, 0.00935947}, {0.13001, 0.00978398}, {0.13101, 0.0102234}, {0.13201, 0.0106781}, {0.13301, 0.0111485}, {0.13401, 0.011635}, {0.13501, 0.0121382}, {0.13601, 0.0126584}, {0.13701, 0.0131962}, {0.13801, 0.013752}, {0.13901, 0.0143263}, {0.14001, 0.0149197}, {0.14101, 0.0155327}, {0.14201, 0.0161659}, {0.14301, 0.0168199}, {0.14401, 0.0174952}, {0.14501, 0.0181925}, {0.14601, 0.0189125}, {0.14701, 0.0196557}, {0.14801, 0.020423}, {0.14901, 0.021215}, {0.15001, 0.0220324}, {0.15101, 0.0228762}, {0.15201, 0.0237471}, {0.15301, 0.0246458}, {0.15401, 0.0255735}, {0.15501, 0.0265308}, {0.15601, 0.0275189}, {0.15701, 0.0285387}, {0.15801, 0.0295913}, {0.15901, 0.0306778}, {0.16001,  0.0317992}, {0.16101, 0.0329569}, {0.16201, 0.034152}, {0.16301,  0.0353859}, {0.16401, 0.03666}, {0.16501, 0.0379757}, {0.16601,  0.0393345}, {0.16701, 0.0407379}, {0.16801, 0.0421878}, {0.16901, 0.0436857}, {0.17001, 0.0452336}, {0.17101, 0.0468335}, {0.17201, 0.0484872}, {0.17301, 0.050197}, {0.17401, 0.0519651}, {0.17501, 0.0537939}, {0.17601, 0.0556859}, {0.17701, 0.0576437}, {0.17801, 0.0596701}, {0.17901, 0.061768}, {0.18001, 0.0639406}, {0.18101, 0.066191}, {0.18201, 0.0685227}, {0.18301, 0.0709394}, {0.18401,  0.0734449}, {0.18501, 0.0760431}, {0.18601, 0.0787384}, {0.18701, 0.0815353}, {0.18801, 0.0844384}, {0.18901, 0.0874528}, {0.19001, 0.0905838}, {0.19101, 0.0938368}, {0.19201, 0.0972177}, {0.19301, 0.100733}, {0.19401, 0.104383}, {0.19501, 0.10819}, {0.19601, 0.112144}, {0.19701, 0.116264}, {0.19801, 0.120551}, {0.19901, 0.125014}, {0.20001, 0.129662}, {0.20101, 0.134504}, {0.20201, 0.139546}, {0.20301, 0.144799}, {0.20401, 0.150271}, {0.20501, 0.15597}, {0.20601, 0.161905}, {0.20701, 0.168083}, {0.20801, 0.174513}, {0.20901, 0.181201}, {0.21001, 0.188153}, {0.21101, 0.195374}, {0.21201, 0.202868}, {0.21301, 0.210636}, {0.21401, 0.218677}, {0.21501, 0.226988}, {0.21601, 0.235561}, {0.21701, 0.244386}, {0.21801, 0.253447}, {0.21901, 0.262722}, {0.22001, 0.272186}, {0.22101, 0.281806}, {0.22201, 0.291537}, {0.22301, 0.301333}, {0.22401, 0.31114}, {0.22501, 0.3209}, {0.22601, 0.330555}, {0.22701, 0.34005}, {0.22801, 0.349342}, {0.22901, 0.3584}, {0.23001, 0.367211}, {0.23101, 0.375775}, {0.23201,  0.384105}, {0.23301, 0.392219}, {0.23401, 0.400139}, {0.23501, 0.407888}, {0.23601, 0.415484}, {0.23701, 0.422944}, {0.23801, 0.430281}, {0.23901, 0.437505}, {0.24001, 0.444625}, {0.24101, 0.451646}, {0.24201, 0.458572}, {0.24301, 0.465406}, {0.24401, 0.47215}, {0.24501, 0.478805}, {0.24601, 0.485371}, {0.24701, 0.491849}, {0.24801, 0.498239}, {0.24901, 0.504539}, {0.25001, 0.510751}, {0.25101, 0.516874}, {0.25201, 0.522907}, {0.25301, 0.52885}, {0.25401, 0.534704}, {0.25501, 0.540467}, {0.25601, 0.54614}, {0.25701, 0.551724}, {0.25801, 0.557218}, {0.25901, 0.562622}, {0.26001, 0.567938}, {0.26101, 0.573165}, {0.26201, 0.578304}, {0.26301, 0.583356}, {0.26401, 0.588321}, {0.26501, 0.5932}, {0.26601, 0.597995}, {0.26701, 0.602705}, {0.26801, 0.607333}, {0.26901, 0.611878}, {0.27001, 0.616343}, {0.27101, 0.620727}, {0.27201, 0.625033}, {0.27301, 0.629261}, {0.27401, 0.633413}, {0.27501, 0.637489}, {0.27601, 0.641491}, {0.27701, 0.645421}, {0.27801, 0.649278}, {0.27901, 0.653065}, {0.28001, 0.656783}, {0.28101, 0.660432}, {0.28201, 0.664015}, {0.28301, 0.667532}, {0.28401, 0.670984}, {0.28501, 0.674373}, {0.28601, 0.677699}, {0.28701, 0.680965}, {0.28801, 0.68417}, {0.28901, 0.687317}, {0.29001, 0.690407}, {0.29101, 0.693439}, {0.29201, 0.696416}, {0.29301, 0.699339}, {0.29401, 0.702209}, {0.29501, 0.705026}, {0.29601, 0.707792}, {0.29701, 0.710507}, {0.29801, 0.713174}, {0.29901, 0.715792}, {0.30001, 0.718363}, {0.30101, 0.720887}, {0.30201, 0.723366}, {0.30301, 0.7258}, {0.30401, 0.728191}, {0.30501, 0.730539}, {0.30601, 0.732845}, {0.30701, 0.73511}, {0.30801, 0.737335}, {0.30901, 0.73952}, {0.31001, 0.741667}, {0.31101, 0.743775}, {0.31201, 0.745847}, {0.31301, 0.747882}, {0.31401, 0.749882}, {0.31501, 0.751846}, {0.31601,  0.753777}, {0.31701, 0.755674}, {0.31801, 0.757538}, {0.31901, 0.759369}, {0.32001, 0.76117}, {0.32101, 0.762939}, {0.32201, 0.764678}, {0.32301, 0.766387}, {0.32401, 0.768067}, {0.32501, 0.769719}, {0.32601, 0.771343}, {0.32701, 0.772939}, {0.32801, 0.774508}, {0.32901, 0.776051}, {0.33001, 0.777569}, {0.33101, 0.779061}, {0.33201, 0.780528}, {0.33301, 0.781971}, {0.33401, 0.78339}, {0.33501, 0.784786}, {0.33601, 0.786158}, {0.33701, 0.787509}, {0.33801, 0.788837}, {0.33901, 0.790144}, {0.34001,  0.79143}, {0.34101, 0.792694}, {0.34201, 0.793939}, {0.34301, 0.795164}, {0.34401, 0.796369}, {0.34501, 0.797554}, {0.34601, 0.798721}, {0.34701, 0.79987}, {0.34801, 0.801}, {0.34901, 0.802113}, {0.35001, 0.803208}, {0.35101, 0.804287}, {0.35201, 0.805348}, {0.35301, 0.806393}, {0.35401, 0.807422}, {0.35501,  0.808435}, {0.35601, 0.809433}, {0.35701, 0.810415}, {0.35801, 0.811382}, {0.35901, 0.812335}, {0.36001, 0.813273}, {0.36101, 0.814198}, {0.36201, 0.815108}, {0.36301, 0.816005}, {0.36401, 0.816888}, {0.36501, 0.817758}, {0.36601, 0.818616}, {0.36701, 0.81946}, {0.36801, 0.820293}, {0.36901, 0.821113}, {0.37001, 0.821921}, {0.37101, 0.822718}, {0.37201, 0.823503}, {0.37301, 0.824277}, {0.37401, 0.825039}, {0.37501, 0.825791}, {0.37601, 0.826532}, {0.37701, 0.827263}, {0.37801, 0.827983}, {0.37901, 0.828693}, {0.38001, 0.829393}, {0.38101, 0.830083}, {0.38201, 0.830764}, {0.38301, 0.831435}, {0.38401, 0.832097}, {0.38501, 0.83275}, {0.38601, 0.833393}, {0.38701, 0.834028}, {0.38801, 0.834655}, {0.38901, 0.835273}, {0.39001, 0.835882}, {0.39101, 0.836483}, {0.39201, 0.837077}, {0.39301, 0.837662}, {0.39401, 0.838239}, {0.39501, 0.838809}, {0.39601, 0.839371}, {0.39701,  0.839926}, {0.39801, 0.840474}, {0.39901, 0.841014}, {0.40001, 0.841548}, {0.40101, 0.842074}, {0.40201, 0.842594}, {0.40301, 0.843107}, {0.40401, 0.843613}, {0.40501, 0.844113}, {0.40601, 0.844607}, {0.40701, 0.845094}, {0.40801, 0.845575}, {0.40901, 0.84605}, {0.41001, 0.846519}, {0.41101, 0.846982}, {0.41201, 0.84744}, {0.41301, 0.847892}, {0.41401, 0.848338}, {0.41501, 0.848778}, {0.41601, 0.849214}, {0.41701, 0.849644}, {0.41801, 0.850068}, {0.41901, 0.850488}, {0.42001, 0.850902}, {0.42101, 0.851312}, {0.42201, 0.851716}, {0.42301, 0.852116}, {0.42401, 0.852511}, {0.42501, 0.852901}, {0.42601, 0.853287}, {0.42701, 0.853668}, {0.42801, 0.854044}, {0.42901, 0.854416}, {0.43001, 0.854784}, {0.43101, 0.855148}, {0.43201, 0.855507}, {0.43301, 0.855862}, {0.43401, 0.856213}, {0.43501, 0.856561}, {0.43601, 0.856904}, {0.43701, 0.857243}, {0.43801, 0.857578}, {0.43901, 0.85791}, {0.44001, 0.858238}, {0.44101, 0.858562}, {0.44201, 0.858882}, {0.44301, 0.859199}, {0.44401, 0.859513}, {0.44501, 0.859823}, {0.44601, 0.860129}, {0.44701, 0.860432}, {0.44801, 0.860732}, {0.44901, 0.861029}, {0.45001, 0.861322}, {0.45101, 0.861612}, {0.45201, 0.8619}, {0.45301, 0.862184}, {0.45401, 0.862464}, {0.45501, 0.862742}, {0.45601, 0.863017}, {0.45701, 0.863289}, {0.45801, 0.863559}, {0.45901, 0.863825}, {0.46001, 0.864089}, {0.46101, 0.864349}, {0.46201, 0.864607}, {0.46301,  0.864863}, {0.46401, 0.865116}, {0.46501, 0.865366}, {0.46601, 0.865613}, {0.46701, 0.865858}, {0.46801, 0.866101}, {0.46901, 0.866341}, {0.47001, 0.866578}, {0.47101, 0.866814}, {0.47201, 0.867046}, {0.47301, 0.867277}, {0.47401, 0.867505}, {0.47501, 0.867731}, {0.47601, 0.867955}, {0.47701, 0.868176}, {0.47801, 0.868395}, {0.47901, 0.868613}, {0.48001, 0.868827}, {0.48101, 0.86904}, {0.48201, 0.869251}, {0.48301, 0.86946}, {0.48401,  0.869667}, {0.48501, 0.869871}, {0.48601, 0.870074}, {0.48701, 0.870275}, {0.48801, 0.870474}, {0.48901, 0.870671}, {0.49001, 0.870866}, {0.49101, 0.871059}, {0.49201, 0.871251}, {0.49301, 0.87144}, {0.49401, 0.871628}, {0.49501, 0.871814}, {0.49601, 0.871999}, {0.49701, 0.872181}, {0.49801, 0.872362}, {0.49901, 0.872542}}

To obtain the derivative you can simply write

ans2 = Interpolation[ans1];
ans3 = ans2';

which looks like

Plot[ans3[x], {x, 0, 1/2}]

The part of the x-axis where you have data is

lims = Sequence @@ MinMax[ans1[[All, 1]]]

Sequence[0.00001, 0.49901]

Within this interval, the derivative is maximized by

Last[FindMaximum[ans3[x], {x, 0.1, lims}]]
FindArgMax[ans3[x], {x, 0.1, lims}]

{x -> 0.22319965}
{0.22319965}

which is found without warnings, because the search is restricted to the support of the interpolation.

• Thank you very much. It works. Now I also understand why it was giving the warning. Thank you once again. Commented Nov 15, 2018 at 20:12