Simple squaring of expression

조회 수: 2 (최근 30일)
Wesley  O'Quinn
Wesley O'Quinn 2019년 7월 11일
답변: David Goodmanson 2019년 7월 11일
It has been some time since I last used MatLab, and I can't remember how to solve this simple problem. Given the expression:
(1*a+2*b+3*c+4*d+5*e-8)^2
How do you return an answer that actually multiples out the expression and puts like terms together?
I wrote the attached code, but this only returns:
(a + 2*b + 3*c + 4*d + 5*e - 8)^2
syms a
syms b
syms c
syms d
syms e
(1*a+2*b+3*c+4*d+5*e-8)*(1*a+2*b+3*c+4*d+5*e-8)

채택된 답변

David Goodmanson
David Goodmanson 2019년 7월 11일
HI Wesley,
syms a
syms b
syms c
syms d
syms e
f = expand((1*a+2*b+3*c+4*d+5*e-8)*(1*a+2*b+3*c+4*d+5*e-8))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by