MathGroup Archive 1994

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

Search the Archive

Re: Simple Solve Question

  • To: mathgroup at
  • Subject: [mg362] Re: [mg350] Simple Solve Question
  • From: wmm at (Martin McClain)
  • Date: Tue, 27 Dec 94 13:36:02 EST

>Dear MathGroupers-
>    I have a very simple question.
>Why when you issue
>Solve[5 x==10, x]
>Does MMA return:
>I'm wondering why it's List[List[...]].
>I hate using Flatten to get rid of this nested List.
>Thanks in advance,

It's because in general, Solve[] produces multiple sets of multiple
replacements, like
{{x->1,y->2},{x->3,y->4}}.  When there is only a single solution for a
single unknown, the double brackets survive because to get rid of them they
would have to test for them explicitly, and I suppose this would make
Solve[] a tiny bit slower.

But I agree completely with you.  I use Mma a lot for simple problems, and
automatic removal of the outer bracket (when there is only one solution,
but with multiple unknowns), or removal of both brackets (when there is
single solution  for a single unknown) would be a great convenience. 
Failure to Flatten here always causes trouble down the page.  This is one
of the most frequent errors I and my undergraduate students make.

WRI, please note:  If you automate the flattening, existing programs with
explicit flattening will  still work perfectly.

  • Prev by Date: Re: Messages[] Problem/bug?
  • Next by Date: Re: Extracting DSolve[]'s solution
  • Previous by thread: Generating Lottery Numbers
  • Next by thread: Re: Simple Solve Question