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.
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 07:44SetandSetDelayed, a good start is this very same Mathematica.SE site. Also function definition and passing non-numerical values toNIntegrate. All in all I think that should suffice. – Sektor Aug 31 '15 at 08:41F, are generally a bad idea as they are often used by mathematica. – image_doctor Aug 31 '15 at 12:10FindRootcausing the problem. The evaluation of eithertheta,Foromegais enough to crash the kernel on my v10.1 – glS Aug 31 '15 at 12:15Fdepends onthetawhich depends onF– Bob Hanlon Aug 31 '15 at 13:22FindRoot? I mean, if you try to evaluate e.g.m[s, 0.00143, 0.001]as shown in your code, do you get any result? – MarcoB Aug 31 '15 at 15:35sas a parameterNIntegratecan't work. – Djole Aug 31 '15 at 17:50Set(i.e. the=symbol) in function definitions instead ofSetDelayed(i.e.:=)? $$$$ (B) This is probably not the source of your problem, but sometimes it is better to define functions withm[s_?NumericQ...]as discussed here – yohbs Aug 31 '15 at 20:18