NSolve using crushes mathematica 7

*To*: mathgroup at smc.vnet.net*Subject*: [mg112522] NSolve using crushes mathematica 7*From*: Piotr Melenev <aq.velo at gmail.com>*Date*: Sat, 18 Sep 2010 07:26:36 -0400 (EDT)

Hello, I use NSolve function to find the roots of the trigonometric equation inside following function: getroots[ p_ , q_ , h_ ] := Module[ {res}, res = NSolve[ Sin[2*t] - 2*h*(Cos[p]*Cos[t]*Sin[q] - Sin[t]*Cos[q]) == 0, t]; t /. res ] When I evaluate this function separately - it works properly. But if I embed it into another Mathematica function, like NIntegrate, Plot etc (which automatically choses values of the variables) relative to p variable, Mathematica kernel is crushed with APPCRUSH winerror. At the same time I can calculate appropriate table of values and use it in ListPlot or in "hand-made" numerical integration function. But it is tiresomely and besides that I want to understand what is the cause of the error... Thank everybody in advance!