• question on using subs replace ratio in expression

    From Nasser M. Abbasi@21:1/5 to All on Wed Nov 15 18:04:12 2017
    This works:

    expr1:=sqrt(m)/sqrt(k);
    subs(sqrt(m)/sqrt(k)=w,expr1);

    gives
    w

    And this works

    expr2:=5*sqrt(m)/sqrt(k);
    subs(sqrt(m)/sqrt(k)=w,expr2);

    gives 5 * w

    But why this does not work?

    expr3:=A*sqrt(m)/sqrt(k);
    subs(sqrt(m)/sqrt(k)=w,expr3);

    I was expecting A*w to be returned, but it returns
    expr3 as is. algsubs also do not work.

    How can one tell Maple to replace sqrt(m)/sqrt(k) by w anywhere
    it appears in expression?

    Using Maple 2017.2 on windows.

    Thanks
    --Nasser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From acer@21:1/5 to Nasser M. Abbasi on Wed Nov 15 20:48:00 2017
    On Wednesday, November 15, 2017 at 7:04:20 PM UTC-5, Nasser M. Abbasi wrote:
    This works:

    expr1:=sqrt(m)/sqrt(k);
    subs(sqrt(m)/sqrt(k)=w,expr1);

    gives
    w

    And this works

    expr2:=5*sqrt(m)/sqrt(k);
    subs(sqrt(m)/sqrt(k)=w,expr2);

    gives 5 * w

    But why this does not work?

    expr3:=A*sqrt(m)/sqrt(k);
    subs(sqrt(m)/sqrt(k)=w,expr3);

    I was expecting A*w to be returned, but it returns
    expr3 as is. algsubs also do not work.

    How can one tell Maple to replace sqrt(m)/sqrt(k) by w anywhere
    it appears in expression?

    Using Maple 2017.2 on windows.

    Thanks
    --Nasser


    The expression resulting from the execution of sqrt(m)/sqrt(k) does not appear as a subexpression (or operand) of the expression resulting from the execution of A*sqrt(m)/sqrt(k) .


    restart;
    expr:=A*sqrt(m)/sqrt(k)+sqrt(m)+m/sqrt(k);

    (1/2)
    A m (1/2) m
    expr := -------- + m + ------
    (1/2) (1/2)
    k k

    thaw(algsubs(freeze(m^(1/2))*freeze(k^(-1/2))=w,
    subs([m^(1/2)=freeze(m^(1/2)),
    k^(-1/2)=freeze(k^(-1/2))],
    expr)));

    m (1/2)
    A w + ------ + m
    (1/2)
    k
    subsindets(expr,
    And(`*`,
    satisfies(u->(member(m^(1/2),[op(u)])
    and member(k^(-1/2),[op(u)])))),
    u->u*w*sqrt(k)/sqrt(m));

    m (1/2)
    A w + ------ + m
    (1/2)
    k

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)