Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!usenet.stanford.edu!newsfeed.news.ucla.edu!nrc-news.nrc.ca!.POSTED!not-for-mail
From: "Think two, count blue." <roberson@hushmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: symbolic equation rearrangement
Date: Mon, 07 Feb 2011 18:03:18 -0600
Organization: National Research Council, Ottawa, Canada
Lines: 41
Message-ID: <iiq188$m72$1@nrc-news.nrc.ca>
References: <iipssv$8k1$1@fred.mathworks.com>
NNTP-Posting-Host: ibd-nat.ibd.nrc.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: nrc-news.nrc.ca 1297123400 22754 132.246.133.10 (8 Feb 2011 00:03:20 GMT)
X-Complaints-To: news-admin@nrc-news.nrc.ca
NNTP-Posting-Date: Tue, 8 Feb 2011 00:03:20 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7
In-Reply-To: <iipssv$8k1$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:708696

On 11-02-07 04:49 PM, pietro wrote:
> Hi,
>
> I have several symbolic equations like this one:
>
> (bs*md*s^3 + (bd*bs + ks*md)*s^2 + (bd*ks + bs*kd)*s + kd*ks)/(md*ms*s^4 +
> (bd*md + bd*ms + bs*md)*s^3 + (bd*bs + kd*md + kd*ms + ks*md)*s^2 + (bd*ks +
> bs*kd)*s + kd*ks)
>
> and I would like to rearrange this with respect these new variables:
>
> w1=sqrt(k1/m1);
> w2=sqrt(k2/m2);
> mu=w2/w1;
> cs1=bd/(2*md*w2)
> cs2=bs/(2*ms*w1)
>
>
> how can I get this?
>
> Any suggestions are appreciated.
>
> Thanks
>
> Pietro

Rewrite in terms of replacing a known variable with another variable, and 
re-order the substitutions so that no variable is re-used after it has been 
substituted. In particular, mu=w2/w1 can be rewritten as w2=mu*w1 or as w1 = 
w2/mu but either way one of w1 or w2 will be replaced, but w1 and w2 are 
needed for the later substitutions. Thus, leave the rewrite in terms of mu to 
last.

I think this might be valid MuPad syntax:

Revised_Expression = subs(Expression, k1, w1^2*m1, k2, w2^2*m2, bd, 
2*cs1*md*w2, bs, 2*cs2*ms*w1, w2, w1*mu);


By the way: you might want to factor() the numerator before you do the 
substitutions.