Re: My problem when solving a system of equations
- To: mathgroup at smc.vnet.net
- Subject: [mg78071] Re: My problem when solving a system of equations
- From: dimitris <dimmechan at yahoo.com>
- Date: Fri, 22 Jun 2007 06:40:52 -0400 (EDT)
- References: <f5dkv7$13j$1@smc.vnet.net>
Hi. Quit the session. This is what I got. In[1]:= a = 24; b = 5; c = 25; d = 4; cA = 3; cB = 2; t = 5; alpha = 0; bta = 0.6; NB = NSolve[{-d(p - cB) + c - d*p == (p - cB)(c - d*p)^2/t}, {p}]; SNB = DeleteCases[NB, {p -> _Complex}] B = NSolve[{(alpha + (1 - alpha - bta)*(0.5 - ((d/ 2)*(p1^2 - p2^2) - c*(p1 - p2))/(2t) - ((b/2)*(( pA - disA)^2 - pA^2) + a*disA)/(2t)))*(a - b*pA - b*(pA - cA)) - (1 - alpha - bta)*((p1 - cB)*(c - d* p1) + (pA - disA - cA)*(a - b*(pA - disA)) - (pA - cA)*(a - b*pA))*(-( a - b*pA)/( 2t)) == 0, (1 - alpha - bta)*((a - b*(pA - disA) - b(pA - disA - cA))*(0.5 + ((d/2)*( p1^2 - p2^2) - c*( p1 - p2))/(2t) + ((b/2)*((pA - disA)^2 - pA^2) + a*disA)/(2t)) + (( p1 - cB)*(c - d*p1) + (pA - disA - cA)(a - b*(pA - disA)) - (pA - cA)(a - b*pA))*(-(a - b*(pA - disA))/( 2t))) == 0, (1 - alpha)*((c - d*p1 - d*(p1 - cB))*(0.5 + ((d/2)*(p1^2 - p2^2) - c*(p1 - p2))/(2t)) + (p1 - cB)*(c - d*p1)*(- c + d*p1)/(2t)) + (1 - alpha - bta)*(((pA - disA - cA)*(a - b*(pA - disA)) - (pA - cA)*(a - b* pA))*(-c + d*p1)/(2t) + (c - d*p1 - d( p1 - cB))*(( b/2)((pA - disA)^2 - pA^2) + a*disA)/(2t)) == 0, (1 - alpha)*((c - d*p2 - d(p2 - cB))*( 0.5 - ((d/ 2)*(p1^2 - p2^2) - c*(p1 - p2))/(2t)) + ( p2 - cB)*(c - d*p2)*(-c + d*p2)/( 2t)) - (1 - alpha - bta)*(c - d*p2 - d(p2 - cB))*(( b/2)*((pA - disA)^2 - pA^2) + a*disA)/( 2t) == 0}, {pA, p1, p2, disA}]; BR = DeleteCases[B, {pA -> _Complex, p1 -> _Complex, p2 -> _Complex, disA -> _Complex}]; SB = Select[BR, And @@ (({pA > 0, p1 > 0, p2 > 0, disA > 0, pA - disA > 0} /. #)) &] Out[11]= {{p\[Rule]2.29251}} >From In[1]:= \!\(\* RowBox[{\(General::"ovfl"\), \(\(:\)\(\ \)\), "\<\"Overflow occurred in computation. \\!\\(\\* ButtonBox[\\\"More...\\\", ButtonStyle->\\\"RefGuideLinkText\\\", \ ButtonFrame->None, ButtonData:>\\\"General::ovfl\\\"]\\)\"\>"}]\) >From In[1]:= \!\(\* RowBox[{\(General::"ovfl"\), \(\(:\)\(\ \)\), "\<\"Overflow occurred in computation. \\!\\(\\* ButtonBox[\\\"More...\\\", ButtonStyle->\\\"RefGuideLinkText\\\", \ ButtonFrame->None, ButtonData:>\\\"General::ovfl\\\"]\\)\"\>"}]\) >From In[1]:= \!\(\* RowBox[{\(General::"ovfl"\), \(\(:\)\(\ \)\), "\<\"Overflow occurred in computation. \\!\\(\\* ButtonBox[\\\"More...\\\", ButtonStyle->\\\"RefGuideLinkText\\\", \ ButtonFrame->None, ButtonData:>\\\"General::ovfl\\\"]\\)\"\>"}]\) >From In[1]:= \!\(\* RowBox[{\(General::"stop"\), \(\(:\)\(\ \)\), "\<\"Further output of \\!\\(General :: \\\"ovfl\\\"\\) will be suppressed during this \ calculation. \\!\\(\\*ButtonBox[\\\"More...\\\", \ ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \ ButtonData:>\\\"General::stop\\\"]\\)\"\>"}]\) Out[14]= {{pA\[Rule]3.\ 973243201739556412519288128044045997023945804915557029065972720546420058294383\ 598890842765930734752225321438217919715672292159,p1\[Rule]4.\ 958302020595319842684443749027684798737496883013818475220698244283505299552283\ 746464263057828871991290065319494660363196793637,p2\[Rule]2.\ 949204312095856784866178070015229092944379297947239512443226175303784609762982\ 212035816978006166136210705386558781550333832228,disA\[Rule]1.\ 731734509545513083657459575251578321354802750093079646091000411298081255083276\ 2752868835871074875089387169154659532655501459707},{pA\[Rule]4.\ 445374167300070939184859858213378678822259958732577495895907507151618691880549\ 660415122202305507338705522502612851605862635436,p1\[Rule]2.\ 319154466638120757503327374403506997877094995315975812555535812309131709076747\ 313776308520736763603708360710094963211884291417,p2\[Rule]2.\ 253920247454767926310848830750026635205895182591143116593491779431290407927731\ 601498154267807767823951092934390534865277197642,disA\[Rule]0.\ 996606632207799253314486632859463384535676075471633096023971809376766993819562\ 5934892093572991329922317150799668794322107434808}} Dimitris lovei... at gmail.com : > Hi, guys, > > I was trying to solve a system of nonlinear equations. However, > whenever I run it, Mathematica always returns: > " ReplaceAll::reps: {-0.04\(-24 + 5\pA)\((25 - 4\p1)\(-2 + p1) - (24 - > \ > 5\pA)\(-3 + pA) + (-3 - disA + pA)\(24 - 5\(-disA + pA))) + 0.4\(\ > \[LeftSkeleton]1\[RightSkeleton])\(\[LeftSkeleton]1\[RightSkeleton]) > == 0, \ > \[LeftSkeleton]3\[RightSkeleton]} is neither a list of replacement > rules nor \ > a valid dispatch table, and so cannot be used for replacing. " > > I don't know what this means and how to deal with it. > > Below is my code for your reference: > > a = 24; > b = 5; > c = 25; > d = 4; > cA = 3; > cB = 2; > t = 5; > alpha = 0; > bta = 0.6; > NB = NSolve[{-d(p - cB) + c - d*p == (p - cB)(c - d*p)^2/t}, {p}]; > SNB = DeleteCases[NB, {p -> _Complex}] > B = NSolve[{(alpha + (1 - alpha - bta)*(0.5 - ((d/ > 2)*(p1^2 - p2^2) - c*(p1 - p2))/(2t) - ((b/2)*(( > pA - disA)^2 - pA^2) + a*disA)/(2t)))*(a - b*pA - b*(pA - > cA)) - (1 - alpha - bta)*((p1 - cB)*(c - d* > p1) + (pA - disA - cA)*(a - b*(pA - > disA)) - (pA - cA)*(a - b*pA))*(-( > a - b*pA)/( > 2t)) == 0, (1 - alpha - bta)*((a - b*(pA - > disA) - > b(pA - disA - cA))*(0.5 + ((d/2)*( > p1^2 - p2^2) - c*( > p1 - p2))/(2t) + ((b/2)*((pA - > disA)^2 - pA^2) + a*disA)/(2t)) + > (( > p1 - cB)*(c - > d*p1) + (pA - disA - cA)(a - b*(pA - disA)) - (pA - > cA)(a - b*pA))*(-(a - b*(pA - disA))/( > 2t))) == 0, (1 - alpha)*((c - d*p1 - d*(p1 - > cB))*(0.5 + ((d/2)*(p1^2 - p2^2) - c*(p1 - > p2))/(2t)) + (p1 - cB)*(c - d*p1)*(- > c + d*p1)/(2t)) + (1 - > alpha - bta)*(((pA - disA - cA)*(a - > > b*(pA - disA)) - (pA - cA)*(a - b* > pA))*(-c + d*p1)/(2t) + (c - d*p1 - d( > p1 - cB))*(( > b/2)((pA - disA)^2 - pA^2) + a*disA)/(2t)) == > 0, (1 - alpha)*((c - d*p2 - d(p2 - cB))*( > 0.5 - ((d/ > 2)*(p1^2 - p2^2) - c*(p1 - p2))/(2t)) + ( > p2 - cB)*(c - d*p2)*(-c + d*p2)/( > 2t)) - (1 - alpha - bta)*(c - d*p2 - d(p2 - > cB))*(( > b/2)*((pA - disA)^2 - pA^2) + a*disA)/( > 2t) == 0}, {pA, p1, p2, disA}]; > BR = DeleteCases[B, {pA -> _Complex, p1 -> _Complex, > p2 -> _Complex, disA -> _Complex}]; > SB = Select[BR, And @@ (({pA > 0, p1 > 0, p2 > > 0, disA > 0, pA - disA > 0} /. #)) &]