Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55586] Mathematica hangs when solving sys. of equations w/ certain parameters
  • From: Sean <seanchu at stanford.edu>
  • Date: Wed, 30 Mar 2005 03:21:45 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

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}]


  • Prev by Date: nintegrate vs nintegrateinterpolatingfunction vs integrate
  • Next by Date: Re: symbolic quaternionic analysis
  • Previous by thread: Re: nintegrate vs nintegrateinterpolatingfunction vs integrate
  • Next by thread: Re: Mathematica hangs when solving sys. of equations w/ certain parameters