Matlab: Symbolic Toolbox deactivate automatic simplification
3 views (last 30 days)
Show older comments
Anders Kuhn
on 10 Nov 2017
Commented: Dyuman Joshi
on 22 Feb 2024
I have a question concerning the symbolic toolbox. When I give matlab a symbolic formula it does automatic simplification in live script, but I want it to write the formula exactly as I gave it to matlab. Does anybody know how to do that or where I can look it up? I haven't been lucky with my search so far
0 Comments
Accepted Answer
Walter Roberson
on 10 Nov 2017
That is not possible, and it is unlikely to ever be an option. Symbolic engines often have internal rewriting rules to put things into "canonical form" to make it easier to determine whether expressions are equal, which can be very important for reducing memory use and for performance reasons.
The internal symbolic engine (MuPAD) mechanism for postponing evaluation is to use hold() . Each evaluation strips off one layer of hold() . For example if you open a MuPad notebook and command
hold(hold(3))*hold(hold(5))
then because one layer of hold is stripped off at execution time, the result would be
hold(3)*hold(5)
If you had tried hold(3)*hold(5) directly then because one hold would be stripped off, you would get 15 directly .
There is no MATLAB interface provided for hold. You can try things like,
Hold = @(V) feval(symengine, 'hold', V)
Hold(3)*Hold(5)
but the result you will get will be
Warning: Unable to display symbolic object because 'symengine' was reset. Repeat commands to regenerate result.
> In sym/disp (line 44)
In sym/display>displayVariable (line 85)
In sym/display (line 47)
More Answers (0)
See Also
Categories
Find more on Special Values in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!