Re: RE: Solve[] handles the same system differently
- To: mathgroup at smc.vnet.net
- Subject: [mg40886] Re: [mg40847] RE: [mg40841] Solve[] handles the same system differently
- From: Bobby Treat <drmajorbob+MathGroup3528 at mailblocks.com>
- Date: Wed, 23 Apr 2003 01:16:29 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Ah ha! The trick is to think in terms of variables versus parameters from the start, rather than letting Mathematica impose the distinction on us. Bobby -----Original Message----- From: David Park <djmp at earthlink.net> To: mathgroup at smc.vnet.net Subject: [mg40886] [mg40847] RE: [mg40841] Solve[] handles the same system differently Joe, I am not certain of the exact answer to your question. The internal workings of Solve are sometimes difficult to understand. But in solving equations it often helps if you can make the equations exact and if you take the "data" out of the equation system and substitute it later. Any approximate number in an equation should probably be treated as a data parameter. (Similarly, do not put units in an equation but put them in the data.) So I would write your second set of equations as... data = {Rx -> 3300, VinX1 -> 0, parm1 -> -0.001, parm2 -> -1.5}; eqns = {VgsX1 == IdsX1 Rx, IdsX1 == parm1(1 - (VinX1 - VgsX1)/parm2)^2}; Then the following works nicely... sols = Solve[eqns, IdsX1, VgsX1] sols /. data {{IdsX1 -> (1/(2*parm1*Rx^2))*(parm2^2 - 2*parm1*parm2*Rx + 2*parm1*Rx*VinX1 - parm2*Sqrt[parm2^2 - 4*parm1*parm2*Rx + 4*parm1*Rx*VinX1])}, {IdsX1 -> (1/(2*parm1*Rx^2))*(parm2^2 - 2*parm1*parm2*Rx + 2*parm1*Rx*VinX1 + parm2*Sqrt[parm2^2 - 4*parm1*parm2*Rx + 4*parm1*Rx*VinX1])}} {{IdsX1 -> 0.00035124 - 0.000288517 I}, {IdsX1 -> 0.00035124 + 0.000288517 I}} David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Joe Gwinn To: mathgroup at smc.vnet.net [mailto:joegwinn at attbi.com] To: mathgroup at smc.vnet.net I am running Mathematica 4.0.1.0 under MacOS 9.1, and have encountered a little mystery: The following works OK: In[15]:= Solve[{Rx == 3300, VinX1 == 0, IdsX1 == 0.001(1 - (VinX1 - Rx*IdsX1)/(-1.5))^2}, {IdsX1}] Yielding: Out[15]= {{IdsX1 -> 0.000234453}, {IdsX1 -> 0.00088125}} When I rearrange the equation system a bit, it fails to find a solution: In[16]:= Solve[{Rx == 3300, VinX1 == 0, VgsX1 == Rx*IdsX1, IdsX1 == 0.001(1 - (VinX1 - VgsX1)/(-1.5))^2}, {IdsX1}] Out[16]= {} What's going on? Why does a little algebra (the creation of the variable VgsX1) cause a problem? In[16] was generated by copying In[15] and doing some editing. No error messages were generated by either. Thanks, Joe Gwinn