Hi Justin
To achieve the behavior where a symbolic variable automatically displays its formatted LaTeX representation when a semicolon is omitted, a custom class can indeed be created that extends sym. However, to ensure that operations on instances of the new class return instances of the same class (rather than reverting to sym), the arithmetic operations and other relevant methods has to be overidden.
The following methods could be incorporated in the MySym class to ensure the output doesn't end up being a sym.
function result = plus(a, b)
result = MySym(plus@sym(a, b));
function result = minus(a, b)
result = MySym(minus@sym(a, b));
function result = mtimes(a, b)
result = MySym(mtimes@sym(a, b));
function result = mrdivide(a, b)
result = MySym(mrdivide@sym(a, b));
function result = mpower(a, b)
result = MySym(mpower@sym(a, b));
Similarly, more methods can be added as per requirement.
This setup should ensure that any operations involving MySym instances return results that are also MySym instances, allowing for consistent behavior across all the calculations.
For more information regarding sym, kindly refer the following documentation -
I hope this resolves the issue.