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 ?


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.

  • 1
    $\begingroup$ 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. $\endgroup$ – Sektor Aug 31 '15 at 7:44
  • 1
    $\begingroup$ Might you have forgotten to include the error by any chance ? $\endgroup$ – image_doctor Aug 31 '15 at 8:10
  • $\begingroup$ Well it doesn't really give what the error is, it just gives this Wolfram Kernel for Windows has stopped working $\endgroup$ – Djole Aug 31 '15 at 8:13
  • 1
    $\begingroup$ And the usual warning that functions with capital letters, such as, F, are generally a bad idea as they are often used by mathematica. $\endgroup$ – image_doctor Aug 31 '15 at 12:10
  • 5
    $\begingroup$ The definitions are circular. F depends on theta which depends on F $\endgroup$ – Bob Hanlon Aug 31 '15 at 13:22

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}]                         


 (* 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.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.