cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Anybody Try Mupad?

mfrench
13-Aquamarine

Anybody Try Mupad?

Hi Folks,

I just had a visit from a Senior Technical Evangelist (that's really his title) from Mathworks. He suggested that I try Mupad, a symbolic math program that sits on top of the Matlab Symbolics Toolbox. Has anyone else tried it?

It's still a command line kind of interface, but friendlier than the '>>' familiar to Matlab users. I have used Matlab since the early 90s and mostly like it - very handy for big number crunching tasks.

To run it, all I had to do was type in 'mupad' from the command line. I think it requires the Symbolics Toolbox, though.

14 REPLIES 14
RichardJ
19-Tanzanite
(To:mfrench)

Mathcad uses MuPad as the symbolic engine.

It doesn't really sit on top of the symbolic toolbox. It IS the symbolic toolbox.

StuartBruff
23-Emerald III
(To:mfrench)

As Richard says, the Symbolic Toolbox is effectively MuPad. I've only used it a couple of times, and I can't say that I find it any "friendlier" than the normal Matlab interface when used with its toolbox interface (ie, as an App) ... just different, although I do like the "standard" math notation for the results.

You don't need to type mupad in to use it, though ... or, at least, not in my version ... you can simply use the sym commands, eg:

>> A=hilb(3)

A =

1.0000 0.5000 0.3333

0.5000 0.3333 0.2500

0.3333 0.2500 0.2000

>> sym(A)

ans =

[ 1, 1/2, 1/3]

[ 1/2, 1/3, 1/4]

[ 1/3, 1/4, 1/5]

>> phi=sym('(1+sqrt(5))/2');

>> simplify(phi)

ans =

5^(1/2)/2 + 1/2

>> eval(phi)

ans =

1.6180

>> phi2=(1+sqrt(5))/2

phi2 =

1.6180

>> sym(phi2)

ans =

910872158600853/562949953421312

There are, however, some MuPad features that will only run in the Notebook interface (eg, contfrac).

Overall, I still prefer the look and feel of a Mathcad worksheet, although I think the integration of the symbolic commands could be improved ... I've often wanted to construct a procedure that contains the symbolic commands as an integral part of its construction, rather than have them be only available through the separate symbolic evaluation operator; eg, I'd like to write:

f(x):=| sexpr<-asin(x) series,x,10

| fexpr<-sexpr confrac,10

| fexpr

or

f(x):=| sexpr<-series(asin(x). x,10)

| fexpr<-confrac(sexpr,10)

| fexpr

and then symbolically evaluate the function to allow its use by the numerical processor.

Stuart

PS. Mathcad's symbolic processor is a cut-down version of MuPad.

LucMeekes
23-Emerald III
(To:StuartBruff)

What's wrong with:

confrac.png

other than that the definition needs to be on a single line?

Luc

StuartBruff
23-Emerald III
(To:LucMeekes)

LucMeekes wrote:

What's wrong with:

...

other than that the definition needs to be on a single line?

It's that "other" bit that's in part what's wrong with it, Luc. I only gave a short example (because I'm lazy) but if I want to put several more symbolic operations in the sequence, then the resulting expression simply gets too long to see on a single page and/or becomes difficult to read.

