Hi everyone,
I have a simple question, but yet I can't figure it out. I want to substitute (point + alfa * d) values over x values.
If you evaluate (point + alpha * d), result is [1 - alpha, 2 - alpha]. But when it comes to the substitution, it becomes [alpha - 1, alpha - 2]. Why is that? How can I make this correct? Thanks in advance.
variable_count = 2;
syms x [1 variable_count]
syms alpha
func = 3 * x1^2 + 2 * x1 * x2 + 2 * x2^2 + 7;
d = [-1 -1];
point = [1 2];
func_one = subs(func, x, point + alpha * d)

 Akzeptierte Antwort

Paul
Paul am 8 Mai 2021

0 Stimmen

It is correct, isn't it?
x1^2 = (-x1)^2, x1*x2 = (-x1)*(-x2), and x2^2 = (-x2)^2

1 Kommentar

Onur YURDAKUL
Onur YURDAKUL am 9 Mai 2021
Yes, silly me. I was expecting just a raw substitution but instead it also rearranges the function. Thanks for your answer.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by