Solve yields unreal solutions, NSolve yields real solutions
- To: mathgroup at smc.vnet.net
- Subject: [mg58278] Solve yields unreal solutions, NSolve yields real solutions
- From: "Mukhtar Bekkali" <mbekkali at gmail.com>
- Date: Sat, 25 Jun 2005 01:56:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I thought NSolve is the same as Solve just numeric. The below code
gives real answers, replacing NSolve with Solve in the last line
generates Unreal results. I do not understand why.
\!\(\*
RowBox[{\(Clear["\<Global`*\>"]\), "\n", \(Remove["\<Global`*\>"]\),
"\[IndentingNewLine]", \(Needs["\<Miscellaneous`RealOnly`\>"]\),
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
StyleBox["{",
FontColor->RGBColor[1, 0, 1]],
StyleBox[\(\[Lambda], \[Gamma], k\),
FontColor->RGBColor[1, 0, 1]],
StyleBox["}",
FontColor->RGBColor[1, 0, 0]]}],
StyleBox["=",
FontColor->RGBColor[1, 0, 0]],
RowBox[{
StyleBox["{",
FontColor->RGBColor[1, 0, 0]],
RowBox[{"1",
StyleBox[",",
FontColor->RGBColor[1, 0, 0]], \(2\/3\), ",", "0"}],
"}"}]}],
";"}], "\[IndentingNewLine]", \(Table[h\_i = \[Gamma], {i, 1,
k}];\),
"\[IndentingNewLine]", \(Table[h\_i = 1 - \[Gamma], {i, k + 1,
2}];\),
"\[IndentingNewLine]", \(Table[{p\_i, b\_i} = {p\_i, b\_i}, {i, 1,
2}];\),
"\[IndentingNewLine]", \(T\_p = Table[p\_i, {i, 1, 2}];\),
"\[IndentingNewLine]", \(T\_b = Table[b\_i, {i, 1, 2}];\),
"\[IndentingNewLine]", \(T\_u =
Table[u\_i = 1 - \[Lambda] \((b\_i - \[Beta])\)\^2 - p\_i, {i,
1,
2}];\), "\[IndentingNewLine]", \({I\_0, I\_1,
I\_2} = {0, \[Beta] /. \(Solve[
u\_1 \[Equal] u\_2, \[Beta]]\)[\([1]\)], 1};\),
"\[IndentingNewLine]", \(T\_m =
Table[m\_i = I\_i - I\_\(i - 1\), {i, 1, 2}];\),
"\[IndentingNewLine]", \(T\_R =
Table[R\_i = \(p\_i\)
m\_i - \((\(h\_i\)
b\_i\^2\/2 + \((1 - h\_i)\) \((1 -
b\_i)\)\^2\/2)\), {i,
1, 2}];\),
"\[IndentingNewLine]", \(FOCP = Table[D[R\_i, p\_i], {i, 1, 2}];\),
"\[IndentingNewLine]", \(T\_p =
T\_p /. \(Solve[FOCP \[Equal] 0, T\_p]\)[\([1]\)];\),
"\[IndentingNewLine]", \(Table[p\_i = T\_p[\([i]\)], {i, 1, 2}];\),
"\[IndentingNewLine]", \(FOCB = Table[D[R\_i, b\_i], {i, 1, 2}];\),
"\[IndentingNewLine]", \(NSolve[FOCB \[Equal] 0, T\_b]\)}]\)