Can I check if factored and expanded polynomial forms are equal?
조회 수: 1 (최근 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에서 Number Theory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!