Can I check if factored and expanded polynomial forms are equal?
3 次查看(过去 30 天)
显示 更早的评论
>> syms w k
>> isequal((w^2-k^2),(w+k)*(w-k))
ans =
logical
0
Is there a way to tell that w^2-k^2 and (w+k)*(w-k) are equal?
Also tried isequal(expand(),expand()) method but expand() may order two polynomials that are the same differently and in these instances isequal() returns logical = 0.
0 个评论
采纳的回答
Vladimir Sovkov
2020-2-1
编辑:Vladimir Sovkov
2020-2-1
simplify((w^2-k^2) - (w+k)*(w-k))
ans =
0
expand((w+k)*(w-k))
ans =
w^2 - k^2
factor(w^2-k^2)
ans =
[ -1, k - w, k + w]
1 个评论
Vladimir Sovkov
2020-2-1
isequal ( sort ( factor(w^2-k^2) ) , sort ( factor((w-k)*(w+k)) ) )
ans =
logical
1
更多回答(1 个)
Steven Lord
2020-2-1
>> syms w k
>> x1 = (w^2-k^2);
>> x2 = (w+k)*(w-k);
>> isAlways(x1 == x2)
ans =
logical
1
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!