What happened for "simple" command in matlab 2016
59 views (last 30 days)
Show older comments
hamed shorakaei
on 4 Jan 2018
Commented: Walter Roberson
on 11 Jan 2021
Hello
I already installed Matlab 2016a and I noticed that "simple" command doesn't exist in matlab anymore and I'm not sure when this command has been removed from matlab. Please note that "simplify" can not solve my current problem. I am found that "solve" command doesn't work as good as previous versions. For example it could not solve a sixth degree equation and the solution is based on the "root".
Does anybody know the alternative commands for these two.
Thanks
0 Comments
Accepted Answer
Benjamin Kraus
on 4 Jan 2018
It looks like the simple command (from the Symbolic Math Toolbox) was removed in R2015a. It is present in R2014b. The R2014b doc page says simple "will be removed in a future release.". The R2015a doc page says simple "has been removed."
In the future, this type of information can often be found in the Release Notes (I prefer to click "expand all in page" and then use the search feature).
As for alternatives, you will have to provide more information (such as an example) about the problem you are trying to solve, and why simplify and solve are not doing what you want before people can suggest alternatives.
3 Comments
Walter Roberson
on 5 Jan 2018
There are no closed form solutions for most polynomials of degree 5 or higher.
Earlier versions of MATLAB would have expressed the same thing using RootOf() instead of root(), or would have given numeric approximations. If you want the numeric approximations, you can vpa() the current output. The symbolic placeholder is much more useful for algebraic computation such as not accidentally back-substituting the wrong root branch when doing further computations.
More Answers (3)
Walter Roberson
on 4 Jan 2018
simple was removed in R2015a. https://www.mathworks.com/help/releases/R2015a/symbolic/release-notes.html#R2015a
0 Comments
Lei LIU
on 19 May 2019
I meet the same problem, i.e., the result of 'simplify' is not desired but 'simple' works well.
0 Comments
Deniz Muhacir
on 10 Jan 2021
Hi everyone!
Can anybody solve this issue? Has anyone got alterne code for simple? Because i need to make simple a matrix that :
(24678615572571482867467662723121*sin(theta1))/6582018229284824168619876730229402019930943462534319453394436096 + (4967757600021511*cos(theta3)(cos(theta1)*sin(theta2) + (4967757600021511*cos(theta2)*sin(theta1))/81129638414606681695789005144064))/81129638414606681695789005144064 + (4967757600021511*sin(theta3)(cos(theta1)cos(theta2) - (4967757600021511*sin(theta1)*sin(theta2))/81129638414606681695789005144064))/81129638414606681695789005144064 + cos(theta4)((4967757600021511*cos(theta3)(cos(theta1)*sin(theta2) + (4967757600021511*cos(theta2)*sin(theta1))/81129638414606681695789005144064))/81129638414606681695789005144064 - sin(theta1) + (4967757600021511*sin(theta3)(cos(theta1)cos(theta2) - (4967757600021511*sin(theta1)*sin(theta2))/81129638414606681695789005144064))/81129638414606681695789005144064) + sin(theta4)(cos(theta3)(cos(theta1)*cos(theta2) - (4967757600021511*sin(theta1)*sin(theta2))/81129638414606681695789005144064) - sin(theta3)(cos(theta1)*sin(theta2) + (4967757600021511*cos(theta2)*sin(theta1))/81129638414606681695789005144064))
(4967757600021511*sin(theta3)((4967757600021511*cos(theta1)*sin(theta2))/81129638414606681695789005144064 + cos(theta2)*sin(theta1)))/81129638414606681695789005144064 - (4967757600021511*cos(theta3)((4967757600021511*cos(theta1)cos(theta2))/81129638414606681695789005144064 - sin(theta1)*sin(theta2)))/81129638414606681695789005144064 - (24678615572571482867467662723121*cos(theta1))/6582018229284824168619876730229402019930943462534319453394436096 + sin(theta4)(cos(theta3)((4967757600021511*cos(theta1)*sin(theta2))/81129638414606681695789005144064 + cos(theta2)*sin(theta1)) + sin(theta3)((4967757600021511*cos(theta1)cos(theta2))/81129638414606681695789005144064 - sin(theta1)*sin(theta2))) + cos(theta4)(cos(theta1) - (4967757600021511*cos(theta3)((4967757600021511*cos(theta1)*cos(theta2))/81129638414606681695789005144064 - sin(theta1)*sin(theta2)))/81129638414606681695789005144064 + (4967757600021511*sin(theta3)((4967757600021511*cos(theta1)*sin(theta2))/81129638414606681695789005144064 + cos(theta2)*sin(theta1)))/81129638414606681695789005144064)
(4967757600021511*sin(theta2)sin(theta3))/81129638414606681695789005144064 - (4967757600021511*cos(theta2)*cos(theta3))/81129638414606681695789005144064 - cos(theta4)((4967757600021511*cos(theta2)cos(theta3))/81129638414606681695789005144064 - (4967757600021511*sin(theta2)*sin(theta3))/81129638414606681695789005144064 + 4967757600021511/81129638414606681695789005144064) + sin(theta4)(cos(theta2)*sin(theta3) + cos(theta3)*sin(theta2)) + 122597380068651197257713859414983140362437055831/533996758980227520598755426542388028650676130589163192486760401955554931445160137505740521734144
most of its elements are zero but i cannot get clean integers
2 Comments
Walter Roberson
on 10 Jan 2021
syms theta1 theta2 theta3
E = (sym('24678615572571482867467662723121')*sin(theta1))/sym('6582018229284824168619876730229402019930943462534319453394436096') + (sym('4967757600021511')*cos(theta3)*(cos(theta1)*sin(theta2) + (sym('4967757600021511')*cos(theta2)*sin(theta1))/sym('81129638414606681695789005144064')))/sym('81129638414606681695789005144064')
vpa(E)
Those are not zero.
Enew = mapSymType(expand(E), 'rational', @(x) piecewise(abs(x) < 1e-20, 0, x))
vpa(Enew)
Walter Roberson
on 11 Jan 2021
However, in any case like this, you should be working on the problem from much further back.
When you are building the expressions to be calculated on, enclose any non-integer floating point constant in a call to sym() . Even if it is just 0.5, use sym(0.5) . Do this even for integers if you are performing calculations on them, such as sqrt(sym(1)/2) or sqrt(sym(1)/sym(2)) . Also do it if you are working with larger integers.
Do this even with fractions. For example, sym(1)/sym(7) or sym(1)/7 . If you use sym(1/7) instead then MATLAB will often correctly guess which fraction you wanted, but it does not always get the value right.
If you have floating point constants of the form number1Enumber2 then replace that with sym(number1)*10^sym(number2) . For example, 1.23e6 -> sym(1.23)*10^(sym(6))
Any integer that exceeds 2^52 and cannot be expressed in the above sym(A)*10^sym(b) form with smaller integer, must be expressed with sym() and quoted values. For example, sym('24678615572571482867467662723121')
Enclose any reference to pi in a call to sym(), so for example sin(sym(pi)/3)
I usually find it easier to write a small function to help, such as
Q = @(x) sym(x);
Pi = Q(pi);
sin( Q(5) * Pi / Q(7))
If you take these steps, there will still be some cases where large numbers like the ones you saw will be generated, but the incidence will be greatly reduced.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!