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:
solve in R2008b strikes again :-(

Subject: solve in R2008b strikes again :-(

From: Joerg Buchholz

Date: 21 Nov, 2008 17:25:03

Message: 1 of 9

R2008b's interface between MuPAD and Matlab seems to have been sewn in a very great hurry:

>> solve ('x^2 - a')
 
ans =
 
R_ intersect {[-a^(1/2), 1], [a^(1/2), 1]}

Does anybody know a work-around to the good ol' days of (R2007b):

>> solve ('x^2 - a')
 
ans =
 
  a^(1/2)
 -a^(1/2)

Subject: solve in R2008b strikes again :-(

From: Ben Hinkle

Date: 22 Nov, 2008 15:14:02

Message: 2 of 9

> >> solve ('x^2 - a')
>
> ans =
>
> R_ intersect {[-a^(1/2), 1], [a^(1/2), 1]}

I cannot reproduce this behavior. Can you post the minimal reproduction steps that led to that answer?
thanks,
-Ben

Subject: solve in R2008b strikes again :-(

From: Joerg Buchholz

Date: 22 Nov, 2008 17:23:02

Message: 3 of 9

"Ben Hinkle" <bhinkle.nospam.pretty.please@mathworks.com> wrote in message <gg97jq$4lk$1@fred.mathworks.com>...
> > >> solve ('x^2 - a')
> >
> > ans =
> >
> > R_ intersect {[-a^(1/2), 1], [a^(1/2), 1]}
>
> I cannot reproduce this behavior. Can you post the minimal reproduction steps that led to that answer?
> thanks,
> -Ben

Minimal reproduction steps:

>> syms x real
>> solve ('x^2-a')
 
ans =
 
R_ intersect {[-a^(1/2), 1], [a^(1/2), 1]}

When I posted the original message yesterday, I had worked with Matlab for many hours before and cleared all variables via

>> clear all

before I tried to solve the equation. But as I had to find out, "clear all" does not clear properties of symbolic (MuPAD) variables, which seems to be a change of paradigm in R2008b. I find it difficult to explain this to my students.

>> syms x real
>> clear all
>> solve ('x^2-a')
 
ans =
 
R_ intersect {[-a^(1/2), 1], [a^(1/2), 1]}

Subject: solve in R2008b strikes again :-(

From: Ben Hinkle

Date: 23 Nov, 2008 22:11:02

Message: 4 of 9

> Minimal reproduction steps:
>
> >> syms x real
> >> solve ('x^2-a')
>
> ans =
>
> R_ intersect {[-a^(1/2), 1], [a^(1/2), 1]}

OK. The real assumption on x is causing the confusing output. To explain the output the [blah,1] means the root appears with multiplicity one. The bug in the output is that the multiplicity should have been filtered out from the MuPAD output before being displayed in MATLAB.

> When I posted the original message yesterday, I had worked with Matlab for many hours before and cleared all variables via
>
> >> clear all
>
> before I tried to solve the equation. But as I had to find out, "clear all" does not clear properties of symbolic (MuPAD) variables, which seems to be a change of paradigm in R2008b. I find it difficult to explain this to my students.

There has been no change of paradigm wrt assumptions. In past versions the assumption that x is real was ignored. To clear an assumption in any version of the toolbox you must run
 syms x unreal
or
 sym('x','unreal')
Otherwise the assumption remains until the engine is reset or MATLAB exits.

Hope that helps,
-Ben

Subject: solve in R2008b strikes again :-(

From: Joerg Buchholz

Date: 24 Nov, 2008 11:12:01

Message: 5 of 9

> OK. The real assumption on x is causing the confusing output. To explain the output the [blah,1] means the root appears with multiplicity one. The bug in the output is that the multiplicity should have been filtered out from the MuPAD output before being displayed in MATLAB.

Do you want me to file a bug report?

> There has been no change of paradigm wrt assumptions. In past versions the assumption that x is real was ignored. To clear an assumption in any version of the toolbox you must run
> syms x unreal
> or
> sym('x','unreal')
> Otherwise the assumption remains until the engine is reset or MATLAB exits.
>
> Hope that helps,
> -Ben

Yes - that really helps! Thank you for your precise explanation; something new to learn every day :-)

One more question: In pre-MuPAD eras the pretty command used to indicate assumptions about variables via a tilde:

>> syms x real
>> pretty (x)
 
                                      x~

Is there a similar indicator in R2008b? (I know that evalin(symengine,'getprop(x)') works.)

Subject: solve in R2008b strikes again :-(

From: Ben Hinkle

Date: 25 Nov, 2008 13:17:01

Message: 6 of 9

"Joerg Buchholz" <buchholz@hs-bremen.de> wrote in message <gge261$g3r$1@fred.mathworks.com>...
> > OK. The real assumption on x is causing the confusing output. To explain the output the [blah,1] means the root appears with multiplicity one. The bug in the output is that the multiplicity should have been filtered out from the MuPAD output before being displayed in MATLAB.
>
> Do you want me to file a bug report?

No need. I've done that already (and included the link to this thread).

> > There has been no change of paradigm wrt assumptions. In past versions the assumption that x is real was ignored. To clear an assumption in any version of the toolbox you must run
> > syms x unreal
> > or
> > sym('x','unreal')
> > Otherwise the assumption remains until the engine is reset or MATLAB exits.
> >
> > Hope that helps,
> > -Ben
>
> Yes - that really helps! Thank you for your precise explanation; something new to learn every day :-)

Upon reflection there has been a change when you use 'clear all'. The 'clear all' command will clear mex files and clearing the maplemex mex file had the effect of wiping out all the assumptions (and all Maple state). In R2008b the mupadmex mex file is locked so 'clear all' will not reset the engine. I'll create a bug report to allow 'clear all' to once again reset the symbolic engine state.

> One more question: In pre-MuPAD eras the pretty command used to indicate assumptions about variables via a tilde:
>
> >> syms x real
> >> pretty (x)
>
> x~
>
> Is there a similar indicator in R2008b? (I know that evalin(symengine,'getprop(x)') works.)

Currently there is no similar indicator. We're working on ways to make it clear what assumptions are active.

Subject: solve in R2008b strikes again :-(

From: Joerg Buchholz

Date: 25 Nov, 2008 14:54:02

Message: 7 of 9

> Upon reflection there has been a change when you use 'clear all'. The 'clear all' command will clear mex files and clearing the maplemex mex file had the effect of wiping out all the assumptions (and all Maple state). In R2008b the mupadmex mex file is locked so 'clear all' will not reset the engine. I'll create a bug report to allow 'clear all' to once again reset the symbolic engine state.

Now I am confused; Seems like we switched positions. I tried

>> syms x real
>> clear all
>> syms x
>> pretty (x)
 
                                      x~

in R2007b. Seems like 'clear all' did not "wipe out all the assumptions".

Subject: solve in R2008b strikes again :-(

From: Ben Hinkle

Date: 26 Nov, 2008 01:12:02

Message: 8 of 9

"Joerg Buchholz" <buchholz@hs-bremen.de> wrote in message <ggh3i9$gl0$1@fred.mathworks.com>...
> > Upon reflection there has been a change when you use 'clear all'. The 'clear all' command will clear mex files and clearing the maplemex mex file had the effect of wiping out all the assumptions (and all Maple state). In R2008b the mupadmex mex file is locked so 'clear all' will not reset the engine. I'll create a bug report to allow 'clear all' to once again reset the symbolic engine state.
>
> Now I am confused; Seems like we switched positions. I tried
>
> >> syms x real
> >> clear all
> >> syms x
> >> pretty (x)
>
> x~
>
> in R2007b. Seems like 'clear all' did not "wipe out all the assumptions".

Are you running MATLAB on a mac? It turns out on a mac we had to lock the mex file due to how dynamic libraries worked on it. If you aren't running on a mac then I need to do some more digging into the history of this behavior before I can explain.

-Ben

Subject: solve in R2008b strikes again :-(

From: Joerg Buchholz

Date: 26 Nov, 2008 13:35:04

Message: 9 of 9

> Are you running MATLAB on a mac? It turns out on a mac we had to lock the mex file due to how dynamic libraries worked on it. If you aren't running on a mac then I need to do some more digging into the history of this behavior before I can explain.

No Mac involved; just plain-vanilla Vista.

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