Here's a method to speed things up for you. First, notice that simply restricting the argument patterns of m11 as in the community answer means that the derivative of m11 needs to be computed numerically (which is slow, because the definition of m11 already includes a numerical integration):
Clear[m11]
m11[t_?NumericQ, k_?NumericQ] := (k^2-k-1)/k^3 + Sqrt[2 k+1]/k^3 Erf[Sqrt[t (2 k+1)]] +
2 (k-1)/k^2 Sqrt[t/Pi] Exp[-(2 k+1) t] +
(1-k (k-1) (2 t+1))/k^3 Exp[-2 k t] Erfc[Sqrt[t]] +
2/k NIntegrate[
(Exp[-(t-s)]/Sqrt[Pi (t-s)]+Erf[Sqrt[t-s]]) *
(2 Exp[-s] Sqrt[s/Pi]-(2 s+1) Erfc[Sqrt[s]]) * Exp[-2 k s],
{s, 0, t}
]
D[m11[1, k], k]
% /. k->1. //AbsoluteTiming
Derivative[0, 1][m11][1, k]
{0.732255, -0.190263}
Instead, let's inactivate the integral in the definition of m11:
Clear[m11]
m11[t_, k_] := (k^2-k-1)/k^3 + Sqrt[2 k+1]/k^3 Erf[Sqrt[t (2 k+1)]] +
2 (k-1)/k^2 Sqrt[t/Pi] Exp[-(2 k+1) t] +
(1-k (k-1) (2 t+1))/k^3 Exp[-2 k t] Erfc[Sqrt[t]] +
2/k Inactive[NIntegrate][
(Exp[-(t-s)]/Sqrt[Pi (t-s)]+Erf[Sqrt[t-s]]) *
(2 Exp[-s] Sqrt[s/Pi]-(2 s+1) Erfc[Sqrt[s]]) * Exp[-2 k s],
{s, 0, t}
]
Now, the derivative of m11 is a bit more complicated:
dm11 = D[m11[1, k], k]
(-1 + 2 k)/k^3 - (3 (-1 - k + k^2))/k^4 + (2 E^(-1 - 2 k))/(
k^3 Sqrt[[Pi]]) - (4 E^(-1 - 2 k) (-1 + k))/(k^3 Sqrt[[Pi]]) + (
2 E^(-1 - 2 k))/(k^2 Sqrt[[Pi]]) - (4 E^(-1 - 2 k) (-1 + k))/(
k^2 Sqrt[[Pi]]) + Erf[Sqrt[1 + 2 k]]/(k^3 Sqrt[1 + 2 k]) - (
3 Sqrt[1 + 2 k] Erf[Sqrt[1 + 2 k]])/k^4 + (
E^(-2 k) (-3 (-1 + k) - 3 k) Erfc[1])/k^3 - (
3 E^(-2 k) (1 - 3 (-1 + k) k) Erfc[1])/k^4 - (
2 E^(-2 k) (1 - 3 (-1 + k) k) Erfc[1])/k^3 - (
2 Inactive[NIntegrate][
E^(-2 k s) (E^(-1 + s)/(Sqrt[[Pi]] Sqrt[1 - s]) + Erf[Sqrt[1 - s]]) ((
2 E^-s Sqrt[s])/Sqrt[[Pi]] - (1 + 2 s) Erfc[Sqrt[s]]), {s, 0,
1}])/k^2 + (
2 Inactive[NIntegrate][-2 E^(-2 k s)
s (E^(-1 + s)/(Sqrt[[Pi]] Sqrt[1 - s]) + Erf[Sqrt[1 - s]]) ((
2 E^-s Sqrt[s])/Sqrt[[Pi]] - (1 + 2 s) Erfc[Sqrt[s]]), {s, 0, 1}])/k
On the other hand, evaluating the above expression for a numerical value of k only entails a couple numerical integrations. That is, there is no numerical derivative of a function that also includes a numerical integration. So:
Activate[dm11 /. k->1] //AbsoluteTiming
{0.028246, -0.190263}
We get the same result, but it is about 25 times faster. Similarly, we can differentiate r11[t,k] now since the numerical integration is inactive, and define a function to activate the integration after setting the values of the arguments to numerical values:
With[{a1=t_, a2=k_?NumericQ, rhs = D[r11[t,k], k]},
dr11[a1, a2] := Activate[rhs]
]
The With statement is needed to inject the derivative into the downvalue, but the somewhat obscure a1 and a2 are used to avoid having the patterns automatically modularized. That is, the version without a1 and a2 produces a downvalue like foo[t$_, k$_?NumericQ] := ... instead of foo[t_, k_?NumericQ] := ....
Now, we are ready to use your FindRoot:
FindRoot[foo[1, k], {k, 1}] //AbsoluteTiming
{0.744606, {k -> 1.15773}}
Quite a bit faster than the version using a pattern restriction with an active NIntegrate.
NIntegrateusingNumericQ, i.e.m11[t_?NumericQ, k_?NumericQ] := (* your code *). That will also get rid of the otherwise inevitable warnings. See also User-defined functions, numerical approximation, and NumericQ – MarcoB Jun 04 '18 at 01:33