Re: FindRoot and Inequalities
- To: mathgroup at smc.vnet.net
- Subject: [mg37730] Re: [mg37710] FindRoot and Inequalities
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sun, 10 Nov 2002 05:38:30 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
You may be able to, but it will require some though and a trial an error, for there is no built in option or anything like that to do this. But the basic idea is simple. L t me illustrate it on a toy problem. Suppose I want to find the solutions of Sin[x]==3/4 lying somewhere between 2Pi and 3Pi. Of course the obvious way would be to use FindRoot with a starting value 2Pi, but I want to start at 0. I simply define a suitable function as follows: In[1]:= g[x_] := (Sin[x] - 3/4)^2 + If[2*Pi < x < 3*Pi, 0, 1] and then use FindRoot in the usual way: In[2]:= FindRoot[Evaluate[g[x] == 0], {x, 0}, WorkingPrecision -> 50, MaxIterations -> 100] Out[2]= {x -> 7.1312473861610674849663965707576817827292718868836790\ 013303355880347`50} There are of course lots of different variants of this approach and some will work better than others. In some cases it may be better to use only smooth functions (created by means of Interpolation) but usually it"s not needed. Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp/~andrzej/ On Saturday, November 9, 2002, at 02:29 PM, George Thiel wrote: > Hi All > I'm trying to solve a system of nonlinear algebraic equations. > I was hoping to use the FindRoot. However, some > of the variables for which I'm solving must satisfy some > inequalities. Is there an easy way to impose these constraints > in the solution? > > Thanks in advance > George > (KthielK at us.ibm.com) > (remove the Ks to reply via email) > > > > >