Re: format of "Solve" output
- To: mathgroup at smc.vnet.net
- Subject: [mg59929] Re: format of "Solve" output
- From: Peter Pein <petsie at dordos.net>
- Date: Fri, 26 Aug 2005 04:53:21 -0400 (EDT)
- References: <200508190831.EAA27442@smc.vnet.net> <dek84b$a8k$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Ed Peschko schrieb:
> hey all,
>
> I had a simple question that I can't find a simple answer for in the docs:
>
> When you solve an equation using 'Solve', it comes out in the format:
>
> {{ x -> a+b, y -> 2 a + b}}
>
> However, when you try to transform the equations for use in FindInstance,
> say by using:
>
>
> Fold[And, 1, Apply[Equal, %25[[1]], {1}]]
>
> you get:
>
> "x" == "a" + "b" && "y" + 2 "a" + "b"
>
> In other words, variables lose their variableness. So, when you
> plug the results into, say, FindInstance it complains that "a" is not
> a variable.
>
> Is there any reason for this? And how can you turn the character strings
> back into variables?
>
> Thanks,
>
> Ed
>
Hi Ed,
how did you get this result?
% is the last result, %25 is 25 times the l.r., %25[[1]] is the first
part of 25*(last result). I don't want to try to analyze it further
(b.t.w. assuming you get a list lst from Apply[.], what is your
intention to use Fold to compute
And[lst[[Length[lst]]],And[...And[lst[[1]],1]]] ?).
I get
x == a + b && y == 2*a + b
from And @@ Equal @@@ First @ {{ x -> a+b, y -> 2 a + b}};
In FullForm:
And[Equal[x,Plus[a,b]],Equal[y,Plus[Times[2,a],b]]]
no strings...
Regards,
Peter
--
Peter Pein, Berlin
GnuPG Key ID: 0xA34C5A82
http://people.freenet.de/Peter_Berlin/
- References:
- Nested Lists, Definition and Evaluation.
- From: "Alexander" <beginning.physst@mail.ru>
- Nested Lists, Definition and Evaluation.