Re: Solve (on Mathematica 4.1 Windows XP)?
- To: mathgroup at smc.vnet.net
- Subject: [mg33070] Re: [mg33047] Solve (on Mathematica 4.1 Windows XP)?
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 1 Mar 2002 06:51:14 -0500 (EST)
- References: <200202270548.AAA18148@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Michael Chang wrote: > > Hi everyone, > > I've noticed a problem that I've been having when trying to use > Solve[] on Mathematica 4.1 for Windows XP. :( > > Suppose I have > > In[1]:= Zf=(s(C1+C2)R2+1)/(s(s C1 C2 R2+C2));zf=(s c1 r2+1)/(s(s c1 c2 > r2+c1+c2)); diff=Zf-zf; > > (Sorry for the 'improper' (Capital) naming convention used above!) > > Basically, I would like to find out under what conditions Zf will > (can?) be equal to zf. So I pick three points for 's', say {1,2,3}, > and do the following: > > In[2]:= Solve[Thread[{diff/.{s->1},diff/.{s->2},diff/.{s->3}}=={0,0,0}],{c1,c2,r2}] > > Here, I get a solution (which is omitted for brevity) which works upon > back substitution. But if I pick some other points for 's', say > {Sqrt[2],Pi,3}, and try to solve for the same variables (c1,c2,r2) > Solve seems to hang ... and I can't seem to obtain more encouraging > results using GroebnerBasis either ... > > Am I doing something wrong here? If so, <blush> what? > > Of course, any and all help would be greatly appreciated! > > Regards, > > Michael What you have: Zf = (s*(C1+C2)*R2+1)/(s*(s*C1*C2*R2+C2)); zf = (s*c1*r2+1)/(s*(s*c1*c2*r2+c1+c2)); diff = Zf-zf; This can be done: Solve[(diff/.s->{1,2,3})==0, {c1,c2,r2}] To use the more strenuous substitutions you may need to get rid of denominators and perhaps later check that they do not vanish at solutions. polys = Numerator[Together[diff /. s->{Sqrt[2],Pi,3}]] In[22]:= InputForm[Timing[sol = Solve[polys==0, {c1,c2,r2}]]] Out[22]//InputForm= {0.15000000000000213*Second, {{c2 -> (6*C2 - (6*C2^2)/(C1 + C2) - 2*C2*Pi + (2*C2^2*Pi)/(C1 + C2) - 3*C2*Pi^2 + (3*C2^2*Pi^2)/(C1 + C2) + C2*Pi^3 - (C2^2*Pi^3)/(C1 + C2))/ (6 - 2*Pi - 3*Pi^2 + Pi^3), r2 -> (C1^2*R2 + 2*C1*C2*R2 + C2^2*R2)/C2^2, c1 -> C2^2/(C1 + C2)}}} I am guessing it is the presence of denominators, and the extra variables and equations necessitated thereby, that slows things. (We discussed some of this in March 1998. How soon they forget....). Given the question you pose, I think what you might really want is to find conditions that force equality independent of s. If this is the case, it may be done as below. In[24]:= InputForm[SolveAlways[diff==0, s]] Out[24]//InputForm= {{c1 -> 0, c2 -> 0, C2 -> 0}, {c2 -> C2, c1 -> 0, R2 -> 0}, {c2 -> C2, c1 -> 0, R2 -> 0}, {r2 -> 0, c2 -> -c1 + C2, R2 -> 0}, {c2 -> -c1, C2 -> 0, r2 -> 0}, {r2 -> (C2^2*R2)/(c2 - C2)^2, C1 -> (c2*C2)/(-c2 + C2), c1 -> -c2 + C2}} But this does not allow you to specify variables for which to solve in terms of others. To remedy this we might redo the above by hand as follows. origpolys = Numerator[Together[diff]]; coeffs = CoefficientList[origpolys, s]; In[27]:= InputForm[Solve[coeffs==0, {c1,c2,r2}]] Out[27]//InputForm= {{r2 -> (C1^2*R2 + 2*C1*C2*R2 + C2^2*R2)/C2^2, c1 -> C2^2/(C1 + C2), c2 -> (C1*C2)/(C1 + C2)}} Daniel Lichtblau Wolfram Research