MathGroup Archive 2005

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

Search the Archive

Re: Anomaly or expected behaviour?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61754] Re: [mg61719] Anomaly or expected behaviour?
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Fri, 28 Oct 2005 03:25:35 -0400 (EDT)
  • References: <200510270901.FAA19424@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I dunno. It does the same thing on 5.2 for Windows.
Here is a workaround using (the lazy) MapAll:

Cell[BoxData[
    RowBox[{"solns", " ", "=",
      RowBox[{"MapAll", "[",
        RowBox[{"Factor", ",", " ",
          RowBox[{"Solve", "[",
            RowBox[{
              RowBox[{"{",
                RowBox[{
                  RowBox[{
                    RowBox[{
                      SubscriptBox["\[Lambda]", "1"], " ", "+", " ",
                      SubscriptBox["\[Lambda]", "2"]}], " ",
                    "\[Equal]", " ", "T"}], ",", " ",
                  RowBox[{
                    RowBox[{
                      SubscriptBox["\[Lambda]", "1"], " ",
                      SubscriptBox["\[Lambda]", "2"]}], " ",
                    "\[Equal]", " ", "D"}]}], "}"}], ",", " ",
              RowBox[{"{",
                RowBox[{
                  SubscriptBox["\[Lambda]", "1"], ",",
                  SubscriptBox["\[Lambda]", "2"]}], "}"}]}], "]"}]}],
        "]"}]}]], "Input",
  CellLabel->"In[6]:="]

You may already be aware, but lambda subscript 1 is in a form with
which Solve can have trouble. If you were solving for x in an equation
with lambda subscript x, Solve would try to traverse the Subscript
function:

Cell[BoxData[
    RowBox[{"Solve", "[",
      RowBox[{
        RowBox[{
          SubscriptBox["\[Lambda]", "x"], "\[Equal]",
          SuperscriptBox["x", "2"]}], ",", "x"}], "]"}]], "Input"]

To see why, look at the FullForm of the equation.

Anyway, there is a way around this problem: use the Notation package :-]

Good luck,


On 10/27/05, Matt <anonmous69 at netscape.net> wrote:
> Hello,
>   In the course of some simple calculations involving the trace and the
> determinant of a matrix, I had cause to practice with Mathematica solving the
> following:
>
> l1 + l2 = T;
> l1 l2 = D;
>
> for l1 and l2.
>
> The answers that Mathematica gave back to me are correct as demonstrated by the
> following:
>
> Cell[CellGroupData[{Cell[BoxData[
>     RowBox[{"solns", " ", "=", " ",
>       RowBox[{"Solve", "[",
>         RowBox[{
>           RowBox[{"{",
>             RowBox[{
>               RowBox[{
>                 RowBox[{
>                   SubscriptBox["\[Lambda]", "1"], " ", "+", " ",
>                   SubscriptBox["\[Lambda]", "2"]}], " ", "\[Equal]",
>                 " ", "T"}], ",", " ",
>               RowBox[{
>                 RowBox[{
>                   SubscriptBox["\[Lambda]", "1"], " ",
>                   SubscriptBox["\[Lambda]", "2"]}], " ", "\[Equal]",
>                 " ", "D"}]}], "}"}], ",", " ",
>           RowBox[{"{",
>             RowBox[{
>               SubscriptBox["\[Lambda]", "1"], ",",
>               SubscriptBox["\[Lambda]", "2"]}], "}"}]}],
>         "]"}]}]], "Input",
>   CellLabel->"In[151]:="],
>
> Cell[BoxData[
>     RowBox[{"{",
>       RowBox[{
>         RowBox[{"{",
>           RowBox[{
>             RowBox[{
>               SubscriptBox["\[Lambda]", "1"], "\[Rule]",
>               RowBox[{
>                 FractionBox["1", "2"], " ",
>                 RowBox[{"(",
>                   RowBox[{"T", "-",
>                     SqrtBox[
>                       RowBox[{
>                         RowBox[{
>                           RowBox[{"-", "4"}], " ", "D"}], "+",
>                         SuperscriptBox["T", "2"]}]]}], ")"}]}]}], ",",
>
>             RowBox[{
>               SubscriptBox["\[Lambda]", "2"], "\[Rule]",
>               RowBox[{
>                 FractionBox["1", "2"], " ",
>                 RowBox[{"(",
>                   RowBox[{"T", "+",
>                     SqrtBox[
>                       RowBox[{
>                         RowBox[{
>                           RowBox[{"-", "4"}], " ", "D"}], "+",
>                         SuperscriptBox["T", "2"]}]]}], ")"}]}]}]}],
>           "}"}], ",",
>         RowBox[{"{",
>           RowBox[{
>             RowBox[{
>               SubscriptBox["\[Lambda]", "1"], "\[Rule]",
>               RowBox[{
>                 FractionBox["T", "2"], "+",
>                 RowBox[{
>                   FractionBox["1", "2"], " ",
>                   SqrtBox[
>                     RowBox[{
>                       RowBox[{
>                         RowBox[{"-", "4"}], " ", "D"}], "+",
>                       SuperscriptBox["T", "2"]}]]}]}]}], ",",
>             RowBox[{
>               SubscriptBox["\[Lambda]", "2"], "\[Rule]",
>               RowBox[{
>                 FractionBox["1", "2"], " ",
>                 RowBox[{"(",
>                   RowBox[{"T", "-",
>                     SqrtBox[
>                       RowBox[{
>                         RowBox[{
>                           RowBox[{"-", "4"}], " ", "D"}], "+",
>                         SuperscriptBox["T", "2"]}]]}], ")"}]}]}]}],
>           "}"}]}], "}"}]], "Output",
>   CellLabel->"Out[151]="]
> }, Open  ]]
>
> However, you'll notice that the display of solns[[1,1]], solns[[1,2]]
> and solns[[2,2]] are all similar in their formatting and display, but
> in the case of solns[[2,1]], the quantity 1/2 has been distributed into
> the parentheses.  Why is that?
>
> $Version
> "5.1 for Microsoft Windows (October 25, 2004)"
>
> Thanks,
>
> Matt
>
>


--
http://chrischiasson.com/contact/chris_chiasson


  • Prev by Date: Re: Re: Integrate vs Nintegrate for impulsive functions
  • Next by Date: ParallelIO (mathlink windows program) Help Please
  • Previous by thread: Anomaly or expected behaviour?
  • Next by thread: spectra