MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: solving equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105885] Re: solving equations
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Wed, 23 Dec 2009 02:41:53 -0500 (EST)

On 12/22/09 at 4:07 AM, arbiadr at gmail.com (Maria Davis) 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

<more like the above snipped>

>For solving these equations in x, I have used the command:
>Solve[ReadList["C:\\a.txt", Expression], {x}] However the result
>obtained is: {{x -> Csource.sendRole.RT}} which is wrong.

>In a second essay, I have changed variables name (B.inputPort.RT,
>Csink.sendRole.RT...) by names like a,b,c... and consequently I have
>obtained the desired result.

>But, in my work, I need using the first format for representing
>variable names. Please can you help me?

There isn't going to be a really simple solution for what you
want. The character "." is a predefined operator in Mathematica
and cannot be use in a variable name, That is Mathematica sees
Csource.receiverRole.RT as the dot product of three variables
Csource, receiverRole and RT not a single variable.

Probably the simplest way to get the desired end result would be
to rename all of your variables to a form acceptable to
Mathematica, solve as needed, convert the answer to strings then
manipulate the strings as desired.

My technique for naming variables in a way it is easy to
understand what they represent is to use camel case, i.e.
Csource.receiverRole.RT would become CsourceReceiverRoleRT. By
using upper case in this manner, it is still easy to read the
variable name in a meaningful way without using an explicit
separator. The only other thing I would do is to use lower case
for the first letter of any variable name. This ensures there
can be no conflict names of things built-in to Mathematica since
all built-in objects are guaranteed to begin with upper case letters.



  • Prev by Date: Re: Toolbar
  • Next by Date: Re: problems with parameter lumping using ReplaceAll
  • Previous by thread: Re: solving equations
  • Next by thread: solving equations