Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!kasuga.switch.ch!news-zh.switch.ch!switch.ch!nrc-news.nrc.ca!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Limits of Symbolic Toolbox
Date: Thu, 30 Sep 2010 16:32:32 -0500
Organization: Canada Eat The Cookie Foundation
Lines: 58
Message-ID: <i82vqs$pp0$1@canopus.cc.umanitoba.ca>
References: <i82j03$rhj$1@fred.mathworks.com> <i82obr$eik$1@canopus.cc.umanitoba.ca> <i82pvc$73k$1@fred.mathworks.com> <i82tgk$mai$1@canopus.cc.umanitoba.ca> <i82urj$p99$1@fred.mathworks.com>
NNTP-Posting-Host: ibd-nat.ibd.nrc.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: canopus.cc.umanitoba.ca 1285882525 26400 132.246.133.10 (30 Sep 2010 21:35:25 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Thu, 30 Sep 2010 21:35:25 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8
In-Reply-To: <i82urj$p99$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:674776

On 10-09-30 04:18 PM, Steven_Lord wrote:

> "Walter Roberson" <roberson@hushmail.com> wrote in message

>> No. You are telling it which arbitrary variable names to assign the
>> solutions to. The order that will actually be solved if you do not
>> specify which variables to solve for in the solve() call, is
>> _approximately_ X then Y then Z then all the other variables in
>> lexographic order (I'd have to find the reference again for the exact
>> order.)
>
> http://www.mathworks.com/help/toolbox/symbolic/solve.html
>
> "Three different types of output are possible. For one equation and one
> output, the resulting solution is returned with multiple solutions for a
> nonlinear equation. For a system of equations and an equal number of
> outputs, the results are sorted alphabetically and assigned to the
> outputs. For a system of equations and a single output, a structure
> containing the solutions is returned."

Yes, however on that same page it says,

solve(eq1, eq2, ..., eqn) or solves the system of equations implied by 
eq1,eq2,...,eqn in the n variables determined by applying symvar to the system.

When we then look at the symvar documentation,
http://www.mathworks.com/help/toolbox/symbolic/symvar.html

symvar(s,n) returns a vector containing the n symbolic variables in s that are 
alphabetically closest to 'x':

    1. The variables are sorted by the first letter in their names. The 
ordering is x y w z v u ... a X Y W Z V U ... A. The name of a symbolic 
variable cannot begin with a number.
    2. For all subsequent letters, the ordering is alphabetical, with all 
uppercase letters having precedence over lowercase: 0 1 ... 9 A B ... Z a b ...z.


Thus, the n variables determined by applying symvar are not necessarily going 
to be in standard alphanumeric order; once those variables are chosen, the 
multiple-output clause you quoted will take effect causing those variables to 
be sorted alphabetically for the purposes of the assignment to the output 
arguments.

If I interpret the symvar documentation correctly, then with this input system 
and with 6 outputs, it would choose the 6 X variables as the variables to 
solve for.


 > This is why I recommend that if you call SOLVE, you call it with one output
 > as in example 4 on that page.

That example shows the structure output format. On the other hand, that 
example also happens to want to solve for all of the input symbolic variables 
simultaneously. In the case of this input system, it would at the very least 
result in a waste of time, and would quite possibly result in a useless set of 
answers. I thus recommend structure output together with explicit 
specification of the variables to solve for.