# Problem in importing function in NDSolveValue

I have a code for solving a system of 2 differential equations (sol1). Given that what's inside is a bit heavy, I define functions so that I can call them. My issue is that when I write everything explicitely it works,and when I call functions inside NDSolveValue, it doesn't work anymore. Could you help please ? (I call Numerical Calculus because I thought that in NDsolveValue it can play a role...)

 Needs["NumericalCalculus"]
potentiel[x_?NumericQ, y_?NumericQ] = -(x*y)^2 + 8*(x*y)^4 - x^2 +
3/4*x^4 - y^2 + 3/4*y^4
Mux[x_?NumericQ, y_?NumericQ] = D[potentiel[x, y], x]
Muy[x_?NumericQ, y_?NumericQ] = D[potentiel[x, y], y]
Pre[x_?NumericQ, y_?NumericQ] = potentiel[x, y] - x*Mux[x, y] - y*Muy[x, y]
Comprxx[x_?NumericQ, y_?NumericQ] = D[potentiel[x, y], x, x]
Comprxy[x_?NumericQ, y_?NumericQ] = D[potentiel[x, y], x, y]
Compryy[x_?NumericQ, y_?NumericQ] = D[potentiel[x, y], y, y]

alpha = 1
l = 0.5
a = 3/4
phis = 0.5848600924535045/2

R1 = 1.22

sol1 = NDSolveValue[{-((1 -
f[x])*((-2 + 9 f[x]^2 - 2 f2[x]^2 + 96 f[x]^2* f2[x]^4)*
Laplacian[f[x], {x, y, z},
"Spherical"] + (-4 f[x]*f2[x] + 128 f[x]^3 *f2[x]^3)*
Laplacian[f2[x], {x, y, z}, "Spherical"]) +
f2[x]*((-2 + 9 f2[x]^2 - 2 f[x]^2 + 96 f2[x]^2* f[x]^4)*
Laplacian[f2[x], {x, y, z},
"Spherical"] + (-4 f[x]*f2[x] + 128 f[x]^3 *f2[x]^3)*
Laplacian[f[x], {x, y, z}, "Spherical"])) == (1 - f[x] -
f2[x])*(Min[Max[1 + (R1 - l)/l*(1 - R1/x), 0], 1] -
0.5), - ((1 -
f2[x])*((-2 + 9 f2[x]^2 - 2 f[x]^2 + 96 f[x]^2 *f2[x]^4)*
Laplacian[f2[x], {x, y, z},
"Spherical"] + (-4 f[x]*f2[x] + 128 f[x]^3 *f2[x]^3)*
Laplacian[f[x], {x, y, z}, "Spherical"]) +
f[x]*((-2 + 9 f[x]^2 - 2 f2[x]^2 + 96 f2[x]^2* f[x]^4)*
Laplacian[f[x], {x, y, z},
"Spherical"] + (-4 f[x]*f2[x] + 128 f[x]^3* f2[x]^3)*
Laplacian[f2[x], {x, y, z}, "Spherical"])) == 0,
f2[R1] == phis, f[R1] == phis, f'[0.00001] == 0.000001,
f2'[0.000001] == 0.000001}, {f, f2}, {x, 0.0001, R1}]

sol1 = NDSolveValue[{-(1 - f[x])*(Comprxx[f[x], f2[x]]*
Laplacian[f[x], {x, y, z}, "Spherical"] +
Comprxy[f[x], f2[x]]*
Laplacian[f2[x], {x, y, z}, "Spherical"]) +
f2[x]*(Compryy[f[x] f2[x]]*
Laplacian[f2[x], {x, y, z}, "Spherical"] +
Comprxy[f[x], f2[x]]*
Laplacian[f[x], {x, y, z}, "Spherical"]) == (1 - f[x] -
f2[x])*(Min[Max[1 + (R1 - l)/l*(1 - R1/x), 0], 1] -
0.5), - (1 - f2[x])*(Compryy[f[x] f2[x]]*
Laplacian[f2[x], {x, y, z}, "Spherical"] +
Comprxy[f[x], f2[x]]*
Laplacian[f[x], {x, y, z}, "Spherical"]) +
f[x]*(Comprxx[f[x], f2[x]]*
Laplacian[f[x], {x, y, z}, "Spherical"] +
Comprxy[f[x], f2[x]]*
Laplacian[f2[x], {x, y, z}, "Spherical"]) == 0,
f2[R1] == phis, f[R1] == phis, f'[0.00001] == 0.000001,
f2'[0.000001] == 0.000001}, {f, f2}, {x, 0.0001, R1}]

• Just replace the _?NumericQ pattern by the general _ pattern in potentiel etc. Otherwise, NDSolveValue cannot see the symbolic expressions which might be the reason that it has a hard time. – Henrik Schumacher Jun 14 '18 at 17:24
• What do you mean it doesn't work? Do you get an error message that tells us what's wrong? (I suppose Compryy[f[x] f2[x]]` is a typo.) – Michael E2 Jun 14 '18 at 18:00