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 Center および File ExchangeAssumptions についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by