Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.soft-sys.math.maple > #1289

Re: question on using subs replace ratio in expression

Newsgroups comp.soft-sys.math.maple
Date 2017-11-15 20:48 -0800
References <ouikm0$bdf$1@gioia.aioe.org>
Message-ID <c70462ea-5be5-43db-8bcb-997d6fe4efd2@googlegroups.com> (permalink)
Subject Re: question on using subs replace ratio in expression
From acer <maple@rogers.com>

Show all headers | View raw


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              

Back to comp.soft-sys.math.maple | Previous | NextPrevious in thread | Find similar


Thread

question on using subs replace ratio in expression "Nasser M. Abbasi" <nma@12000.org> - 2017-11-15 18:04 -0600
  Re: question on using subs replace ratio in expression acer <maple@rogers.com> - 2017-11-15 20:48 -0800

csiph-web