# Is there a way to substitute a set of variables to become a new variable?

3 views (last 30 days)
AppleNg on 6 Aug 2022
Commented: dpb on 6 Aug 2022
Hi experts. I really need help here. I want to substitute R = P*a*b/2*k in my Equation_1 and Equation_2. However, the subs function only can change as single variable. I dont know how to do this. Thank you!
This is my script:
alpha_1 = 2*v1/l
alpha_2 = 2*v2/l
L1 = 0.5*P*V^2*a*b*l*alpha_1
L2 = 0.5*P*V^2*a*b*l*alpha_2
Equation_1 = (k*(v1-v2)*(l/2)) == (L1*l/4)
Equation_2 = (k*(2*v2-v1)*(l/2)) == (L2*l/4)
here I want to do the substitution as R = R = P*a*b/2*k in my Equation_1 and Equation_2 dpb on 6 Aug 2022
Doesn't show the problem -- but you didn't use R after you defined it so it has no bearing/effect...
It dawned on me later this is trying to do something with the symbolic TB -- I don't have it and have no experience trying to use it -- I was thinking only about numerical solution to the system.
If that's the end result wanted, then backslash should get you there; if you really need something symbolic somebody else will have to help; I simply don't know enough about it to even comment further.

Torsten on 6 Aug 2022
Edited: Torsten on 6 Aug 2022
syms a b alpha_1 alpha_2 v1 v2 l P V k R
alpha_1 = 2*v1/l;
alpha_2 = 2*v2/l;
R = P*a*b/(2*k);
L1 = R*V^2*l*alpha_1*k;
L2 = R*V^2*l*alpha_2*k;
Equation_1 = (k*(v1-v2)*(l/2)) == (L1*l/4);
Equation_2 = (k*(2*v2-v1)*(l/2)) == (L2*l/4);