0
$\begingroup$

I have a big project in matlab that I've been writing for months. It includes a lot of code related to equations. The code worked with Matlab symbolic engine (or maybe it was Mupad I'm not sure). I wanted to switch to Maple symbolic engine so I downloaded Maple toolbox for Matlab. Now I can't run my code anymore since matlab doesn't recognize commands like 'vpasolve' (solve numeric equations), 'children' (finds subexpressions of a given expression), etc..

I'm looking for a long time for a tutorial that explains how to work with Maple toolbox for matlab that can expain in details what changes I need to make in my code to make it work. For example, I have no idea what to write instead of the 'children' command. I didn't find any tutorial. The best I've found so far is this link:

http://www-h.eng.cam.ac.uk/help/tpl/programs/Matlab/maplesymbolic.html

but It explains only a little and I still don't know what to do with many of the commands that I need to change (like 'children').

Can anyone suggest how I can change my code to make it work? or send me a link that explains that (if exists). I know a little Maple (mostly works with Matlab).

Thanks!

$\endgroup$
0
$\begingroup$

The closest Maple analog to Mupad's vpasolve seems to be fsolve.

The closest Maple analog to Mupad's children seems to be op . Note that it returns a sequence, but of course you can wrap the result in a list (square brackets) or a Vector or Matrix. It does not automatically map across Matrices and Vectors and lists.

Eg,

restart;

op( x^2 + x*y = y^2 + 1 );

                     2         2
                    x  + x y, y  + 1

M := Matrix( [ [ x + y, sin(x)*cos(y) ],
               [ x^3 - y^3, exp(x*y^2) ] ] );

                 [ x + y     sin(x) cos(y)]
            M := [                        ]
                 [ 3    3             2   ]
                 [x  - y       exp(x y )  ]

s := map(op, M);

               [  (x, y)       (sin(x), cos(y))]
          s := [                               ]
               [   3    3              2       ]
               [ (x , -y )          x y        ]

I got an overview of commands in the Mupad based symbolic toolbox for Matlab here.

Your question is more about programming than mathematics, and as such would be better suited to stackoverflow or Mapleprimes. The latter is a Maple user community and its members might be able to help with more complicated examples.

[edited followup to comment]

I am not aware of a URL that shows side-by-side comparison of commands in the Mupad versus Maple.

restart;

exp1:=Matrix([[a,b],[c,d]]):

exp2:=Matrix([[y,7],[-4,p]]):

zip( `=`, exp1, exp2 ); # returns a Matrix

                   [a = y     b = 7]
                   [               ]
                   [c = -4    d = p]

Equate( exp1, exp2 ); # returns a list

              [a = y, b = 7, c = -4, d = p]

Some commands and operators will not automatically map over Vector/Matrix/Array/list in Maple, but the commands map and zip can be used to get similar effects.

$\endgroup$
  • $\begingroup$ Thank you! I will ask next time in stackoverflow/Mapleprimes. I will check the 'op' command. didn't know about this command before. but still, the two commands that I mentioned were only examples. Is there a link that explains about it in details so I won't need to ask about each command in stackoverflow? One more command that I'm still stuck in converting. 'eq=exp1==exp2' (where exp1 and exp2 are 3x3 matrices of symbolic expressions). In Mupad engine it defined eq as a matrix of equations but in maple engine eq is a logical matrix (all zeros). How can I write the equivalent? $\endgroup$ – David Sep 6 '17 at 19:48
  • 1
    $\begingroup$ I've added some followup. $\endgroup$ – acer Sep 6 '17 at 20:16
  • $\begingroup$ Thank you again. but the code you wrote is pure Maple code right? the code that I need to write is in matlab (with maple engine). Can I write the code that you wrote above in matlab? $\endgroup$ – David Sep 6 '17 at 20:25
  • 1
    $\begingroup$ I don't know how Matlab works to allow commands to be passed through to the underlying symbolic engine. It might be the case that the commands it can pass through to Maple (as symbolic engine) are the exports of the Maple package MTM. That is just a guess. If correct then see maplesoft.com/support/help/Maple/view.aspx?path=MTM $\endgroup$ – acer Sep 6 '17 at 20:41
  • $\begingroup$ ok I will look it up. Thanks for all your help! $\endgroup$ – David Sep 6 '17 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.