Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Undocumented feature of solve?

Subject: Undocumented feature of solve?

From: Joerg Buchholz

Date: 30 May, 2012 16:52:09

Message: 1 of 6

As of R2012a, we can directly solve a vector of equations:

>> syms x y
>> g = [x^2 + 2*y == 3; 4*x + 5*y == 6]
 
g =
 
 x^2 + 2*y == 3
 4*x + 5*y == 6
 
>> solve (g)

ans =

    x: [2x1 sym]
    y: [2x1 sym]

Could a Mathworker please tell us if we can rely on that undocumented(?) feature?

Jörg

Subject: Undocumented feature of solve?

From: Yair Altman

Date: 29 Jul, 2012 12:11:13

Message: 2 of 6

"Joerg Buchholz" <buchholz@hs-bremen.de> wrote in message <jq5j7p$249$1@newscl01ah.mathworks.com>...
> As of R2012a, we can directly solve a vector of equations:
>
> >> syms x y
> >> g = [x^2 + 2*y == 3; 4*x + 5*y == 6]
>
> g =
>
> x^2 + 2*y == 3
> 4*x + 5*y == 6
>
> >> solve (g)
>
> ans =
>
> x: [2x1 sym]
> y: [2x1 sym]
>
> Could a Mathworker please tell us if we can rely on that undocumented(?) feature?
>
> Jörg


I believe that this is in fact a documented function of the symbolic Toolbox:
http://www.mathworks.co.uk/help/toolbox/symbolic/solve.html

Alas - it could have been a nice easy post for my blog...
I guess I'll need to continue researching longer articles... :-)

Yair Altman
http://UndocumentedMatlab.com
 

Subject: Undocumented feature of solve?

From: Joerg Buchholz

Date: 29 Jul, 2012 12:47:13

Message: 3 of 6

> I believe that this is in fact a documented function of the symbolic Toolbox:
> http://www.mathworks.co.uk/help/toolbox/symbolic/solve.html

Yair,

could you please tell me where in the documentation you found that we can use a v_e_c_t_o_r of equations?

Jörg

Subject: Undocumented feature of solve?

From: Greg Heath

Date: 29 Jul, 2012 14:54:13

Message: 4 of 6

"Joerg Buchholz" <buchholz@hs-bremen.de> wrote in message <jq5j7p$249$1@newscl01ah.mathworks.com>...
> As of R2012a, we can directly solve a vector of equations:
>
> >> syms x y
> >> g = [x^2 + 2*y == 3; 4*x + 5*y == 6]
>
> g =
>
> x^2 + 2*y == 3
> 4*x + 5*y == 6
>
> >> solve (g)
>
> ans =
>
> x: [2x1 sym]
> y: [2x1 sym]
>
> Could a Mathworker please tell us if we can rely on that undocumented(?) feature?

"Joerg Buchholz" <buchholz@hs-bremen.de> wrote in message
<jq5j7p$249$1@newscl01ah.mathworks.com>...
> As of R2012a, we can directly solve a vector of equations:
>
> >> syms x y
> >> g = [x^2 + 2*y == 3; 4*x + 5*y == 6]
> >> solve (g)

I have 2011b. Cutting and pasting yields

>>close all, clear all, clc

>>syms x y
>>g = [x^2 + 2*y == 3; 4*x + 5*y == 6]

g =

     0
     0
solve (g)

Error using char
Conversion to char from logical is not possible.

Error in solve>getEqns (line 245)
  vc = char(v);

Error in solve (line 141)
[eqns,vars,options] = getEqns(varargin{:});

Any of these work

solve( 'x^2 + 2*y = 3' , '4*x + 5*y = 6' )
solve( 'x^2 + 2*y = 3' , '4*x + 5*y = 6' )
solve( 'x^2 + 2*y = 3' , '4*x + 5*y = 6' , 'x' , 'y')
solve( 'x^2 + 2*y = 3' , '4*x + 5*y = 6', 'x , y' )

Same as above with " = 'replaced by ' - '

>>syms x y
>>solve( 'x^2 + 2*y - 3' , '4*x + 5*y - 6' )

ans =

    x: [2x1 sym]
    y: [2x1 sym]
    
>>ans.x
  
ans =
 
 31^(1/2)/5 + 4/5
 4/5 - 31^(1/2)/5
 
 >> ans,x, ans.y
 
 Error using sym/subsref
Too many output arguments.

Definitely confusing.

Greg
 

Subject: Undocumented feature of solve?

From: Joerg Buchholz

Date: 29 Jul, 2012 18:18:18

Message: 5 of 6

Greg,

the new synthax was introduced in R2012a.

Jörg

Subject: Undocumented feature of solve?

From: Steven_Lord

Date: 31 Jul, 2012 15:03:44

Message: 6 of 6



"Joerg Buchholz" <buchholz@hs-bremen.de> wrote in message
news:jv3bch$pr$1@newscl01ah.mathworks.com...
>> I believe that this is in fact a documented function of the symbolic
>> Toolbox:
>> http://www.mathworks.co.uk/help/toolbox/symbolic/solve.html
>
> Yair,
> could you please tell me where in the documentation you found that we can
> use a v_e_c_t_o_r of equations?

I don't know if that is documented. You could ask Kai by posting a comment
on the guest blog post he wrote for Loren's blog; it mainly deals with
DSOLVE and symbolic equations, but it seems reasonable to ask about SOLVE in
that same discussion.

http://blogs.mathworks.com/loren/2012/07/27/using-symbolic-equations-and-symbolic-functions-in-matlab/

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us