A symbolic expression problem (different results in different version)

Hi, :
May I ask, I have a m-file, the content is as below, but it ran out different result in different versions of Matlab, they are 2013b & 2019a, or say, it's originally built in 2013b, but while migrating to 2019a on the other platform, it failed.
Can anyone know why, and how to solve it ? I found the issue was caused by the simple(), and the ezsym.m provided by the mathwork contributor.
The complete URL is here :
Thank you very much.
The code is here:
syms t a
fun = sin(a*t)
laplace(fun)
fun = sin(t)^2
laplace(fun)
fun = sin(t^2)
laplace(fun)
fun= 1/2 * ( exp(i*t^2) - exp(-i*t^2) )
A = laplace(fun)
% ezsym() was from Mathwork community contributor
% refer to: https://www.mathworks.com/matlabcentral/fileexchange/51195-ezsym-display-symbolic-expression-in-blank-plot
ezsym(A,26)
% simple() in Matlab2013b is ok, but failed at 2019a
simple(A)
syms s y(s)
y(s) = A
Num_Y = y(2*pi*1e4)
N_Sol = simple(Num_Y)
N_abs = double(abs(N_Sol))
N_angle = double(angle(N_Sol))

 Accepted Answer

simple() was removed as of R2015a. Use simplify() instead.

7 Comments

Hi, Walter:
Thank you for the opinions, I tried simplify() a little, I am not sure if my opinion's correct, but it seems rewrite() could do better, since most users would like to have more forms of those math equations for any application. So more optinal forms would be better, originally a simple() could return multi-forms of that, but I don't know how to configure simplify() to do that, only found docs of rewrite() talking about that in some forms, but some 'types of form' ,eg: mwcos2sin, radsimp, I am not sure if it supports ?
Or maybe I am just confused about why simple() was removed ? Occupied too many space of the HD, etc.
Anyway, thank you for the suggestions.
Best regards.
simplify() does not offer a choice of simplifications. rewrite() does offer a choice of rewrites. radsimp is not (directly) available anymore; you have to use internal MuPAD such as
feval(symengine, 'radsimp', EXPRESSION)
Mathworks did not document why they removed simple()
Hi, Walter:
Ok, thank you very much.
I found mupad (or I should call it LiveScript) is quite different in 2019a than in 2013b. I was used to avoid using 'mupad' because it has different syntax usage than in workspace. But your suggestion works well in LiveScript, by the way I guess the ezsym() problem could be solved in LiveScript.
Best regards.
LiveScript is a new facility, something that a number of different programming languages refer to as "notebooks". It is not in itself the Symbolic Toolbox. For symbolic variables, it asks MuPAD to generate MathML for the formula, and then sends the MathML to the display routine.
Hi, Walter:
Ok, thank you for the hint of those MuPAD & MathML about symbolic expression.
By the way, after some tried of those MathML and surveyed, mainstream web browsers seem no more support 'MathML' natively, though heard firefox supports that.
There is a project 'SLiCAP' , I know which uses 'MathJax' to generate those 'symbolic expression' can be shown on web browers. I am not sure if Matlab will improve this 'MathML' for cross-platform or, maybe there are already other work arounds, I am not quite familiar with this scope.
Though 'LiveScript' is very good enough, sometimes knowing more options maybe also help more.
Best regards.
Mathml is from W3C https://www.w3.org/Math/
it is implemented in Firefox and safari. Some work is underway to add it to Chrome
Hi, Walter:
Thank you for the sharing.
Best regards.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!