Can you turn off all simplifications?

19 views (last 30 days)
Billy
Billy on 22 May 2012
I need to do some basic algebra and want to use MuPad as a "check my work" tool. However I can't turn off all simplifications! I want MuPad to _not_ simplify fractions etc, instead leave them in raw (original number) form.

Answers (2)

Stefan Wehmeier
Stefan Wehmeier on 1 Jun 2012
It's a bit tricky. hold(4/6) will not help you because 4/6 -> 2/3 is done by the parser. You will have to define "frozen" forms of all operators you use, e.g. mydiv:= freeze(_divide); mydiv(4, 6)
If you want to use infix notation for your "frozen" functions, you have to link them to infix operator symbols - see ?operator. If, much later, you want the computation to be done - how else could you check your work? - then apply unfreeze to your final result. You could also use hold(_divide)(4, 6) but then it is much more difficult to prevent unwanted simplifications later on. Some of the tricks explained in ?Pref::postInput may also be of interest.

Walter Roberson
Walter Roberson on 22 May 2012
I have not read the MuPAD documentation in enough detail to be really sure, but I believe the answer is NO, that it is not possible to turn off automatic simplification of numeric constant expressions. For example, 1 + 1 will be replaced by 2.
You might be able to take advantage of hold().
If not, convert the numbers to symbols or strings. But that risks replacing (e.g.) `1` + `1` with 2*`1`

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!