Why is my last line coming up as an empty sym?

1 visualización (últimos 30 días)
Amy Joyce Valencia
Amy Joyce Valencia el 22 de Oct. de 2021
Comentada: Amy Joyce Valencia el 22 de Oct. de 2021
There's a couple steps to this problem. Expand and then simplify the equation. The last is to solve this equation: when x =2. But when I run it, it comes up empty
𝑦= (𝑥^3 +1)(𝑥^2 +2𝑥−5)(𝑥^2 −3)^2
clear
syms x
x==2
y = (x^3+1)*(x^2+2*x-5)*(x^2-3)^2 %deleted "eqn =' double = leads to error
expand(y) %switch out "eqn" with "y"
simplify(y) %same as above
solve(subs(y,x,2),y)

Respuestas (1)

Cris LaPierre
Cris LaPierre el 22 de Oct. de 2021
I don't think you need to use solve in the final line. Substituting in 2 for x will return a value for y. There is nothing left to solve for.
syms x
y = (x^3+1)*(x^2+2*x-5)*(x^2-3)^2 %deleted "eqn =' double = leads to error
y = 
subs(y,x,2)
ans = 
27

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by