In addition (and this is the other main part of what's wrong with it), I might want to do a symbolic operation then a standard operation then another symbolic operation and so on (as I can in Maple). In the above example, I might want to write a local function f that takes n as the argument for series and another one g that takes m as the argument for the confrac, and then run a loop that determines what value of m in g(m) equals f(n). Or I might want to sum a symbolically derived vector, etc.

Stuart

LucMeekes
23-Emerald III
(To:StuartBruff)

Hi Stuart,

I see what you mean. Although Prime does stack the symbolic commands, instead of chaining them wide out, there's this intermingling that neither Mathcad nor Prime do support: only one symbolic line per program is supported as far as I can see.

If not already done, add it to the wish-list.

Luc

RichardJ
19-Tanzanite
(To:LucMeekes)

Some history.

Back in the days of MC11 you could add more than one symbolic line to a program. You could only do this by copy and paste though, because it was not officially supported. In fact, it broke the licensing agreement with Maple (which may have had something to do with the switch to MuPad; I'm not sure about that though). So for MC12 and later a program can be evaluated symbolically, but symbolic operations can not be embedded in programs. That rule seems to have stuck, even when the symbolic engine was switched to Mupad. I don't know if that's because of licensing issues, or just because they never changed it. Here's an example in MC11:

StuartBruff
23-Emerald III
(To:RichardJ)

Richard Jackson wrote:

Some history.

Back in the days of MC11 you could add more than one symbolic line to a program. You could only do this by copy and paste though, because it was not officially supported. In fact, it broke the licensing agreement with Maple (which may have had something to do with the switch to MuPad; I'm not sure about that though). So for MC12 and later a program can be evaluated symbolically, but symbolic operations can not be embedded in programs. That rule seems to have stuck, even when the symbolic engine was switched to Mupad. I don't know if that's because of licensing issues, or just because they never changed it. Here's an example in MC11:

Ah! Thanks for pointing that out, Richard. I had a vague nagging feeling that I used to do this kind of thing in Mathcad (and why I was half-expecting someone to point out the correct method of doing it in M15 and Prime). Because I don't use it anymore, I've forgotten about the plethora of ways that M11 outshone its successors!

Stuart

LucMeekes
23-Emerald III
(To:StuartBruff)

Stuart,

That's exactly the reason why I stick with Mathcad 11 still, and for years to come.

Luc

LouP
12-Amethyst
(To:LucMeekes)

Ditto!

Lou

FDS
13-Aquamarine
13-Aquamarine
(To:RichardJ)

Dear Richard, I was not aware you could do this with MC11. Could you explain a bit more in depth how exactly you constructed the file in MC11? When I paste it in the program (MC 11.2a) it does not symbolically solve anymore. My OS is win7 (32bits) and I run MC 11 in compatibility mode for XP. Thanks!

RichardJ
19-Tanzanite
(To:FDS)

Could you explain a bit more in depth how exactly you constructed the file in MC11?

I would if I could remember . I created that program a very long time ago, and I don't recall the exact details of how to do it. I do remember that the symbolic expressions can't be typed directly in the program. That restriction was deliberately imposed by Mathsoft, because symbolic expressions within programs violated their licensing agreement with Maple. They accidentally left a loophole though, allowing such programs to be created by copy and paste. You will have to play around a bit to figure out exactly how to do it. I've attached the program, so you can see that it works as advertised

My OS is win7 (32bits) and I run MC 11 in compatibility mode for XP.

I also run it this way, although I have Win 7 64 bit. It seems to work fine.

LucMeekes
23-Emerald III
(To:RichardJ)

I've rebuilt the file from the picture (corrected some spelling errors on the way) with the attached as result.

The trick of getting symbolic results into the program is that you first build the symbolic expression (e.g. "d/dx....solve, x ->", so including the symbolic evaluation operator) outside of the program, and then copy (or cut) it and paste it into the assignment on the placeholder that's open after you've constructed "Roots <-" (by typing "Roots{").

Likewise build the symbolic expression for the "d2/dx2 ...Rootsi->" then copy it as an argument to signum() into the symbolic expression for "signum()->", then copy the result into the placeholder of the assigment to "MinOrMax<-"

Success!

Luc

FDS
13-Aquamarine
13-Aquamarine
(To:LucMeekes)

Dear Richard and Luc,

Thank you for the explanation everything is clear now.

StuartBruff
23-Emerald III
(To:LucMeekes)

LucMeekes wrote:

Hi Stuart,

I see what you mean. Although Prime does stack the symbolic commands, instead of chaining them wide out, there's this intermingling that neither Mathcad nor Prime do support: only one symbolic line per program is supported as far as I can see.

That's what I suspected, but wasn't sure about ... I thought I might have been overlooking something.

If not already done, add it to the wish-list.

I've had a not-too-deep play with the Prime 3.1 trial and that's going to be on my list of observations / feature requests. Now that Richard's drawn my attention to it, I have this strong feeling of déjà vu that it's been raised before but got lost in whatever deep, non-escapable, black-hole of a dungeon feature requests are kept in.

Stuart

Announcements

Top Tags