f

#### Mathematica hangs when solving sys. of equations w/ certain parameters

```I am trying to find local maxima of an objective function by solving the FOCs of a function of 4 control variables (pL,pH,phiL,phiH) and 3 parameters (c, pDBS,phiDBS).

The objective function is

f[pL_,phiL_,pH_,phiH_,pDBS_,phiDBS_,c_] = \
(pL-0.5c*phiL^2)*((pH-pL)/(phiH-phiL) - pL/phiL) + \
(pH-0.5c*phiH^2)*((pDBS-pH)/(phiDBS-phiH) - (pH-pL)/(phiH-phiL))

I find the FOCs by differentiating with respect to each of the 4 control variables, and then I solve the system using Solve[] (see details below)

For certain values of the parameters (c, pDBS, phiDBS), the Solve[] routine works fine. But I can't figure out why Solve[] just seems to hang for other parameter values. I have verified that it's not because I'm dividing by zero or anything, and the points that are causing problems seem to be totally generic.

For example, everything works fine when (c=0.1, pDBS=5, phiDBS=8) and when (c=0.1, pDBS=7, phiDBS=8), but not when (c=0.1, pDBS=6, phiDBS=8). I happen to know that at these latter parameter values, one of the solutions to the system is (pL=11.25, pH=0, phiL=15, phiH=0), and when I manually plug this solution into the FOCs, everything evaluates to zero as expected. I have also verified that I am not dividing anything by zero at this solution.

I was wondering whether anybody else has ever experienced problems with Solve[] working for some parameter values but not for others, when there should be no obvious reason why it wouldn't work.

Thanks for your help! I'm new to this forum, and did a search to make sure that this question hasn't been asked previously, but didn't see anything of this nature.

---------------------------------------------
Details
---------------------------------------------
focpL[pL_,phiL_,pH_,phiH_,pDBS_,phiDBS_,c_] = D[f[pL,phiL,pH,phiH,pDBS,phiDBS,c],pL]
focphiL[pL_,phiL_,pH_,phiH_,pDBS_,phiDBS_,c_] = D[f[pL,phiL,pH,phiH,pDBS,phiDBS,c],phiL]
focpH[pL_,phiL_,pH_,phiH_,pDBS_,phiDBS_,c_] = D[f[pL,phiL,pH,phiH,pDBS,phiDBS,c],pH]
focphiH[pL_,phiL_,pH_,phiH_,pDBS_,phiDBS_,c_] = D[f[pL,phiL,pH,phiH,pDBS,phiDBS,c],phiH]

pDBS:= 6.0
phiDBS:= 8
c:=0.1

solution = \ Solve[{focpL[pL,phiL,pH,phiH,pDBS,phiDBS,c]==0, \
focphiL[pL,phiL,pH,phiH,pDBS,phiDBS,c]==0, \
focpH[pL,phiL,pH,phiH,pDBS,phiDBS,c]==0, \
focphiH[pL,phiL,pH,phiH,pDBS,phiDBS,c]==0},{pL,phiL,pH,phiH}]

```
 0
seanchu1 (1)
3/30/2005 8:50:54 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers.

1 Replies
732 Views

Similar Articles

[PageSpeed] 14

```Sean <seanchu@stanford.edu> writes:

[snip]

> For certain values of the parameters (c, pDBS, phiDBS), the Solve[] routine works fine. But I can't figure out why Solve[] just seems to hang for other parameter values. I have verified that it's not because I'm dividing by zero or anything, and the points that are causing problems seem to be totally generic.

[snip]

Mathematica hangs?  What version?  What operating system?

Scott
--
Scott Hemphill	hemphill@alumni.caltech.edu
"This isn't flying.  This is falling, with style."  -- Buzz Lightyear

```
 0
hemphill (223)
3/31/2005 6:40:59 AM