I have the following issue. I am trying to solve a 3-vector equation for the vector slx
, sly
, and slz
as below. The vector of sl
enters in a very complex manner so I was hoping to use NSolve
. There is a term involving a single cross-product and another involving a double cross-product. The double cross-product term is giving me problems - e.g. I have not been able to wait long enough for a solution to pop out. The single cross-product seems to pose no problem whatsoever. I suppose the double cross-product term possesses higher orders of sl
that are the issue.
Is there anyway the code below can be vastly sped up?
Off[NSolve::ratnz] (*Turn off annoying warning when using \
NSolve...can probably be addressed by using Rationalize[]*)
sl = {slx, sly, slz};
(* electron charge *) e = 1.602176565`*^-19;
(* electron mass *) me = 9.10938291`*^-31;
\[Gamma] = -0.44 e/(2 me) 10^-9/10^4 ;
bn = -5000. ;
be = -2. ;
BL = 20. ;
\[Tau]0 = 2.; \[Tau]n = 6.; k0 = 5.; kn = 10.;
G = 0.08;
sol[B_List] := NSolve[{
{0, 0, 0} == -(k0/(k0 + kn) *1/\[Tau]n + k0/(k0 + kn) *1/\[Tau]0) sl + \[Gamma] Cross[B + bn (((B + be sl).sl) (B + be sl))/((B + be sl).(B + be sl) +
BL^2), sl] - \[Gamma]^2 1/(k0 + kn) Cross[bn (((B + be sl).sl) (B + be sl))/((B + be sl).(B + be sl) + BL^2), Cross[sl,
bn (((B + be sl).sl) (B + be sl))/((B + be sl).(B + be sl) +
BL^2)]] + G {1, 0, 0}}, sl, Reals] // Flatten
sol[{100. Sin[0 Degree], 0, 100. Cos[0 Degree]}]
has not outputted in the time I have entered this cell.
However it returns quickly when the double cross product term is negated:
{slx -> 0.0854324, sly -> -0.153157, slz -> 0}