Order matters.
When you define
r = c + e
then r gets assigned a value that includes a copy of what c was and a copy of what e was at the time of execution of the statement.
e = ((2s^3+4*s^2+1*s)*c)/k
is a syntax error. Add the obvious multiplication and you are assign to e a value that includes a copy of what s was and a copy of what c was and a copy of what k was at the time of execution. This assignment to e does not change the e that was used in the definition of r
You then have
c = r - e
This is clearly intended as a procedural step rather than establishing simultaneous equations.
You are mixing procedural statements with the expectation that giving a value to symbols changes past references to those symbols.
Consider,
a = 1
b = a + 2
a = 2
You do not expect b to now become 2 + 2, because b is not establishing a formula to be evaluated with some current value of a: b is a procedural assignment, where the current value of a is to be copied and used to create a specific value of b that is then untouched by the change to a.
Just so if you have
c = sym('c'); %this is what "syms c" really means
a = 1
b = a + c
c = 2
then you should not expect that b will become 1 + 2, because assignments to symbolic variables do not "reach back" and change previous references to the variables. If you want a change to be reflected, you need to use subs() .
You should always avoid assigning to a symbolic variable after you have used it in a previous expression, as it leads to exactly these kinds of messes. subs() instead:
c = sym('c'); %this is what "syms c" really means
a = 1
b = a + c
subs(b, c, 2)