KLee
KLee

Reputation: 205

Mathematica: Leaving as constants

I was going to simplify an equation with three variables (s, a, b) using Mathematica as follows:

In[3]:= f[s_] := ((1/4)*(s + s^2 + s^3 + s^4)*[a*(s^3 - s) + 
  b*(s^3 - s^2)])/(s^3 - (1/4)*(s + s^2 + s^3 + s^4))

In[4]:= Simplify[f[s_]]
Out[4]:= s_ (1 + s_ + s_^2)

As you can see, in the simplified version does not have 'a' and 'b'. I am sure that they should not be removed during simplification process. I am wondering what I am missing...

Thank you in advance!!!

Upvotes: 0

Views: 80

Answers (1)

Bill
Bill

Reputation: 3957

Square brackets have very precise meaning in Mathematica and can't be used in place of parens. Likewise underscores can only be used in very specific ways.

Try this

f[s_] := (1/4*(s+s^2+s^3+s^4)*(a*(s^3-s)+b*(s^3-s^2)))/(s^3-1/4*(s+s^2+s^3+s^4));
Simplify[f[s]]

which gives you this

-((s*(a + a*s + b*s)*(1 + s + s^2 + s^3))/(-1 - 2*s + s^2))

Upvotes: 0

Related Questions