Can you turn off all simplifications?
조회 수: 8 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (2개)
Stefan Wehmeier
2012년 6월 1일
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.
댓글 수: 0
Walter Roberson
2012년 5월 22일
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`
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!