MATLAB Answers

S H
1

how to prevent reordering of terms by symbolic math functions

Asked by S H
on 18 Apr 2019
Latest activity Answered by Walter Roberson
on 18 Apr 2019
When using symbolic math, terms are reordered. For example, a+s*b is changed to a+b*s. Is there a way to prevent this? Because sometimes results need to be stored as strings and their order has a special meaning and when order of terms are changed by symbolic math, it causes lots of other headaches.

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 18 Apr 2019

Yes, there is a way. You can create a whole bunch of MuPAD code to use the general framework of the internal symbolic engine in order to implement non-commutative objects and associated :print slots, and you would create a number of MATLAB level functions that used feval(symengine) or evalin(symengine) to create appropriate wrappers at the MATLAB level.
The amount of work involved would depend upon what operations you needed. For example if you needed to implement differential equation solving on your non-commutative objects involving hypergeometric functions, then it could end up taking a fair bit of effort.
It would sort of be like implementing a new arithmetic class in MATLAB that for arcane reasons all had to be implemented by string manipulation, with only a depressed debugger to help you.

  0 Comments

Sign in to comment.