# Question:How to subs/ collect expressions ?

## Question:How to subs/ collect expressions ?

Maple

Hi everyone,

I have two expressions given by:

A := -sqrt(m(p[1](t))/m(q[1](t)))*p[2](t) - l[1]*q[1](t) + l[1]*p[1](t) + q[2](t);

B := -(-sqrt(m(p[1](t))/m(q[1](t))^3)*C(p[1](t))*m(q[1](t))^(3/2)*p[2](t)^2*m(p[1](t)) + C(p[1](t))*p[2](t)^3*m(q[1](t))^(3/2)*sqrt(m(p[1](t))/m(q[1](t))) - l[1]*p[2](t)^2*C(p[1](t))*(p[1](t) - q[1](t))*m(q[1](t))^(3/2) - sqrt(m(q[1](t)))*l[2]*(p[1](t) - q[1](t))*m(p[1](t))^(3/2) + m(p[1](t))*l[1]*p[2](t)*C(p[1](t))*(p[1](t) - q[1](t))*sqrt(m(q[1](t))) - C(q[1](t))*q[2](t)^2*sqrt(m(p[1](t)))*m(q[1](t))*(q[2](t) - 1))/(sqrt(m(p[1](t)))*m(q[1](t))^(3/2));

I would like to rewrite these two expressions according to a and b (replace in A and B each: q[1](t) - p[1](t)  by a and   sqrt(m(q[1](t)))*q[2](t) - sqrt(m(p[1](t)))*p[2](t) by ), such that :

a := q[1](t) - p[1](t);
b := sqrt(m(q[1](t)))*q[2](t) - sqrt(m(p[1](t)))*p[2](t);

I used subs and collect but doesn’t work.

Could you help me please ?

I would like to thank you in advance.

Best regards,

﻿