How can I solve this: (x-2)*(x+1)^3?

6 ビュー (過去 30 日間)
LUCA GIROTTI
LUCA GIROTTI 2022 年 3 月 10 日
編集済み: Sam Chak 2022 年 3 月 10 日
Hey there,
I am trying to process this "(x-2)*(x+1)^3" through matlab in way that I can have a result like this:
However every time I try to perform this operation, matlab keeps on telling me that x is set to nothing, how can I solve this?
Thanks in advance!

採用された回答

Ayaz Siddiqui
Ayaz Siddiqui 2022 年 3 月 10 日
編集済み: Ayaz Siddiqui 2022 年 3 月 10 日
Try using expand.
syms x;
expand((x-2)*(x+1)^3)
  1 件のコメント
LUCA GIROTTI
LUCA GIROTTI 2022 年 3 月 10 日
Thank you so much @Ayaz Siddiqui
Works perfectly !

サインインしてコメントする。

その他の回答 (1 件)

Sam Chak
Sam Chak 2022 年 3 月 10 日
It's good to hear that you tried working out something by yourself. You need to create a symbolic variable for x.
syms x
For more info, please check:
  2 件のコメント
LUCA GIROTTI
LUCA GIROTTI 2022 年 3 月 10 日
Thank you for your answer @Sam Chak
I tried using "syms x" however thats the result I have (with this input (x-2)*(x+1)^3) :
(x + 1)^3*(x - 2)
Much better since I indeed don't have an error anymore, however it hasn't fully performed the operation.
Sam Chak
Sam Chak 2022 年 3 月 10 日
編集済み: Sam Chak 2022 年 3 月 10 日
Good to hear that. If you are dealing with algebraic expressions and analytical problems, you will be using syms a lot! You can find lots of examples and learn a lot of functions here to perform many types of symbolic computations:

サインインしてコメントする。

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by