Re: solving equations
- To: mathgroup at smc.vnet.net
- Subject: [mg105930] Re: solving equations
- From: bill <bsimpson141421356 at hotmail.com>
- Date: Sat, 26 Dec 2009 19:08:18 -0500 (EST)
- References: <hh16uf$4m4$1@smc.vnet.net>
On Dec 24, 6:10 pm, Maria Davis <arbi... at gmail.com> wrote: > My file a.txt contains these equations: > > x == Csource.receiverRole.RT > Csource.receiverRole.RT == Csource.sendRole.RT + Csource.TT > Csource.sendRole.RT == A.inputPort.RT > A.inputPort.RT == A.outputPort.RT + A.PT > A.ouputPort.RT == C.receiverRole.RT > C.receiverRole.RT == C.sendRole.RT + C.TT > C.sendRole.RT == B.inputPort.RT > B.inputPort.RT == B.outputPort.RT + B.PT > B.ouputPort.RT == Csink.receiverRole.RT > Csink.receiverRole.RT == Csink.sendRole.RT + Csink.TT > Csink.sendRole.RT == DataSink.inputPort.RT > DataSink.inputPort.RT == 0 > Csource.TT == 0 > Csink.TT == 0 > C.TT == 0.5 > A.PT == 2 > B.PT == 1.5 > > For solving these equations for x , I tried to omit the caracter '.', > because, as certain have adviced, Mathematica interprets the dot as a > product. > I replaced the dot by a letter 'a' (for trial) using a code given by > dr DanW: > > dots = ReadList["a.txt", Record, RecordSeparators -> {}] > > nodots = StringReplace[dots[[1]], StringExpression > [pre:LetterCharacter, ".", post:LetterCharacter] :> StringJoin[pre, > "a", post]] > > Solve[ReadList[StringToStream[nodots], Expression], {x}] > > I have verified that for example a varible name: > Csource.receiverRole.RT has changed to CsourceareceiverRoleaRT. But > the resolution of the system returns a wrong value: > {{x -> CsourceasendRoleaRT}} In[1]:=dots=ReadList["a.txt",Record,RecordSeparators->{}]; nodots=StringReplace[dots[[1]],StringExpression [pre:LetterCharacter,".",post:LetterCharacter]:>StringJoin [pre,"a",post]]; noouput=StringReplace[nodots,"ouput"->"output"]; Solve[ReadList[StringToStream[noouput],Expression],{x}] Out[1]={{x->4.}}