# Kernel is crashing during evaluation of FindRoot [closed]

I have a bunch of aux functions and constants

S=1; ja=0.98; jb=1; jc=0.0004; j2=0.52; d=0.00143; T=0.001

omega [s_, d_, T_, x_, y_, z_] = Sqrt[(2 s (ja - jb + 2 j2 + jb Cos[y] +
d theta))^2 - (2 s (ja Cos[x] + jc Cos[z] +
2 j2 Cos[x] Cos[y]))^2] // Simplify

theta = 1 - s/(2 S) (1 + 2 F[s, d, T]) // Simplify

F[s_, d_, T_] :=
1/(2 π)^3 NIntegrate[(
2 s (ja - jb + 2*j2 + jb*Cos[y] + d*theta))/
omega[s, d, T, x, y, z] Coth[omega[s, d, T, x, y, z]/
T], {x, -π/2, π/2}, {y, -π, π}, {z, -π/
2, π/2}] - 1/2


That I pass to the function m

m[s_, d_, T_] = 1/((1 + F[s, d, T])^(2 S + 1) - F[s, d, T]^(
2 S + 1)) ((S - F[s, d, T]) (1 + F[s, d, T])^(
2 S + 1) + (S + 1 + F[s, d, T]) F[s, d, T]^(2 S + 1)) // Simplify


Later, when I try to use FindRoot on it like so:

FindRoot[m[s, 0.00143, 0.001] == s, {s, 1}]


I get the following error:

Wolfram Kernel for Windows has stopped working

Any suggestions ?

EDIT:

Crash stops if I define all functions with :=. It still takes a very long time to compute and I'm not even sure will it ever give any result.

## closed as off-topic by Michael E2, MarcoB, dr.blochwave, C. E., m_goldbergSep 15 '15 at 16:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, dr.blochwave, C. E., m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

• Should we guess what are the definitions behind those symbols -- omega, theta, etc ? Please, include them and format your code and question properly. Try reading it from the perspective of an unfamiliar-with-the-domain person, but still a user of Mathematica. – Sektor Aug 31 '15 at 7:44
• Might you have forgotten to include the error by any chance ? – image_doctor Aug 31 '15 at 8:10
• Well it doesn't really give what the error is, it just gives this Wolfram Kernel for Windows has stopped working – Djole Aug 31 '15 at 8:13
• And the usual warning that functions with capital letters, such as, F, are generally a bad idea as they are often used by mathematica. – image_doctor Aug 31 '15 at 12:10
• The definitions are circular. F depends on theta which depends on F – Bob Hanlon Aug 31 '15 at 13:22

## 1 Answer

As Bob Hanlon and MarcoB have already mentioned in the comments, the problem appears to be in the circular definition.

Because of the way these are defined, neither m[s, d, T] nor F[s, d, T] can be evaluated with numerical values of s, d and T, so there isn't much FindRoot could do.

A simplified example might be

 f[s_] := NIntegrate[f[s], {x, 0, 1}, {y, 0, 1}]

f

(* Segmentation fault (core dumped) *)


NIntegrate should ideally fail in a more graceful way, but I do not see the point of trying to evaluate this input.