# Define a function including two solve solutions

I'm trying to combine the solutions coming from two NSolves and define a new function that I've to integrate.

Basically I've defined two NSolve solutions with the names eqpart and usol. I've assigned their solutions to three functions, xtot[Tx], ne[y] and T[y].

eq = ξ^-1*D[ξ*D[u[ξ], ξ], ξ] + u[ξ]^(3/7);

usol = NDSolve[{eq == 0, u[ξmax] == 1*^-10, u'[ξmin] == 0}, u, {ξ, ξmin, ξmax}];

ne[ξ_] := (ne0/(2*m0*a0^(2/7)))*(a0/(u[ξ] /. usol))^(2/7);

T[ξ_] := At*(u[ξ] /. usol)^(2/7);

eqpart[Tx_?NumericQ] := NSolve[
{xs == 2*ys^2/RxB[Tx] + ys,
16*ys^4/(RxA[Tx]*RxB[Tx]) + 2*ys^2 + RxB[Tx]*ys - RxB[Tx] == 0,
0 <= xs <= 1, 0 <= ys <= 1, 0 <= xs - ys <= 1},
{xs, ys}
];

npe[Tx_] := 2*ngas*(ys /. eqpart[Tx]);

xtot[Tx_] := npe[Tx]/(2*ngas);


The problem is when I try to do this

neff[ξ_] := ne[ξ]*xtot[T[ξ]];

neff0 = NIntegrate[neff[ξ]*Lc*2*Pi*Rc^2*ξ, {ξ, ξmin, ξmax}]/(Pi*Rc^2*Lc);


As an output I have several errors saying that

eqpart... is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing

What I'm doing wrong?

• Please show your complete code. – Ulrich Neumann Oct 18 '19 at 9:21
• I've modified the question showing the code. Thanks in advance – Riccardo Oct 18 '19 at 12:20