# evaluate symbolic expression... can't figure out!!

1 view (last 30 days)
Michael Vaughan on 25 Sep 2020
Commented: Walter Roberson on 25 Sep 2020
so I have declared syms v t
then I have defind this very long expression rw11 to be:
rw11=
-(t^(2 - 2*k)*v^(k - 2)*(t - v)*(v - 1)*(t + t^2*v^2 + t^4*v^2 + t^k*v - t*v + t^(k + 1)*v + t^(k + 2)*v + t^(k + 3)*v + t^(k + 4)*v + t^(k + 5)*v - t^(k + 2) - t^(k + 3) - t^(k + 4) - t^2*v - t^3*v - t^4*v - t^(3*k + 2)*v - t^(3*k + 3)*v + t^(3*k)*v^2 - t^(k + 1)*v^2 - t^(k + 2)*v^2 - t^(k + 3)*v^2 + t^3 + t^(3*k + 5)))/((t - 1)^4*(t + 1)^2*(t^4 + t^3 + 2*t^2 + t + 1))
I want to know what rw11 is if instead of v i have t^(1/2)
How do I do this?? Thanks

Samiu Haque on 25 Sep 2020
Use this substitute function.
rw_new = subs(rw11,v,(t^(1/2)))

#### 1 Comment

Walter Roberson on 25 Sep 2020
Though I would suggest
rw_new = subs(rw11, v, sqrt(t))
just to avoid having the formula parsed with the 1/2 being evaluated in floating point and then the symbolic toolbox having to figure out that the 0.5 is intended to approximate the rational value 1/2 .