       Re: changing replacement rule arrow ( ->) to equal sign(==)...

• To: mathgroup at smc.vnet.net
• Subject: [mg45889] Re: changing replacement rule arrow ( ->) to equal sign(==)...
• From: bobhanlon at aol.com (Bob Hanlon)
• Date: Thu, 29 Jan 2004 05:34:34 -0500 (EST)
• References: <bv83l0\$idm\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```a -> b // FullForm

Rule[a,b]

a == b // FullForm

Equal[a,b]

Method 1:

Solve[{0==1-2C[t]-1 C[t] tf[t]+2 tfC[t],
0==-1 G[t]+2 tfC[t],
0==1-2 tf[t]-1 C[t] tf[t]+2 tfC[t],
0==1 C[t] 2 tf[t]-1 tfC[t]-2 tfC[t]},
{C[t],G[t],tf[t],tfC[t]}][]/.
{Rule -> Equal,t->0}

{G == 4*(5 - 2*Sqrt), tfC == 2*(5 - 2*Sqrt), C == 3 - Sqrt,
tf == 3 - Sqrt}

Method 2:

(Equal @@  #)& /@
Solve[{0==1-2C[t]-1 C[t] tf[t]+2 tfC[t],
0==-1 G[t]+2 tfC[t],
0==1-2 tf[t]-1 C[t] tf[t]+2 tfC[t],
0==1 C[t] 2 tf[t]-1 tfC[t]-2 tfC[t]},
{C[t],G[t],tf[t],tfC[t]}][]/.t->0

{G == 4*(5 - 2*Sqrt), tfC == 2*(5 - 2*Sqrt), C == 3 - Sqrt,
tf == 3 - Sqrt}

Bob Hanlon

In article <bv83l0\$idm\$1 at smc.vnet.net>, sean_incali at yahoo.com (sean kim) wrote:

<< thanks for all those tho replied regarding adding interpoating
functions.

few more questions...

let's say you can Solve a system of equations like this.

In:=
itxn = Solve[{0 == 1 - 2C[t] - 1 C[t] tf[t] + 2 tfC[t],
0 == -1  G[t] + 2 tfC[t],
0 == 1 - 2 tf[t] - 1 C[t] tf[t] + 2 tfC[t],
0 == 1 C[t] 2 tf[t] - 1 tfC[t] - 2 tfC[t]}, {C[t], G[t],
tf[t],
tfC[t]}][] /. t -> 0

above give a replacement rule as below.

{G -> 4*(5 - 2*Sqrt), tfC -> 2*(5 - 2*Sqrt),
C -> 3 - Sqrt, tf -> 3 - Sqrt}

now I would like to use this rule asd part of NDSolve as initial
conditions. but as we all know, it can't be used directly.

the -> needs to be replaced with ==

now, if i try to Map a rule that replaces -> with ==, like...

Map[{itxn[] == itxn[]}, itxn]

it doesn't work.

it gives a long list with wrong result.

what i wanted though is
{G == 4*(5 - 2*Sqrt), tfC == 2*(5 - 2*Sqrt),
C == 3 - Sqrt, tf == 3 - Sqrt}

So, what i would like to do is use the results from the Solve directly
in NDSolve as the initial conditions without having to manually edit
out the arrows with equal signs.

```

• Prev by Date: RE: Difference of numbers in the list
• Next by Date: Re: Simple question or how Mathematica getting on my nerves.
• Previous by thread: RE: changing replacement rule arrow ( ->) to equal sign(==)...
• Next by thread: Re: changing replacement rule arrow ( ->) to equal sign(==)...