What happened for "simple" command in matlab 2016
显示 更早的评论
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
采纳的回答
更多回答(3 个)
Walter Roberson
2018-1-4
0 个投票
simple was removed in R2015a. https://www.mathworks.com/help/releases/R2015a/symbolic/release-notes.html#R2015a
Lei LIU
2019-5-19
0 个投票
I meet the same problem, i.e., the result of 'simplify' is not desired but 'simple' works well.
Deniz Muhacir
2021-1-10
0 个投票
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 个评论
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
2021-1-11
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




