Re: changing replacement rule arrow ( ->) to equal sign(==)...
- To: mathgroup at smc.vnet.net
- Subject: [mg46000] Re: changing replacement rule arrow ( ->) to equal sign(==)...
- From: drbob at bigfoot.com (Bobby R. Treat)
- Date: Mon, 2 Feb 2004 05:20:43 -0500 (EST)
- References: <bv83l0$idm$1@smc.vnet.net> <bvaprq$ad4$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
If you really want to think in terms of strings, try this:
expr = {G[
0] -> 4*(5 - 2*Sqrt[6]), tfC[0] -> 2*(5 - 2*Sqrt[6]), C[0] -> 3 - Sqrt[6],
tf[0] -> 3 - Sqrt[6]};
ToExpression@StringReplace[ToString@expr, "->" -> "=="]
Bobby
Harold.Noffke at wpafb.af.mil (Harold Noffke) wrote in message news:<bvaprq$ad4$1 at smc.vnet.net>...
> Kim:
>
> You should recognize that ReplaceAll (/.) will work with the names of
> Mathematica functions (in your case, Rule (->) and Equal (==) ), but
> doesn't seem to work with their multi-character alias strings, even
> when these are enclosed in quotes ("->" and "==").
>
> Perhaps someone can tell us why quoted symbol strings won't work when
> substituted for their associated function names.
>
> Using your posted equations, we have ...
>
> Mathematica 5.0 for Microsoft Windows
> Copyright 1988-2003 Wolfram Research, Inc.
> -- Terminal graphics initialized --
>
> In[1]:= {G[0] -> 4*(5 - 2*Sqrt[6]), tfC[0] -> 2*(5 - 2*Sqrt[6]), C[0]
> -> 3 - Sqrt[6], tf[0] -> 3 - Sqrt[6]} /. Rule -> Equal
>
> Out[1]= {G[0] == 4 (5 - 2 Sqrt[6]), tfC[0] == 2 (5 - 2 Sqrt[6]), C[0]
> == 3 - Sqrt[6], tf[0] == 3 - Sqrt[6]}
>
> In[2]:= {G[0] -> 4*(5 - 2*Sqrt[6]), tfC[0] -> 2*(5 - 2*Sqrt[6]), C[0]
> -> 3 - Sqrt[6], tf[0] -> 3 - Sqrt[6]} /. "->" -> "=="
>
> Out[2]= {G[0] -> 4 (5 - 2 Sqrt[6]), tfC[0] -> 2 (5 - 2 Sqrt[6]), C[0]
> -> 3 - Sqrt[6], tf[0] -> 3 - Sqrt[6]}
>
> Regards,
> Harold